Skip to content

perf(runtime): run designs with more than 64 events in the compiled scheduler - #2084

Merged
mergify[bot] merged 2 commits into
masterfrom
feat/2012-multiword-event-masks
Oct 31, 2026
Merged

mergify[bot] merged 2 commits into
masterfrom
feat/2012-multiword-event-masks

Conversation

@tignear

@tignear tignear commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2012.

Summary

Event masks in the compiled scheduler and in the derived-edge units were single 64-bit words. A design with more than 64 events, such as rtlmeter C906, therefore fell back to the Rust round loop for every slot, and an edge reaching more than 64 derived domains got no generated unit. Masks now take as many 64-bit words as there are events. A design with at most 64 events keeps one word, with the same widths and constants as before. This builds on fix-1945-shared-temps' WIP for the scheduler and derived-edge masks.

  • Scheduler (scheduler.rs): Plan::event_bits is the number of events rounded up to a multiple of 64, at least 64. Every event mask, the levels and exit_arg stores and the per-event constants (single, all_but, ones, through BigUint) use that width. Kernel masks and host-clock masks keep their own widths. The old rejection of more than 64 events is replaced by a check that the frontend's slots hold event_bits. A new rejection covers more than SCHEDULER_CLOCKS host-clock events.
  • Slot sizing (assembly.rs): declare_scheduler_slots sizes levels and exit_arg from an upper bound on the events: the distinct trigger signals of each instance's flip-flop domains, rounded up to whole words. Designs with at most 64 keep the old layout. Should the estimate ever be too small, the design falls back to the Rust loop as before.
  • Derived-edge units (derived_edge.rs): EdgePlan::entry_bits() uses the same scheme for fire masks, and the > 64 entries rejection is gone.
  • Runtime (celox-runtime): the scheduler's per-kernel, per-clock, derived and observed event sets are an EventMask of words instead of u64. The compiled levels slot is read as a big integer when there are more than 64 events.

Tests

  • scheduler::tests::more_than_64_events_run_in_the_compiled_scheduler: 70 clocks toggled by 7 processes, each clocking a counter. The test checks that the compiled scheduler is generated with no kernel fallback and runs slots, and that every counter matches its expected edge count. A SchedulerMode::Differential run checks every compiled step against the reference loop.
  • derived_edge::tests::an_edge_reaching_more_than_64_domains_runs_as_the_plan_walk: one clk gating 70 clocks, on the native backend. The generated edge units are compared with the Rust plan walk on every named signal. It shares its source builder with fix(native): version reload snapshots per byte range instead of walking clobbers #2058's 60-clock test.
  • cargo nextest run -p celox with CI's features: 14744 passed. celox-runtime and celox-frontend-core tests pass, and clippy with CI's features is clean.

Gate: b2_vm_dispatch_bit (64 events or fewer)

Release callgrind, --backend native, collected in step_until, against master da01037aae (measured before this rebase; the change is the same):

Total Ir JIT functions (Ir)
master 4,212,404,001 2,761,200,000 / 12,400,027 / 3,600,000 / 70
this PR 4,191,404,216 2,761,200,000 / 12,400,027 / 3,600,000 / 70

The generated code is identical, and the total is 0.5% lower, from the runtime side.

Rebase onto master (2026-10-31)

  • Four-state scheduling (perf(scheduler): run four-state designs in the compiled scheduler #2621) added unknown_levels beside levels; both
    slots now take the event-mask width, and the runtime reads both planes
    by the slot width after a partial slot.
  • The level helpers of the generator (with_level, replace_level,
    load_levels, store_levels, no_levels) and the edge masks use
    event_bits; the Veryl testbench unit, which judges no event masks, keeps
    the slot's width.
  • Cranelift runs wide schedulers and wide derived-edge plans: fix(cranelift): give wide inequality 0 or 1 #2730 fixes
    the wide != lowering (cranelift: wrong edges in a compiled scheduler with more than 64 events (128-bit masks) #2102), so the wide_scheduler fallback is gone.
    more_than_64_events_run_on_every_backend checks Cranelift runs compiled
    slots, and an_edge_reaching_more_than_64_domains_runs_on_cranelift_as_the_plan_walk
    compares the Cranelift edge units with the plan walk.
  • cargo nextest run -p celox -p celox-frontend-veryl -p celox-runtime -p celox-frontend-core with CI's features: 18003 passed; clippy clean.

Depends-On: #2730

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 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-31T11:57:57.050776Z 122c64c 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.

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

@mergify

mergify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

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

@tignear tignear added merge-ready Request merging through Mergify after required checks and removed merge-ready Request merging through Mergify after required checks labels 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: c5fc0737b2

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

@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: 75d0509b09

ℹ️ 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 thread crates/celox/src/derived_edge.rs Resolved
Cranelift lowered `!=` of operands wider than 64 bits as the complement of
an 8-bit equality, which is 0xfe for equal operands. A store masks it to
its width, but a branch tests the whole value, so a branch on equal wide
operands took the unequal side. The 128-bit event masks of a compiled
scheduler with more than 64 events branched this way, running domains on
edges they do not have.

Each word now compares not-equal directly.

Closes #2102.

Change-Id: I369acc89b347a891eb05d638186bf4b69aa8594b
…cheduler

Closes #2012

Change-Id: If41fef72455c4980d78b874f765a257c3781d00b
@tignear
tignear force-pushed the feat/2012-multiword-event-masks branch from 75d0509 to 122c64c Compare October 31, 2026 11:55
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 31, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 31, 2026
@mergify

mergify Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into master as fc90582 at 12:46 UTC

19 min in the queue, 17 min of it CI.

So far

10 merge conditions met
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • check-success = Verify workflow lockfile
  • depends-on = celox-sim/celox#2730
  • any of · required by 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 · required by 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 · required by 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 · required by 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
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/Queue validation
    • check-neutral = @github-actions/Queue validation
    • check-skipped = @github-actions/Queue validation
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/Verify workflow lockfile
    • check-neutral = @github-actions/Verify workflow lockfile
    • check-skipped = @github-actions/Verify workflow lockfile

Times in UTC · dashboard · how the merge queue works

@tignear

tignear commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

queue

☑️ This pull request is already queued

@mergify
mergify Bot merged commit fc90582 into master Oct 31, 2026
30 checks passed
@mergify
mergify Bot deleted the feat/2012-multiword-event-masks branch October 31, 2026 12:46
@mergify mergify Bot removed the queued Mergify queue entry label Oct 31, 2026
@github-actions github-actions Bot mentioned this pull request Oct 31, 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.

perf(runtime): lift the 64-event limit of the compiled scheduler

1 participant