Generalizing Sharing #1018
Replies: 1 comment 2 replies
-
Awesome; this should be fun. About step 1 (eliminating Relatedly, on "defining shareability": to state the obvious, this "shareable" criterion must at least encompass (a) combinational logic and (b) registers. But of course it will generalize that category according to some criteria TBD. While it's not a foregone conclusion, one possible way this could look is:
|
Beta Was this translation helpful? Give feedback.
-
The Calyx compiler currently has two passes to "share" resources in some capacity:
resource-sharing
: Responsible for sharing combinational primitivesminimize-regs
: Responsible for sharing registersThe goal of this is to implement a new pass that generalize the above passes and allows us to share arbitrary Calyx components. The key idea is that we apply the live range analysis used by
minimize-regs
to compute live ranges for components and share them when possible.Eliminating
resource-sharing
The first step is getting rid of the resource sharing passing by observing that its a specialized case of
minimize-regs
. The latter has to compute the live ranges of registers because they are stateful and can be read after a write. In contrast, combinational primitives cannot be read outside the group using them; in other words, their live range starts and ends with the same group. We should use this insight to generalizeminimize-regs
to share combinational components.Sharing Components
minimize-regs
is able to share registers because they have a special interface w.r.t. state---every write completely overwrites all internal state. This means that when sharing registers using their live range, we can be guaranteed that a write makes registers indistinguishable:into:
On the other hand, components are similar to java classes---they carry additional state that can be modified at every invocation. In order to share resources, we need to be guaranteed that a "write" to a component completely eliminates all state.
Defining Shareability
One open question is what makes a component safely shareable. For example, our multiplier primitive
std_mult_pipe
is shareable because even though it has internal state, each invocation wipes it out. This leads to two questions:Interface for Shareable Components
A starting point is using an annotation of mark a component as shareable. Once we have convinced ourselves that we have a good answer for (1) in the previous section, we can use the
share
annotation to represent components.Beta Was this translation helpful? Give feedback.
All reactions