-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LLHD] Mem2Reg creates drives to read-only signals #8246
Comments
fabianschuiki
added a commit
that referenced
this issue
Feb 19, 2025
Implement a dedicated LLHD pass that promotes signal/memory slots to SSA values and forwards drives to probes. The pass is distinct from MLIR's upstream Mem2Reg pass in that it also works for regions where the memory slots are defined outside the region. It also understands `llhd.wait` and `llhd.halt` operations which may suspend execution of a process and therefore allows the values of signals to change before execution resumes. To deal with this, the pass uses a lattice to propagate the need for slot definitions backwards from probes, and to propagate reaching definitions for slots forward from drives and initial probes. Using the lattice, the pass can forward driven values to probes as long as there is no process suspension in between (`llhd.wait`), and it will insert probes immediately after and drives immediately before suspension points. This moves most intra-process data flow into SSA values and block arguments, and retains probes and drives around the suspension point to interact with ops outside the process. This first implementation only supports unconditional blocking drives, and only probes and drives that interact with a `llhd.sig` directly without any field projections or aliasing. The pass is designed to deal with these in the future though: a more detailed aliasing analysis can determine which definitions are invalidated by drives, drives to field projections can be converted into field insertions on the whole definition, and drive conditions can be propagated along definitions to the drives inserted by the pass ahead of suspension points. Fixes #8245 Fixes #8246
fabianschuiki
added a commit
that referenced
this issue
Feb 19, 2025
Implement a dedicated LLHD pass that promotes signal/memory slots to SSA values and forwards drives to probes. The pass is distinct from MLIR's upstream Mem2Reg pass in that it also works for regions where the memory slots are defined outside the region. It also understands `llhd.wait` and `llhd.halt` operations which may suspend execution of a process and therefore allows the values of signals to change before execution resumes. To deal with this, the pass uses a lattice to propagate the need for slot definitions backwards from probes, and to propagate reaching definitions for slots forward from drives and initial probes. Using the lattice, the pass can forward driven values to probes as long as there is no process suspension in between (`llhd.wait`), and it will insert probes immediately after and drives immediately before suspension points. This moves most intra-process data flow into SSA values and block arguments, and retains probes and drives around the suspension point to interact with ops outside the process. This first implementation only supports unconditional blocking drives, and only probes and drives that interact with a `llhd.sig` directly without any field projections or aliasing. The pass is designed to deal with these in the future though: a more detailed aliasing analysis can determine which definitions are invalidated by drives, drives to field projections can be converted into field insertions on the whole definition, and drive conditions can be propagated along definitions to the drives inserted by the pass ahead of suspension points. Fixes #8245 Fixes #8246
fabianschuiki
added a commit
that referenced
this issue
Feb 22, 2025
Implement a dedicated LLHD pass that promotes signal/memory slots to SSA values and forwards drives to probes. The pass is distinct from MLIR's upstream Mem2Reg pass in that it also works for regions where the memory slots are defined outside the region. It also understands `llhd.wait` and `llhd.halt` operations which may suspend execution of a process and therefore allows the values of signals to change before execution resumes. To deal with this, the pass uses a lattice to propagate the need for slot definitions backwards from probes, and to propagate reaching definitions for slots forward from drives and initial probes. Using the lattice, the pass can forward driven values to probes as long as there is no process suspension in between (`llhd.wait`), and it will insert probes immediately after and drives immediately before suspension points. This moves most intra-process data flow into SSA values and block arguments, and retains probes and drives around the suspension point to interact with ops outside the process. This first implementation only supports unconditional blocking drives, and only probes and drives that interact with a `llhd.sig` directly without any field projections or aliasing. The pass is designed to deal with these in the future though: a more detailed aliasing analysis can determine which definitions are invalidated by drives, drives to field projections can be converted into field insertions on the whole definition, and drive conditions can be propagated along definitions to the drives inserted by the pass ahead of suspension points. Fixes #8245 Fixes #8246
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following only reads signal
%a_0
, but LLHD's mem2reg pass still inserts a corresponding drive. Reproduce withcirct-opt --llhd-mem2reg
on the following:The pass should probably track if a definition comes from a probe inserted by the pass, or an actual drive to the signal.
The text was updated successfully, but these errors were encountered: