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
-
(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
G
specifies that it may trigger every cycle, the Filament type checker must check that repeated re-execution is safe.Safety is checked is assuming that
G
will 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
G
andL
and provides an ordering constraint between them,L >= G+3
. The ordering constraint requires that any called of the component ensures thatL
arrives at least 3 cycles afterG
does.In order to ensure safe pipelining, we have to reason about the retriggering behavior of both
G
andL
and 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
G
andL
do 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
G
must be dependent on the eventL
occurring;G
may not retrigger unlessL
has triggered:Next, we need to ensure that
L1
obeys the interface constraint:which is the same as (where
dG
is the delay forG
):This means that the constraint on the delay for
L
looks something like:This shows that the delay for
L
depends on the delay ofG
; however, the delay ofG
is itself dependent onL
.TLDR: The history of
L
andG
are interdependent; in order to figure out when the nextL
should occur, we need to know when the lastG
occurred. In other words, the@interface
for 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
G
andL
. 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
G
andL
is 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
Latch
that use the same event are still valid:Furthermore, it might still be possible to use
max
expression to express a limited form of dynamism in the language.Beta Was this translation helpful? Give feedback.
All reactions