Repository navigation
feat(sv)!: execute fork branches as dynamic process activations - #2112
Conversation
|
This pull request is part of a Mergify stack:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
edc5dde to
34807b3
Compare
Revision history
|
SystemVerilog fork blocks were rejected. Lower fork/join, join_any and join_none into child entry points of stackless process kernels and schedule dynamic activations, starting children when their parent blocks or terminates. Give each activation private control, temporary and random state while sharing automatic lexical cells with its children. Preserve local lifetimes, nested and repeated forks, event waits, queued NBA captures, heap roots, checkpoint restoration and native image roundtrips. Terminate pending children on program $exit and preserve $stop/$finish behavior. Document current restrictions. Layout-independent state files reject dynamic activations explicitly; checkpoint/restore is supported. Follow-up work is tracked in #2111. Validation: - CI run 40278499596 executes 3,300 official mode runs: 12 fail-to-pass improvements, no regressions. Accept only these measured fork/block expectation rows (six cases in both state modes). - 16 shared cases pass in 96 backend configurations, including native/parallel/image roundtrip, Cranelift/parallel and WASM with a four-state regression. - Seven API tests pass, covering Interpreter, differential scheduling, checkpoints, stop/finish and program exit. The exit regression fails before the fix. - 946 library, 379 consumer, 961 timing and 18 final-procedure tests pass; existing ignores retained. Focused program revalidation passes 49 tests, and the parameter-override diagnostic regression passes. - Debug NAPI build and 28 JS boundary tests pass. Formatting, diff checks and affected-crate Clippy pass. - Icarus 13.0: 8 pass, 5 unsupported automatic-lifetime compilation errors, 3 internal aborts on detached automatic tasks. - Verilator 5.052: 14 pass, one unsupported four-state case, one NBA mismatch caused by a shared pending index/flag across coroutine activations. Expectations remain unchanged; full release-driver conformance is left to CI. BREAKING CHANGE: Process frame metadata and dynamic activation state extend the runtime/schema interfaces; native image format advances to version 40. Change-Id: I30dae837f9b9116374981790de83472a4e3a2313
Merge Queue Status
This pull request spent 4 minutes 26 seconds in the queue, with no time running CI. ReasonThe pull request #2112 has been manually updated Waiting for
All conditions
Requeued — the merge queue status continues in this comment ↓. |
34807b3 to
6b7252f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b7252fa63
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if let Baseline::Value(last) = baseline { | ||
| wake |= occurs(term.kind, last, value); | ||
| *last = value.clone(); | ||
| continue; |
There was a problem hiding this comment.
Preserve intermediate edges on shared automatic locals
When a child pulses a shared automatic variable within one kernel execution, this path compares only the final saved cell value and ignores occurrence counters. For example, with automatic bit v=0, one fork branch waiting on @(posedge v) and another executing #1; v=1; v=0;, the waiter never wakes because both its baseline and the saved value are zero. Preserve activation-specific occurrences, rather than only final values, so these supported event controls do not silently miss edges.
Useful? React with 👍 / 👎.
| sv::ir::Stmt::Fork { join, branches } => { | ||
| if self.kernel.is_none() { | ||
| return Err(unsupported("fork outside a timed process")); |
There was a problem hiding this comment.
Propagate fork-only task calls into timed process classification
An edge-sensitive always calling a task whose fork branches contain no explicit delay or wait still reaches this rejection. For example, task launch(); fork q=1; join_none endtask called from always @(posedge clk) launch(); remains an FF process because ast/procedural/timed_tasks.rs::suspends recognizes delays, waits and timed callees, but not Stmt::Fork. Consequently, the caller has no process kernel and this otherwise supported fork fails to compile. Include forks in suspension classification and propagate that requirement through task callers.
Useful? React with 👍 / 👎.
| celox_design::ProcessFrame { | ||
| private, | ||
| locals: self.frame_locals, |
There was a problem hiding this comment.
Allocate activation-local storage for unrolled loop variables
When overlapping children execute the same constant-bound loop, its declared index can be absent from both frame lists: exec_loop takes the unroll path, which skips the initializer's Stmt::Local, so the new local-allocation handling never registers the index; it is also a pre-existing source variable rather than a newly created temporary. Nested fork branches clear the constant overlay and therefore read that index from shared backend storage. For example, two overlapping executions of for (int j=0; j<2; j++) begin #1; fork q=q+j; join end can read another activation's advanced or completed index and produce the wrong sum. Allocate a cell for the loop declaration even when unrolling, or disable this optimization when activation-local storage is required.
Useful? React with 👍 / 👎.
Merge Queue Status
This pull request spent 43 minutes 39 seconds in the queue, including 41 minutes 14 seconds running CI. Required conditions to merge
|
SystemVerilog fork blocks were rejected. Lower fork/join, join_any and join_none into child entry points of stackless process kernels and schedule dynamic activations, starting children when their parent blocks or terminates.
Give each activation private control, temporary and random state while sharing automatic lexical cells with its children. Preserve local lifetimes, nested and repeated forks, event waits, queued NBA captures, heap roots, checkpoint restoration and native image roundtrips. Terminate pending children on program $exit and preserve $stop/$finish behavior.
Document current restrictions. Layout-independent state files reject dynamic activations explicitly; checkpoint/restore is supported. Follow-up work is tracked in #2111.
Validation:
BREAKING CHANGE: Process frame metadata and dynamic activation state extend the runtime/schema interfaces; native image format advances to version 40.