scheduling primitives for bluespec arvind computer science & artificial intelligence lab
DESCRIPTION
Scheduling Primitives for Bluespec Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Work in progress. outQ. Done?. mem. fifo. Motivation. rule “recirculate” x = mem.peek(); y = fifo.first(); - PowerPoint PPT PresentationTRANSCRIPT
March 2007 http://csg.csail.mit.edu/arvind Semantics-1
Scheduling Primitives for Bluespec
ArvindComputer Science & Artificial Intelligence LabMassachusetts Institute of Technology
Work in progress
March 2007 Semantics-2http://csg.csail.mit.edu/arvind
mem
fifo
Done?
outQ
Motivation
rule “recirculate” x = mem.peek(); y = fifo.first(); if done?(x) then fifo.deq() ; mem.deq() ; outQ.enq(x) else mem.deq(); mem.req(addr(x)); fifo.deq(); fifo.enq(y)Need a way of - saying deq happens before enq within the same rule - building such a FIFO
March 2007 Semantics-3http://csg.csail.mit.edu/arvind
BS: A Language of Atomic ActionsA program is a collection of instantiated modules m1 ; m2 ; ...
Module ::= Module name[State variable r][Rule R a]
[Action method g (x) = a][Read method f (x) = e]
e ::= r | c | t | Op(e , e) | e ? e : e | (t = e in e)
| m.f(e) | e when e
a ::= r := e | if e then a | a | a | a ; a | (t = e in a)
| m.g(e) | a when e
Conditionalaction
ParallelCompositionSequentialComposition
Method callGuarded action
March 2007 Semantics-4http://csg.csail.mit.edu/arvind
mem
fifo
Done?
outQ
LPM in Bluespecusing the sequential connective
module lpmrule “recirculate”
action method enter(x) = mem.req(addr(x)) | fifo.enq(x)
(x = mem.peek() in (y = fifo.first() in(if done?(x) then fifo.deq() | mem.deq() | outQ.enq(x) else (mem.deq(); mem.req(addr(x))) | (fifo.deq(); fifo.enq(y)))
Notice
Different made up syntax
March 2007 Semantics-5http://csg.csail.mit.edu/arvind
Guards vs If’sGuards affect the surroundings
(a1 when p1) | a2 ==> (a1 | a2) when p1
Effect of an “if” is local
(if p1 then a1) | a2 ==> if p1 then (a1 | a2) else a2
p1 has no effect on a2
March 2007 Semantics-6http://csg.csail.mit.edu/arvind
Conditionals & Cases
if p then a1 else a2 if p then a1 | if !p then a2
Similarly for cases
March 2007 Semantics-7http://csg.csail.mit.edu/arvind
Semantics of a rule execution
Specify which state elements the rule modifies Let represent the value of all the
registers before the rule executes Let U be the set of updates implied by
the rule execution
March 2007 Semantics-8http://csg.csail.mit.edu/arvind
BS Action Rulesreg-update ├ e v, (v != ┴)
├ (r := e) {(r , v)}
Like a set union but blows up if there are any duplicates
Like pmerge but U2 dominates U1
if-true ├ e true, ├ a U ├ (if e then a) U
if-false ├ e false├ (if e then a)
par ├ a1 U1, ├ a2 U2 ├ (a1 | a2) pmerge(U1,U2)
seq ├ a1 U1, update(,U1)├ a2 U2├ (a1 ; a2) smerge(U1,U2)
March 2007 Semantics-9http://csg.csail.mit.edu/arvind
BS Action Rules cont
a-let-sub ├ e v, smerge(,{(t,v)})├ a U├ ((t = e) in a) U
Expression rules are similar
a-meth-call ├ e v , (v != ┴) ,x.a = lookup(m.g),
smerge(,{(x,v)}) ├ a U ├ m.g(e) U
March 2007 Semantics-10http://csg.csail.mit.edu/arvind
Guard Semantics
If no rule applies, e.g., if e in (a when e) returns false, then the system is stuck and the effect of the whole atomic action of which (a when e) is a part is “no action”.
a-when-ready ├ e true, ├ a U
├ (a when e) U
e-when-ready-true ├ e1 v, ├ e2 true
├ (e1 when e2) v
e-when-ready-false ├ e1 v, ├ e2 false
├ (e1 when e2) ┴
March 2007 Semantics-11http://csg.csail.mit.edu/arvind
Execution model
Repeatedly:Select a rule to execute Compute the state updates Make the state updates
Highly non-deterministic
Implementation concern: Schedule multiple rules concurrently without violating one-rule-at-a-time semantics
March 2007 Semantics-12http://csg.csail.mit.edu/arvind
mem
fifo
Done?
outQ
LPM: Scheduling issues
module lpmrule “recirculate”
action method enter(x) = mem.req(addr(x)) | fifo.enq(x)
(x = mem.res() in (y = fifo.first() in(if done?(x) then fifo.deq() | mem.deq() | outQ.enq(x) else (mem.deq(); mem.req(addr(x))) | (fifo.deq(); fifo.enq(y)))
Can a rule calling method “enter” execute concurrently with the “recirculate” rule ?If not who should have priority?
March 2007 Semantics-13http://csg.csail.mit.edu/arvind
Concurrent Scheduling & Rule composition
Rule R1 a1 when p1Rule R2 a2 when p2
Scheduling Primitives:1. S = par(R1,R2) where the meaning of rule S is Rule S ((if p1 then a1)|(if p2 then a2)) when (p1 xor p2) 2. S = compose(R1,R2) where the meaning of rule S is
Rule S ((a1 when p1);(a2 when p2))3. S = restrict(R1,R2) where the meaning of rule S is Rule S (a2 when (!p1 & p2))
March 2007 Semantics-14http://csg.csail.mit.edu/arvind
SchedulesGrammar S ::= R
| compose(S, S)| par(S, S)| restrict(S, S)
1. The user must specify a schedule
2. A rule can occur multiple times in a schedule
Such schedules combined with rule-splitting lets the user specify concurrency safely in execution
March 2007 Semantics-15http://csg.csail.mit.edu/arvind
LPM: Split the Internal rulemodule lpm
rule “recirculate” (x = mem.res() in (y = fifo.first() in (if !done?(x) then (mem.deq(); mem.req(addr(x))) | (fifo.deq(); fifo.enq(y)))rule “exit” (x = mem.res() in (y = fifo.first() in (if done?(x) then fifo.deq() | mem.deq() | outQ.enq(x)
action method enter(x) = mem.req(addr(x)) | fifo.enq(x)
March 2007 Semantics-16http://csg.csail.mit.edu/arvind
LPM SchedulesSchedule-1rc = restrict(enter,recirculate)ee = compose(exit,enter)ex = restrict(ee,exit) en = restrict(exit,enter)S1 = par(rc,ee,en,ex)
Schedule-2er = restrict(recirculate, enter)ee = compose(exit,er)ex = restrict(ee,exit) en = restrict(er,exit)S2 = par(ee,en,ex)
enter has priority over recirculate; no dead cycles
recirculate has priority over enter; no dead cycles
Difficult to pick between S1 and S2!
March 2007 Semantics-17http://csg.csail.mit.edu/arvind
Final wordsMarket forces are demanding a much greater variety of SoCsThe design cost for SoCs has to be brought down dramatically by facilitating IP reuseHigh-level synthesis tools are essential for architectural exploration and IP development
Bluespec and associated tools are a promising solution to this problem
March 2007 Semantics-18http://csg.csail.mit.edu/arvind
Resources
The Blusepec Inc Web site http://bluespec.com http://bluespec.com/products/Papers.htm
Contact Bluespec Inc to get a free copy of the BSV language manual. For other publications: http://csg.lcs.mit.edu/pubs/bluespecpubs.html
The 6.375 subject at MIT: Complex Digitial Systems http://csg.csail.mit.edu/6.375/
Thanks for listening