Replies: 1 comment
-
Here is a more in-depth proposal I just finished working on. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
The previously proposed work discussed building techniques for getting a CFG representation of our data flow to be able to apply static analysis on these and prevent data races:
ControlID
to provide a better Interface #1366From my current understanding, Calyx is still using (or I should say, planning on using) the DRF0 semantics presented in #932, which led to us needing more constructs to enforce synchronization when needed. On #921, it's discussed that using something akin to "Lockstep" semantics would cause implicit-uncontrollable freedom. While we have a latency-insensitive version of explicit synchronization (
@sync(n)
), we still require a static-timing version.I want to address a few things, which directly target the technical debt in #1825:
@sync
.My main motivation for this proposal however is that there is some interesting ongoing work with HardKAT. Ideally, this proposal would at the very least aid with the development of a front-end for compiling from Calyx to HardKAT (which shows to be particularly difficult because of the lack of formal semantics in regards to parallelism). I believe some people at BlueSpec are working on their front-end for HardKAT and it does require extending their existing formal semantics.
Technique
My current approach relies on the SKA paper, although more general pomset concurrent KA frameworks could be considered. There has to exist a mapping between our constructs and SKA operators, particularly the synchronous product operator. What does SKA gain us?
I won't go into the very-technical details with regards to our current issues with
par
, but I will assume a small-naivepar
construct for the sake of this example. Let's take a very small subset of Calyx --- PCalyx --- that trivially holds an execution judgment for PCalyx programs:We take the following rules for the
par
construct:For groups$g$ , we can define:
Moreover, we can handle latency-insensitive tasks by introducing a delay:
In summary, we have par-left and par-right which allow non-deterministic interleaving, group-start/group-done are the activation and completion of groups respectively, and a delay.
With this toy PCalyx subset, we can illustrate what I mean by using KA. Let's take the following snippet:
We gain the following representation:
Here,$\times$ is the synchronous product from SKA. We then gain the following properties:
And to handle latency-insensitivity, we have:
For it to fully make sense with SKAT we would need a SKAT-Par formalization$(K, B, +, \cdot, \times, *, 0, 1, \neg)$ which consists of a Kleene algebra, a boolean algebra, and the synchronous product operator $K \times K \to K$ . Here we would also introduce the formalization of the delay-operator.
Finally, the core idea here is to gain parallel composition without a global clock (hence the DRF0 extension semantics). We can use pomset semantics for defining an event partial order on a local time domain for PCalyx as follows:
Local Time Domain: For each component$c$ in a PCalyx program, we associate a local time domain $T_c$ , which is a totally ordered set representing the sequence of events in that component.
Event Partial Order: We define a partial order relation$\prec$ on the set of all events accross all components. For events $e_1, e_2$ :
Parallel Composition: For PCalyx components$a$ and $b$ , their parallel composition $a \times b$ is defined as the set of all possible interleavings of events from $a$ and $b$ that respect the partial order $\prec$ .
This would require some KA proofs, but the final application to PCalyx should look something like this:
Discussion
As I mentioned previously, this is mostly an attempt to formalize some wanted semantics that define the core of PCFGs. Of course, I've just outlined a skeleton of how the process for formalization would look like, but I do think there would be a lot of trickle-down actions this set of semantics could contribute to. I do have some questions:
par
and the ideas behind how to represent the CFGs, do any of these directly affect any motivations behind needing to formalizepar
and as a consequence PCFGs algebraically?par
blocks or@sync
annotations?Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions