Skip to content

feat(sv)!: support wait fork and disable fork process control - #2116

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-tests-preprocessing/support-wait-fork-disable-fork-process-control--9f0dd3b8
Oct 26, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-tests-preprocessing/support-wait-fork-disable-fork-process-control--9f0dd3b8

Conversation

@tignear

@tignear tignear commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Forked processes could run concurrently but their caller could not wait for all outstanding children or cancel them. Implement wait fork across all live immediate children, including earlier forks and task calls. Implement disable fork across every descendant, including descendants of completed parents, while preserving the caller and its siblings.

Remove cancelled activations from pending starts, waits, ready/inactive/reactive queues and scheduled wakeups before reusing their IDs. Preserve checkpoint replay of joins and cancellation. Function calls retain their caller's process identity for disable fork; wait fork remains forbidden in functions. Handle frameless processes and zero-time final procedures safely.

Update obsolete rejection tests and document the supported behavior. Accept exactly four measured official fail-to-pass verdicts for wait_fork and disable_fork in two/four-state modes. These upstream cases exercise elaboration; portable cases exercise execution.

Partially addresses #2111. State-file serialization, compound automatic-local event expressions, deferred assertions and join_none exceptions remain separate work.

Validation:

  • P2 review follow-up: retain the kernel during wait-condition evaluation, restore the full predicate resume point after a false reevaluation, and propagate wait fork/fork through task classification. Four new cases fail in all 24 configurations before the fix and pass afterward.
  • Follow-up validation: 1,057 timing tests, affected frontend unit tests, runtime consumers, Clippy, debug NAPI and 28 JS tests pass. The final explicit-argument reevaluation case also passes all six backend configurations.
  • External follow-up: Verilator passes three of four new cases, but waits on a cached function result instead of reevaluating the effectful predicate in the fourth (expected q=1, observed q=0). Icarus passes both event-driven task cases; a no-argument wait function hits its Empty NexusSet internal error and the explicit-argument cancellation case leaves the child alive (q=99).
  • Twelve portable cases pass in 72 configurations across Native/parallel/image, Cranelift/parallel and WASM, including four-state behavior.
  • Four API tests cover Interpreter/native differential checkpoint replay, cancellation and ID reuse, final no-op behavior and frameless process wakeups. The frameless regression panics before the fix and passes afterward.
  • Existing fork API seven, library 946 and consumer 343 tests pass. Timing has 1,032 passing tests; the sole stale unsupported-feature expectation was updated and its focused rerun passes.
  • Formatting, affected-crate Clippy, debug NAPI build and 28 JS boundary tests pass.
  • Official pinned runner verifies both affected cases in both modes using the debug driver; full release conformance remains in CI.
  • Verilator 5.052 passes all eleven two-state cases; four-state is unsupported. Icarus 13.0 passes ten cases but fails to cancel descendants of completed parents and children from a function call. Expectations follow IEEE 1800-2023 9.6.1, 9.6.3 and 13.4 and are corroborated by Verilator.

BREAKING CHANGE: ProcessStatus and procedural IR gain process-control variants; native image format advances to version 41.

Depends-On: #2112

@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:14:17.675753Z afa4716 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.

@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: f60c2b38df

