Skip to content

feat(sv)!: execute fork branches as dynamic process activations - #2112

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-tests-preprocessing/execute-fork-branches-dynamic-process-activations--30dae837
Oct 26, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-tests-preprocessing/execute-fork-branches-dynamic-process-activations--30dae837

Conversation

@tignear

@tignear tignear commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

@tignear

tignear commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(sv)!: execute fork branches as dynamic process activations #2112 👈
2 feat(sv)!: support wait fork and disable fork process control #2116

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T07:21:02.076845Z 6b7252f New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 26, 2026
@tignear
tignear force-pushed the stack/tignear/fix/sv-tests-preprocessing/execute-fork-branches-dynamic-process-activations--30dae837 branch from edc5dde to 34807b3 Compare October 26, 2026 06:40
@tignear

tignear commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial edc5dde 2026-10-26 06:40 UTC
2 content edc5dde → 34807b3 Accept exactly 12 reviewed fail-to-pass verdicts from CI run 40278499596 for the newly supported fork blocks; no regressions in the 3300-mode run. 2026-10-26 06:40 UTC
3 rebase 34807b3 → 6b7252f (rebase only) Rebase the remaining fork stack after dependency #2088 merged into master. 2026-10-26 07:11 UTC

Base automatically changed from stack/tignear/fix/sv-tests-preprocessing/execute-final-procedures-simulation-termination--75200be6 to master October 26, 2026 06:58
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
@mergify mergify Bot added the queued Mergify queue entry label Oct 26, 2026
@mergify

mergify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-26 07:08 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🟠 Checks running · on draft merge queue: checking #2112 on master (2a76ded) #2117
  • 🚫 Left the queue — 2026-10-26 07:12 UTC · at 34807b30c73d94f42503f0e15e734539faaa3447

This pull request spent 4 minutes 26 seconds in the queue, with no time running CI.

Reason

The pull request #2112 has been manually updated

Waiting for
  • check-success = Queue validation
  • any of: [🛡 GitHub repository ruleset rule master]
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
    • check-success = @github-actions/Lint & Format
  • any of: [🛡 GitHub repository ruleset rule master]
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of: [🛡 GitHub repository ruleset rule master]
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
    • check-success = @github-actions/NAPI Build (Windows)
  • any of: [🛡 GitHub repository ruleset rule master]
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
    • check-success = @github-actions/Rust Test & NAPI Build
  • any of: [🛡 GitHub repository ruleset rule master]
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
    • check-success = @github-actions/JS Test (Ubuntu)
  • any of: [🛡 GitHub repository ruleset rule master]
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
    • check-success = @github-actions/JS Test (Windows)
All conditions
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
    • check-success = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
    • check-success = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
    • check-success = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
    • check-success = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
    • check-success = @github-actions/JS Test (Windows)
  • check-success = Conventional Commit title
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

Requeued — the merge queue status continues in this comment ↓.

@mergify mergify Bot mentioned this pull request Oct 26, 2026
15 of 71 tasks
@tignear
tignear force-pushed the stack/tignear/fix/sv-tests-preprocessing/execute-fork-branches-dynamic-process-activations--30dae837 branch from 34807b3 to 6b7252f Compare October 26, 2026 07:12
@mergify mergify Bot removed the queued Mergify queue entry label Oct 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +184 to +187
if let Baseline::Value(last) = baseline {
wake |= occurs(term.kind, last, value);
*last = value.clone();
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +3017 to +3019
sv::ir::Stmt::Fork { join, branches } => {
if self.kernel.is_none() {
return Err(unsupported("fork outside a timed process"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +5273 to +5275
celox_design::ProcessFrame {
private,
locals: self.frame_locals,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@mergify mergify Bot added the queued Mergify queue entry label Oct 26, 2026
@mergify

mergify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

@mergify
mergify Bot merged commit 6ce9181 into master Oct 26, 2026
24 checks passed
@mergify
mergify Bot deleted the stack/tignear/fix/sv-tests-preprocessing/execute-fork-branches-dynamic-process-activations--30dae837 branch October 26, 2026 08:28
@mergify mergify Bot removed the queued Mergify queue entry label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant