compile-time analysis and specialization of clocks in ...naliniv/presentations/2009-cc-x10.pdf ·...
TRANSCRIPT
![Page 1: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/1.jpg)
Compile-Time Analysis and
Specialization of Clocks in
Concurrent Programs
Nalini Vasudevan (Columbia University)
Olivier Tardieu (IBM Research)
Julian Dolby (IBM Research)
Stephen A. Edwards (Columbia University)
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 1/23
![Page 2: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/2.jpg)
Background
The X10 Programming Language
• Concurrent programming model
• Activities are light weight threads
• Places are distributed memory locations
A1 A2
Place p1
A3 A4 A5
Place p2
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 2/23
![Page 3: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/3.jpg)
The X10 Programming Language
• Activities created using async
async {
/∗ Body of async
executed locally ∗/
}
async (p2) {
/∗ Body of async
executed at p2 ∗/
}
• Synchronization between activities through
• finish
• atomic
• clocks
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 3/23
![Page 4: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/4.jpg)
Clocks in X10
• Barriers in X10
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.next();
}async clocked (c) {
..c.next();..
}c.next();..c.next();
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 4/23
![Page 5: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/5.jpg)
Clocks in X10
• Barriers in X10
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.next();
}async clocked (c) {
..c.next();..
}c.next();..c.next();
Declare a clock
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 4/23
![Page 6: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/6.jpg)
Clocks in X10
• Barriers in X10
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.next();
}async clocked (c) {
..c.next();..
}c.next();..c.next();
Declare a clock
Share the clock
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 4/23
![Page 7: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/7.jpg)
Clocks in X10
• Barriers in X10
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.next();
}async clocked (c) {
..c.next();..
}c.next();..c.next();
Declare a clock
Share the clock
Synchronize: All tasks
clocked on c synchronize
on next().
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 4/23
![Page 8: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/8.jpg)
Clocks in X10
• Barriers in X10
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.next();
}async clocked (c) {
..c.next();..
}c.next();..c.next();
final clock c = clock.factory.clock();async clocked (c) {
..c.next();—–..c.next();—–
}async clocked (c) {
..c.next();—–..
}c.next();—–..c.next();—–
Declare a clock
Share the clock
Synchronize: All tasks
clocked on c synchronize
on next().
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 4/23
![Page 9: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/9.jpg)
More about Clocks
• next()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();......c.next();..
}..c.next();..c.next();
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 5/23
![Page 10: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/10.jpg)
More about Clocks
• next()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();......c.next();..
}..c.next();..c.next();
next()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 5/23
![Page 11: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/11.jpg)
More about Clocks
• next()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();......c.next();..
}..c.next();..c.next();
next()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 5/23
![Page 12: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/12.jpg)
More about Clocks
• next()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();......c.next();..
}..c.next();..c.next();
next()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 5/23
![Page 13: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/13.jpg)
More about Clocks
• next()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();......c.next();..
}..c.next();..c.next();
next()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 5/23
![Page 14: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/14.jpg)
More about Clocks
• resume()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.resume();..c.next();..
}..c.next();..c.next();
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 6/23
![Page 15: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/15.jpg)
More about Clocks
• resume()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.resume();..c.next();..
}..c.next();..c.next();
next()
resume()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 6/23
![Page 16: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/16.jpg)
More about Clocks
• resume()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.resume();..c.next();..
}..c.next();..c.next();
next()
resume()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 6/23
![Page 17: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/17.jpg)
More about Clocks
• resume()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.resume();..c.next();..
}..c.next();..c.next();
next()
resume()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 6/23
![Page 18: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/18.jpg)
More about Clocks
• resume()
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.resume();..c.next();..
}..c.next();..c.next();
next()
resume()
next()
next()
next()
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 6/23
![Page 19: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/19.jpg)
More about Clocks
• drop()
• Explicitly drop
the clock
• Task does not
have to
synchronize
anymore
final clock c = clock.factory.clock();async clocked (c) {
..c.next();..c.drop();..
}..c.next();..c.next();
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 7/23
![Page 20: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/20.jpg)
Motivation
• Default implementation handles all cases
• Protocol violation is handled by exceptions
• Example: call next() after drop()
• We can generate more efficient code if
• Activity never violates the protocol
• Activity never calls resume() on clock c
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 8/23
![Page 21: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/21.jpg)
Design Overview
Static Analysis
Code Specialization
Never Calls resume()?
Exception Free?Distributed?
• Extract model from IR
• One automaton per clock
• Use NuSMV
• X10 compiler plug-in to
choose clock implementation
based on analysis result
• Each clock specialized inde-
pendently
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 9/23
![Page 22: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/22.jpg)
Building the Automaton
c = clock.factory.clock()c.next()if (n > 1)
c.resume()else
c. next();c.next();c.drop();
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 10/23
![Page 23: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/23.jpg)
Building the Automaton
c = clock.factory.clock()c.next()if (n > 1)
c.resume()else
c. next();c.next();c.drop();
c = clock.factory.clock() 1
c.next() 2
if (n > 1)c.resume() 3
elsec. next(); 4
c.next(); 5
c.drop(); 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 10/23
![Page 24: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/24.jpg)
Building the Automaton
c = clock.factory.clock()c.next()if (n > 1)
c.resume()else
c. next();c.next();c.drop();
c = clock.factory.clock() 1
c.next() 2
if (n > 1)c.resume() 3
elsec. next(); 4
c.next(); 5
c.drop(); 6
register 1
next 2
resume 3 next 4
next 5
drop 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 10/23
![Page 25: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/25.jpg)
Building the Automaton
register 1
next 2
resume 3 next 4
next 5
drop 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 11/23
![Page 26: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/26.jpg)
Building the Automaton
register 1
next 2
resume 3 next 4
next 5
drop 6
init (clock) = register;next(clock) :=case
(clock = register) : next_2;(clock = next_2) : {resume_3, next_4};(clock = resume_3) : next_5;(clock = next_4) : next_5;(clock = next_5) : drop_6;1: clock;
esac;DEFINE clock_next = clock in
{next_2, next_4, next_5}DEFINE clock_resume = clock in {resume_3}..
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 11/23
![Page 27: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/27.jpg)
The Protocol
Active Resumed
Inactive Exception
register with c
c.resume
c.next
c.next
any
c.drop c.resumec.dr
op
any
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 12/23
![Page 28: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/28.jpg)
The Monitor
init (state) = inactive;next(state) :=case
(state = inactive) & (clock_register) : active;(state = active) & (clock_drop) : inactive;(state = active) & (clock_resume): resumed;(state = resumed) & (clock_next): active;..
−− Exception cases(state = resumed) & (clock_resume): exception;(state = inactive) & (clock_next) : exception;
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 13/23
![Page 29: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/29.jpg)
The Monitor
register 1
next 2
resume 3 next 4
next 5
drop 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 14/23
![Page 30: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/30.jpg)
The Monitor
register 1state = active
next 2
resume 3 next 4
next 5
drop 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 14/23
![Page 31: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/31.jpg)
The Monitor
register 1
next 2state = active
resume 3 next 4
next 5
drop 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 14/23
![Page 32: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/32.jpg)
The Monitor
register 1
next 2
resume 3state = resumed next 4
next 5
drop 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 14/23
![Page 33: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/33.jpg)
The Monitor
register 1
next 2
resume 3 next 4
next 5state = active
drop 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 14/23
![Page 34: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/34.jpg)
The Monitor
register 1
next 2
resume 3 next 4
next 5
drop 6state = inactive
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 14/23
![Page 35: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/35.jpg)
Dealing with async
c = clock.factory.clock() 1
c.next(); 2
async clocked (c) { 3
c.resume(); 4
}c.next(); 5
c.drop(); 6
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 15/23
![Page 36: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/36.jpg)
Dealing with async
c = clock.factory.clock() 1
c.next(); 2
async clocked (c) { 3
c.resume(); 4
}c.next(); 5
c.drop(); 6
register 1
next 2
next 5
resume 4
drop 6
asyncClockedLocal 3
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 15/23
![Page 37: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/37.jpg)
The Protocol
Active Resumed
Inactive Exception
register with c
c.resume
c.next
c.next or
async clocked(c)async clocked(c)
any
c.drop c.resumec.dr
op
any
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 16/23
![Page 38: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/38.jpg)
Checking for properties
• Is the clock protocol violation free?
AG (!(state = exception))
• Does the clock ever call resume()?
AG (!(state = resumed))
• Is the clock used in multiple places?
AG(!clock_asyncClockedRemote)
• Do the spawned activities ever call next?
G(clock_next− >
H(!(clock_asyncClockedLocal|clock_asyncClockedRemote)))
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 17/23
![Page 39: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/39.jpg)
Code Specialization
Static Analysis
Code Specialization
Never Calls resume()?
Exception Free?Distributed?
• We generate different code
for each clock
• For eg., we remove run-time
exception checks for excep-
tion free clocks
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 18/23
![Page 40: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/40.jpg)
Experimental Results
Example Clocks Lines Result Speed Analysis Time
Up Base NuSMV
Linear Search 1 35 EF, NR, L 35.2% 33.5s 0.4s
Relaxation 1 55 EF, NR, L 87.6 6.7 0.3
All Reduction Barrier 1 65 EF, NR 1.5 27.2 0.1
Pascal’s Triangle 1 60 EF, L 20.5 25.8 0.4
Prime Number Sieve 1 95 NR, L 213.9 34.7 0.4
N-Queens 1 155 EF, NR, ON, L 1.3 24.3 0.5
LU Factorization 1 210 EF, NR 5.7 20.6 0.9
MolDyn JGF Bench. 1 930 NR 2.3 35.1 0.5
Pipeline 2 55 Clock 1: EF, NR, L
Clock 2: EF, NR, L
31.4 7.5 0.5
Edmiston 2 205 Clock 1: NR, L
Clock 2: NR, L
14.2 29.9 0.5
EF: No ClockUseException
NR: No Resume
ON: Only the activity that created the clock calls next on it
L: Clocked used locally (in a single place)
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 19/23
![Page 41: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/41.jpg)
Conclusion
• Sequential analysis for concurrency optimization
• Our analysis is safe
• Combined with alias analysis
• Future work
• Modular techniques
• Inter-activity analysis
• Refining alias analysis using clock information
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 20/23
![Page 42: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/42.jpg)
Beginning of Research
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 21/23
![Page 43: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/43.jpg)
Combining with Alias Analysis
final clock c = clock.factory.clock();final clock d = clock.factory.clock();final clock x = (n > 1)? c: d;x.next();x.resume();
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 22/23
![Page 44: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/44.jpg)
Combining with Alias Analysis
final clock c = clock.factory.clock();final clock d = clock.factory.clock();final clock x = (n > 1)? c: d;x.next();x.resume();
final clock c = clock.factory.clock();final clock d = clock.factory.clock();if (∗) {
c.next();c.resume();
} else {d.next();d.resume();
}
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 22/23
![Page 45: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/45.jpg)
Combining with Alias Analysis
final clock c = clock.factory.clock();final clock d = clock.factory.clock();final clock x = (n > 1)? c: d;x.next();x.resume();
final clock c = clock.factory.clock();final clock d = clock.factory.clock();if (∗)
c.next();else
d.next();if (∗)
c.resume();else
d.resume();}
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 22/23
![Page 46: Compile-Time Analysis and Specialization of Clocks in ...naliniv/presentations/2009-cc-x10.pdf · Experimental Results Example Clocks Lines Result Speed Analysis Time Up Base NuSMV](https://reader033.vdocuments.site/reader033/viewer/2022060502/5f1c6f664cf8ab7fce7dc8e7/html5/thumbnails/46.jpg)
Related Work
• Typestate analysis
• Model checking concurrent programs
• Code specialization
• Specialization of CML message-passing techniques
[Reppy 2007]
• Analysis of X10 programs
• May-happen-in-parallel analysis [Agarwal 2007]
Complile-Time Analysis and Specialization of Clocks in Concurrent Programs – p. 23/23