-
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 crash on reasonable input #8245
Comments
Reduced failing case: hw.module @Foo() {
%0 = llhd.constant_time <0ns, 0d, 1e>
%c0_i42 = hw.constant 0 : i42
%x = llhd.sig %c0_i42 : i42
%y = llhd.sig %c0_i42 : i42
llhd.process {
%1 = llhd.prb %x : !hw.inout<i42>
llhd.drv %y, %1 after %0 : !hw.inout<i42>
%2 = llhd.prb %y : !hw.inout<i42>
func.call @use_i42(%2) : (i42) -> ()
llhd.halt
}
}
func.func private @use_i42(%arg0: i42) |
fabianschuiki
added a commit
that referenced
this issue
Feb 18, 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.
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 crashes
circt-opt --llhd-mem2reg
:The text was updated successfully, but these errors were encountered: