Implicit Pipelining with Dynamic Events #104
rachitnigam
started this conversation in
Ideas
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
(Moved from #27)
In Filament, components are implicitly pipelined. For example, in the following component can execute in a pipelined fashion:
Since the interface for
Gspecifies that it may trigger every cycle, the Filament type checker must check that repeated re-execution is safe.Safety is checked is assuming that
Gwill trigger any time after its delay, in this case 1, and showing that no re-execution of the pipeline after G's delay would conflict with the current iteration.Pipelining with Dynamic Events
Consider the following component signature:
The interface specifies two events
GandLand provides an ordering constraint between them,L >= G+3. The ordering constraint requires that any called of the component ensures thatLarrives at least 3 cycles afterGdoes.In order to ensure safe pipelining, we have to reason about the retriggering behavior of both
GandLand ensure that their delay do not violate the constraint on the interface. As provided, the interface is incorrect; here is an trace of events that is accepted by the interface but violate the constraint:Note that this trace is accepted by the delay specifications for$G$ and $L$ since $G_1 - G_0 = 3$ and $L_1 - L_0 = 1$ . However, it violates the constraint on the interface since $L_1 \ngeq G_1 + 3$ .
Restricting Interfaces
The key problem is that the delay specification for
GandLdo not constraint the event in such a way that subsequent retriggers obey the constraints of the interface. Ideally, we could change the delay specification such that the constraint holds. We would like trace history to look something like:This implies that the delay for
Gmust be dependent on the eventLoccurring;Gmay not retrigger unlessLhas triggered:Next, we need to ensure that
L1obeys the interface constraint:which is the same as (where
dGis the delay forG):This means that the constraint on the delay for
Llooks something like:This shows that the delay for
Ldepends on the delay ofG; however, the delay ofGis itself dependent onL.TLDR: The history of
LandGare interdependent; in order to figure out when the nextLshould occur, we need to know when the lastGoccurred. In other words, the@interfacefor both events need to be able to talk about the trace of the other event directly so that the constraint can be obeyed.The Problem
The problem here is the constraint between
GandL. By specifying it, we relate the traces of events in some manner, and we need the delay specifications to encode this information. Since interfaces only talk about delays, there is no way to relate histories of multiple events.At this point we have two solutions:
I do not think (1) is worth doing. This is because even if we can make it work, this way of relating dynamic events together does not correspond well with dynamic pipelines. I think the right way of doing this probably requires some mechanism of specifying type-level "back pressure"; the retrigger of
GandLis not dependent on the two events but rather the availability of the resources. The resources should be able to apply back pressure to the rest of the circuit to stall events from arriving. Doing all of this is definitely out of scope for the first paper.This means that the proposed solution is disallowing ordering constraints in the language.
The Fix
The proposed fix is to disallow constraints on user-level components but to allow them on primitives. For example, the register primitive is still allowed to specify the constraint:
User-level components do not have ordering constraints, there is no way to construct a dynamic use of the
Latch:This program will not type-check since the component cannot specify
L > G+1.However, uses of such
Latchthat use the same event are still valid:Furthermore, it might still be possible to use
maxexpression to express a limited form of dynamism in the language.Beta Was this translation helpful? Give feedback.
All reactions