ℹ️ 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 +2999 to +3001
if self.kernel.is_none() {
return if matches!(stmt, sv::ir::Stmt::DisableFork) {
Ok(true)

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 cancellation when lowering a wait-condition function

When a function containing disable fork is called from a wait condition, this branch silently discards the cancellation. Ff::wait_level temporarily takes self.kernel out while lowering the predicate, so self.kernel.is_none() does not necessarily mean execution is outside a timed process. For example, after spawning a delayed child, wait(cancel()) with a function that executes disable fork and returns 1 continues without cancelling that child, allowing its later writes to occur. Preserve the caller's process-control effects while lowering these predicates, rather than treating this temporary builder state as a no-op context.

Useful? React with 👍 / 👎.

Comment on lines +971 to +973
StatementKind::WaitFork => {
self.allow_timing("wait fork statement")?;
Ok(vec![Stmt::WaitFork])

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 Include wait fork in timed-task classification

Tasks containing the newly accepted Stmt::WaitFork are not classified as suspendable: ast/procedural/timed_tasks.rs::suspends still recognizes only delays, event controls, level waits, and previously classified task calls. Consequently, a valid ordinary process such as always @(posedge clk) await_children();, where await_children contains wait fork, remains on the non-kernel FF lowering path and fails with fork control outside a timed process. Add this variant to suspension propagation so ordinary event-driven callers are promoted to process kernels, as they are for other blocking task statements.

Useful? React with 👍 / 👎.

Forked processes could run concurrently but their caller could not wait for all outstanding children or cancel them. Implement wait fork across all live immediate children, including earlier forks and task calls. Implement disable fork across every descendant, including descendants of completed parents, while preserving the caller and its siblings.

Remove cancelled activations from pending starts, waits, ready/inactive/reactive queues and scheduled wakeups before reusing their IDs. Preserve checkpoint replay of joins and cancellation. Function calls retain their caller's process identity for disable fork; wait fork remains forbidden in functions. Handle frameless processes and zero-time final procedures safely.

Update obsolete rejection tests and document the supported behavior. Accept exactly four measured official fail-to-pass verdicts for wait_fork and disable_fork in two/four-state modes. These upstream cases exercise elaboration; portable cases exercise execution.

Partially addresses #2111. State-file serialization, compound automatic-local event expressions, deferred assertions and join_none exceptions remain separate work.

Validation:
- P2 review follow-up: retain the kernel during wait-condition evaluation, restore the full predicate resume point after a false reevaluation, and propagate wait fork/fork through task classification. Four new cases fail in all 24 configurations before the fix and pass afterward.
- Follow-up validation: 1,057 timing tests, affected frontend unit tests, runtime consumers, Clippy, debug NAPI and 28 JS tests pass. The final explicit-argument reevaluation case also passes all six backend configurations.
- External follow-up: Verilator passes three of four new cases, but waits on a cached function result instead of reevaluating the effectful predicate in the fourth (expected q=1, observed q=0). Icarus passes both event-driven task cases; a no-argument wait function hits its Empty NexusSet internal error and the explicit-argument cancellation case leaves the child alive (q=99).
- Twelve portable cases pass in 72 configurations across Native/parallel/image, Cranelift/parallel and WASM, including four-state behavior.
- Four API tests cover Interpreter/native differential checkpoint replay, cancellation and ID reuse, final no-op behavior and frameless process wakeups. The frameless regression panics before the fix and passes afterward.
- Existing fork API seven, library 946 and consumer 343 tests pass. Timing has 1,032 passing tests; the sole stale unsupported-feature expectation was updated and its focused rerun passes.
- Formatting, affected-crate Clippy, debug NAPI build and 28 JS boundary tests pass.
- Official pinned runner verifies both affected cases in both modes using the debug driver; full release conformance remains in CI.
- Verilator 5.052 passes all eleven two-state cases; four-state is unsupported. Icarus 13.0 passes ten cases but fails to cancel descendants of completed parents and children from a function call. Expectations follow IEEE 1800-2023 9.6.1, 9.6.3 and 13.4 and are corroborated by Verilator.

BREAKING CHANGE: ProcessStatus and procedural IR gain process-control variants; native image format advances to version 41.

Change-Id: I9f0dd3b8a7a23a655d9b8a76f9a8a545ec1a4a22
@tignear
tignear force-pushed the stack/tignear/fix/sv-tests-preprocessing/support-wait-fork-disable-fork-process-control--9f0dd3b8 branch from f60c2b3 to afa4716 Compare October 26, 2026 07:12
@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
@tignear

tignear commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial f60c2b3 2026-10-26 07:11 UTC
2 content f60c2b3 → afa4716 Fix both P2 review findings: preserve process-control effects in wait predicates and classify wait fork/fork task calls as requiring process kernels. Restore the predicate entry point after false ree… 2026-10-26 07:11 UTC

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 26, 2026
@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 48 minutes 31 seconds in the queue, including 47 minutes 7 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • depends-on = celox-sim/celox#2112 [⛓️ feat(sv)!: execute fork branches as dynamic process activations #2112]
  • 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

Base automatically changed from stack/tignear/fix/sv-tests-preprocessing/execute-fork-branches-dynamic-process-activations--30dae837 to master October 26, 2026 08:28
@mergify
mergify Bot merged commit ddb2234 into master Oct 26, 2026
26 checks passed
@mergify
mergify Bot deleted the stack/tignear/fix/sv-tests-preprocessing/support-wait-fork-disable-fork-process-control--9f0dd3b8 branch October 26, 2026 08:39
@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