Skip to content

feat(runtime)!: run program kernels in the reactive region set - #1896

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feature/feat/1862-sv-program-blocks/run-program-kernels-reactive-region-set--6c899de1
Oct 24, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feature/feat/1862-sv-program-blocks/run-program-kernels-reactive-region-set--6c899de1

Conversation

@tignear

@tignear tignear commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

A kernel of a program instance names the status slot of the instance's
first kernel (ProcessSlots::program). Such kernels start, wake and resume
in the Reactive region, a #0 resumes them in the Re-Inactive region, and
their nonblocking updates take effect in the Re-NBA region (IEEE
1800-2023 4.4.2.6-4.4.2.8, 24.3.1). The reactive region set runs once the
active region set is empty and returns to the active region set for the
design activity it creates (4.5).

ProcessStatus::Exit ends every kernel of the calling program instance
(24.7), and the implicit $finish fires once every program kernel has
ended (24.3). Program kernels run on the reference scheduler.

Designs without programs schedule as before.

BREAKING CHANGE: ProcessSlots gains program, ProcessStatus gains
Exit, ProcessState and ScheduleKey gain the reactive, re-inactive and
Re-NBA queues, and the native image container format is now 35.

Part of #1862.

Validation (rebased on c430061)

  • Built with CI's features (celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus), nextest over celox, celox-runtime, celox-design, celox-frontend-core, celox-frontend-sv, celox-sv-analyzer, celox-sv-syntax and celox-test-suite passes 15241 tests. The nested_write_perf deep_per_bit_* tests were excluded; this change does not touch them.
  • The SV integration binary with CELOX_SCHEDULER=differential passes 4594 tests.
  • This commit alone: cargo check --workspace --all-targets --features celox/systemverilog is clean, and the celox-runtime tests pass.
  • cargo clippy --workspace --all-targets with CI's features and --no-deps is clean, and so is cargo fmt --check.

Performance (designs without programs)

Callgrind Ir, heliodor-dev, taskset 8-11, base master c430061:

Workload Base This stack
b2_vm_dispatch_bit.sv, SimulationState::step_until inclusive 4,417,204,727 4,332,404,573
b2_vm_dispatch_bit.sv, whole program 53,800,141,568 52,803,072,580
sched_bench b1 20000 17,991,281 17,990,905
sched_bench b5 20000 18,272,065 18,271,042
sched_bench b1 20000 reference 237,708,956 226,428,766
sched_bench bh 20000 reference 188,227,032 180,526,964
sched_bench d 20000 reference 172,305,792 163,585,754

Every workload is equal or lower, but not instruction-identical.

@tignear

tignear commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(runtime)!: run program kernels in the reactive region set #1896 👈
2 feat(sv): simulate program blocks #1897

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T20:15:59.017789Z 883befe 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: dee80f04c8

ℹ️ 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".

inactive,
nba_queue,
domain_counters,
..ProcessState::default()

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 reactive queues in state files

When a simulation is saved at $stop with program work pending, the new reactive, re_inactive, and re_nba_queue fields are silently lost: name_processes() still serializes only the original queues, and this reconstruction replaces the new queues with empty defaults. For example, the stopped program itself is now queued in reactive, so loading the saved state can permanently prevent it from resuming; pending program nonblocking assignments are likewise discarded. Extend the state-file process record and its save/load conversion to round-trip all three queues.

Useful? React with 👍 / 👎.

Comment on lines +366 to +371
if round.reactive {
// The Reactive region is empty: the Re-Inactive region's
// processes resume, and once both are empty the Re-NBA region
// publishes the program's nonblocking assignments. Design
// processes and domains wait for the active region set (IEEE
// 1800-2023 4.5, 24.3.1).

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 Defer design combinational evaluation until the reactive set drains

When a program changes an input used by design combinational logic and then suspends with #0, the unconditional settle_pass() above this branch calls settle_marked() → executor.eval_comb() before the program resumes in Re-Inactive. This executes design Active-region work inside the reactive region set, despite deferring design process kernels and sequential domains until afterward. For example, with an initially zero input a and design assignment assign b = a, a program executing a = 1; #0; sample = b; #1; observes the newly computed b prematurely. Defer design combinational evaluation, as well as other design activity, until control returns to the active region set.

Useful? React with 👍 / 👎.

@mergify

mergify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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

A kernel of a program instance names the status slot of the instance's
first kernel (ProcessSlots::program). Such kernels start, wake and resume
in the Reactive region, a #0 resumes them in the Re-Inactive region, and
their nonblocking updates take effect in the Re-NBA region (IEEE
1800-2023 4.4.2.6-4.4.2.8, 24.3.1). The reactive region set runs once the
active region set is empty and returns to the active region set for the
design activity it creates (4.5).

ProcessStatus::Exit ends every kernel of the calling program instance
(24.7), and the implicit $finish fires once every program kernel has
ended (24.3). Program kernels run on the reference scheduler.

Designs without programs schedule as before.

BREAKING CHANGE: ProcessSlots gains `program`, ProcessStatus gains
`Exit`, ProcessState and ScheduleKey gain the reactive, re-inactive and
Re-NBA queues, and the native image container format is now 35.

Change-Id: I6c899de1f0d5e8ca722733a53655ee80e3c988b8
@tignear
tignear force-pushed the stack/tignear/feature/feat/1862-sv-program-blocks/run-program-kernels-reactive-region-set--6c899de1 branch from dee80f0 to 883befe Compare October 24, 2026 20:14
@tignear

tignear commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial dee80f0 2026-10-24 20:11 UTC
2 content dee80f0 → 883befe Review fixes: the Re-NBA and NBA publish share helpers (publish_queued/publish_flagged), and program kernel checks scan the precomputed program_processes list instead of every process.

Rebased…
2026-10-24 20:11 UTC

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 24, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 24, 2026
@mergify

mergify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 2 hours 42 minutes 8 seconds in the queue, including 1 hour 49 minutes 17 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

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