Guarantees for Static Timing #1331
Replies: 3 comments 10 replies
-
Nice! Having these defined for the "static subset" of Calyx seems like a really good idea. Perhaps this should become a docs page once we resolve the unknowns? Here are a few scattered thoughts on the questions within:
I'm not 100% sure what this would mean… since the entire program takes exactly
Are we sure we want the whole thing to take |
Beta Was this translation helpful? Give feedback.
-
Note that the way we've defined the semantics for This also indicates an inverse transformation from non-static |
Beta Was this translation helpful? Give feedback.
-
I'm starting to realize that precise timing guarantees might be fundamentally in tension with the isolated, compositional nature of groups. Consider this program:
This implements a
The FSM simply counts up to
Now we're saying that the FSM is reset the cycle after it is set to 3 allowing us to re-execute the group. Let's see if this works:
This program will generate an incorrect result. Here is the cycle-by-cycle account:
Whoops. The problem is that
The above group can correctly execute all of its internal groups since This means that we cannot compile this group in a non-static context. The problem is that static groups are a fundamentally different beast from normal groups. The reason they can be timing precise is because we guarantee that we are not going to look at their
Implicit in this representation is the fact that Owing to our old adage "problems for groups are problems for components", the following program also doesn't work correctly if the FSM for
Possible SolutionsAll of these problems stem from the idea that
|
Beta Was this translation helpful? Give feedback.
-
By default, Calyx works with a latency-insensitive model of computation and leaves it to the compiler to discover latency information. The compiler can then exploit this information to generate more efficient and performant programs. Long-term, we should treat this as Calyx's "killer feature" and orient the design of the language and the compiler towards it.
To this end, we should work on making latency sensitivity a first-class concept in the language. There are various upgrades to the language that we should consider such as upgrading
static
to a keyword and definingstatic group
s andstatic component
s, all of them begin with a stronger guarantee of how static programs are scheduled.seq
For the following program:
The compiler must guarantee that the execution takes exactly
K + L + M
cycles and thattwo
starts executing on cycleK+1
andthree
starts executing on cycleK+L+1
.par
A
par
program must ensure that all its children start executing in the same cycle:The compiler must ensure that
one
,two
, andthree
all start executing in the same cycle and that the program takes exactlymax(K, L, M)
cycles.if
The
if
program must ensure that thethen
andelse
branches start executing in the same cycle:The program takes
max(K, L)
cycles and either branch is guaranteed to start in the same when theif
program starts.while
The scheduling guarantee of
while
extends to repeated executions. If the body takesK
cycles, then the next iteration must start on cycleK+1
and the program takesn*K
cycles wheren
is the number of iterations.Beta Was this translation helpful? Give feedback.
All reactions