Skip to content

feat(runtime)!: opt-in partitioned combinational settle - #2106

Merged
mergify[bot] merged 1 commit into
masterfrom
feature/perf/2013-partitioned-settle
Oct 26, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
feature/perf/2013-partitioned-settle

Conversation

@tignear

@tignear tignear commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Part 1 of #2013: the infrastructure for a combinational settle that runs only the parts whose inputs changed. It stays off unless enabled (SirPass::PartitionedSettle, +sir:partitioned_settle, or SimulatorBuilder::settle_partition). With unconditional marks it does not pay off yet on C906; change-detected marks come in the next PR, which turns it on by default.

What it does

  • Partitions. The scheduler cuts the settle into contiguous ranges of its schedule (SettlePartitioning). It does not partition schedules with captures or pre-lowered nodes, or settles that run on lanes. Each partition is guarded by one byte of a hidden $settle.flags object, and the last byte is an "untracked" flag that makes every partition run. A partition that runs clears its own flag and sets the flags of the partitions reading what it writes.
    • A process unit runs at its first projection, so that partition is recorded as writing all of the unit's outputs.
    • A whole-variable copy may become an alias of its source, so readers of the copy also read the source.
  • Writers outside the settle mark the flags.
    • Generated stores and commits to state the settle reads or writes (celox::settle::instrument), including processes the scheduler and derived-edge units generate.
    • Host writes, VCD signal writes and initial memory writes (SettleLayout::mark_range).
    • A retained raw view of the state sets the untracked flag.
    • A state load writes every object, so it marks everything.
  • Excluded from comparisons. The flags are left out of state files, the differential scheduler check and the derived-edge unit check.
  • Debug cross-check. SimulatorBuilder::settle_check makes the native and Cranelift backends run every settle a second time with every partition flagged, and panic at the first state byte that differs. Effects of partitions that run in both passes, such as runtime events, then happen twice.
  • Breaking (!), like earlier container bumps: RuntimeSchema gains settle_partitions, MemoryLayout gains settle, and SirPass gains PartitionedSettle. Native images use container format 39, so images from earlier versions must be rebuilt.

Validation

  • Workspace with CI features, default (partitioning off): 17,476/17,476 (rebased on perf(sv): run a combinational process unit once per schedule #2082) pass. Clippy is clean.
  • Whole celox + celox-test-suite with partitioning forced on (Always, one partition per scheduled work) and the cross-check on: everything passes except the expected SIR/MIR snapshot changes and native raw-buffer harness tests. One test fails because a $display in an always_comb is reported twice under the check (documented above).
  • tests/settle_partitions.rs compares partitioned against single-pass settles on native, Cranelift, wasm and the interpreter, with host writes, state loads, a latch-gated clock (BUFGCE), a process writing two outputs with an intermediate write, and a copy of a process output read by another process. The tests fail if the outside marks or the host-write marks are removed.
  • b2_vm_dispatch_bit callgrind (--backend native, release), base vs branch: 4,212,004,002 / 4,185,203,922 Ir, same output. The JIT code is identical (2,777,200,097 Ir in both). The difference is in the runtime: moving the timing and cross-check path out of line lets NativeBackend::call_func_timed inline into its callers.

@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-26T05:41:50.874316Z 7e7b80e 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 feature/perf/2013-partitioned-settle branch from 33feb4b to 11a2d65 Compare October 26, 2026 05:12
@tignear tignear changed the title feat(runtime): opt-in partitioned combinational settle feat(runtime)!: opt-in partitioned combinational settle Oct 26, 2026
Cut the combinational settle into contiguous ranges of its schedule, each
guarded by a dirty flag in a hidden `$settle.flags` object. A partition that
runs clears its flag and sets the flags of the partitions reading what it
wrote; every other writer of state the settle reads or writes sets them
too: generated stores and commits, host and VCD writes, initial values,
state loads, and a retained raw view (the untracked flag, after which every
partition runs).

Off unless `SirPass::PartitionedSettle` is enabled or
`SimulatorBuilder::settle_partition` is called (#2013). The flags stay out
of state files and of the differential and derived-edge checks.
`SimulatorBuilder::settle_check` runs every settle a second time with every
partition flagged and panics where the two differ.

BREAKING CHANGE: RuntimeSchema has a new field, `settle_partitions`, and
MemoryLayout a new field, `settle`; SirPass has a new variant,
PartitionedSettle. Native images use container format 39; images written
by earlier versions must be rebuilt.

Change-Id: I6d2c7e90376cf6fd96173e2cd4959f79171834fc
@tignear
tignear force-pushed the feature/perf/2013-partitioned-settle branch from 11a2d65 to 7e7b80e Compare October 26, 2026 05:38
@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 47 minutes 15 seconds in the queue, including 33 minutes 19 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 ee1be9c into master Oct 26, 2026
23 checks passed
@mergify
mergify Bot deleted the feature/perf/2013-partitioned-settle branch October 26, 2026 06:58
@mergify mergify Bot removed the queued Mergify queue entry label Oct 26, 2026
@mergify mergify Bot mentioned this pull request Oct 26, 2026
43 of 73 tasks
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