Repository navigation
perf(runtime): run designs with more than 64 events in the compiled scheduler - #2084
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
|
Queued — the merge queue status continues in this comment ↓. |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
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
75d0509 to
122c64c
Compare
✅ Merged into
|
|
@Mergifyio queue |
☑️ This pull request is already queued |
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.rs):Plan::event_bitsis the number of events rounded up to a multiple of 64, at least 64. Every event mask, thelevelsandexit_argstores and the per-event constants (single,all_but,ones, throughBigUint) 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 holdevent_bits. A new rejection covers more thanSCHEDULER_CLOCKShost-clock events.assembly.rs):declare_scheduler_slotssizeslevelsandexit_argfrom 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.rs):EdgePlan::entry_bits()uses the same scheme for fire masks, and the> 64 entriesrejection is gone.celox-runtime): the scheduler's per-kernel, per-clock, derived and observed event sets are anEventMaskof words instead ofu64. The compiledlevelsslot 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. ASchedulerMode::Differentialrun checks every compiled step against the reference loop.derived_edge::tests::an_edge_reaching_more_than_64_domains_runs_as_the_plan_walk: oneclkgating 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 celoxwith CI's features: 14744 passed.celox-runtimeandcelox-frontend-coretests pass, and clippy with CI's features is clean.Gate: b2_vm_dispatch_bit (64 events or fewer)
Release callgrind,
--backend native, collected instep_until, against masterda01037aae(measured before this rebase; the change is the same):The generated code is identical, and the total is 0.5% lower, from the runtime side.
Rebase onto master (2026-10-31)
unknown_levelsbesidelevels; bothslots now take the event-mask width, and the runtime reads both planes
by the slot width after a partial slot.
with_level,replace_level,load_levels,store_levels,no_levels) and the edge masks useevent_bits; the Veryl testbench unit, which judges no event masks, keepsthe slot's width.
the wide
!=lowering (cranelift: wrong edges in a compiled scheduler with more than 64 events (128-bit masks) #2102), so thewide_schedulerfallback is gone.more_than_64_events_run_on_every_backendchecks Cranelift runs compiledslots, and
an_edge_reaching_more_than_64_domains_runs_on_cranelift_as_the_plan_walkcompares the Cranelift edge units with the plan walk.
cargo nextest run -p celox -p celox-frontend-veryl -p celox-runtime -p celox-frontend-corewith CI's features: 18003 passed; clippy clean.Depends-On: #2730