Exploring heuristics forSynchronous Data Flow scheduling
Pieter HartelTheo RuysMarc Geilen
What do we mean by Synchronous Data Flow?
• Data driven• Fixed prod & cons rates• Cycles are ok• Conditionals not ok• (No self edges)
• Simple semantics• Scheduling NP hard• Signal processing• Many variants
ax3
bx2
cx12 3 1 2
Periodic schedules: aababc (max c0=4) and aaabbc (max c0=6)
c0 c1
Two problems: Separate buffers for c0 and c1 or shared buffer?
Semantics (Lee et al, 1987)
• Γ=
• s(0)=
• γ(i) = pick column of Γ• s(i+1) = s(i)+γ(i), 0
2 -3 0
0 1 -2
0
0
0
0
4
0
2
0
6
0
1
13
1 0
2
Common buffer space: 4, separate buffers: 6
a b c
c0
c1
Explore the state spaceLooking for a cycle
Avoiding duplicate worki.e. Model Checking...
Explore the state spaceLooking for a cycle
Avoiding duplicate worki.e. Model Checking...
Separate buffer SPIN model (DAC05)
byte c0, c1;byte s0=4, s1=2; /* min. buffer size calculated from Γ */
init { do/*a*/ :: c0 += 2; s0 = max(c0,s0)/*b*/ :: c0>=3 -> c0 ─= 3; c1 += 1; s1 = max(c1,s1)/*c*/ :: c1>=2 -> c1 ─= 2;
od }
LTL feasible: [] (s0+s1 <= 6) ; infeasible [] (s0+s1 <= 5)
Can we make this more abstract?
a b c2 3 1 2
c0 c1
LTL without s0,s1: [] (c0<=4 && c1<=2)
Limit # times a node is fired(sound but not complete)
byte na, nb, nc;#define c0 (na*2─nb*3)#define c1 (nb*1─nc*2)
init { do/*a*/ :: (na<3) -> na++;/*b*/ :: (nb<2 && c0>=3) -> nb++;/*c*/ :: (nc<1 && c1>=2) -> nc++;
od }#define property(c0<=4 && c1<=2)#define reset (c0==0 && c1==0)
LTL formula : X (property U reset)
Repetition vector: Γ =0
3
2
1
Can’t compute n* from c*
Clustering is sound, but incomplete
cx5
dx5760
ex12
1
1
480
1152
1
cx5
d’x60
ex12
96
1
480
1152
96transformtransform
Proof:96*60=5760
96*5=480
Inmarsat
Checking the bounds
• Simple C program generates Promela models from:– the topology matrix and initial token
assignment of 10 common benchmarks– in 146 versions
• SPIN does the hard work• Performance comparable with special
purpose research tools from Eindhoven & Twente (separate buffers only)
States stored(20-30K per second)
separate modem adebetter inmarsat
feas DAC05 210 8602 2862 148
FMCAD08 50 129* 1133 52
infeas
DAC05 2 1708 2 2
FMCAD08 - 721 - -
common modem adebetter inmarsat
feas DAC05 1231 156 180369 163
FMCAD08 176 109 1110 52
infeas
DAC05 853 140 > 5 min 240
FMCAD08 852 139 > 5 min 81
Limiting & look ahead
Clustering
Finding the bounds(common buffer pool)
1. Start with initial guess g for the optimal bound and step size s using modified DAC05 model
2. repeat
a. exit if SPIN finds a schedule with an optimal bound b ≤ g -- down
b. g ← g+s -- up
3. end repeat
How well does this work?
Adebetter
g states bound
10 30 none
14 66 none
18 157 none
22 7648 21,20,19,18
total 7901
19 1568 18
ratio 5
ratios
Adebetter 5
Ade & Inmarsat
4
rest ≤2
Best case: start at optimal bound+1
Optimal bound
up
down
Conclusions
• Creative laziness: use SPIN as the Swiss army knife of Computer Science
• Creating abstract models is hard
• The effective ideas can be implemented in special purpose tools
• Some new theory for the common buffer pool sizes