Repository navigation
feat(runtime): run slots of designs with derived clocks in the compiled scheduler - #1967
Merged
Merged
Conversation
…ed scheduler
The compiled scheduler rejected every design with gated, inverted or
divided clocks ("the design has derived clocks", "RTL logic drives an
event signal"), so those designs ran every slot in the reference loop.
It now tracks the clocks derived, transitively, from the events its
slots change, and runs a slot's domains in the reference loop's waves:
after the process phase, combinational logic settles; the domains of the
events with an active edge evaluate together with those of the clocks
gated by a changed source whose levels moved to their active edge,
judged then, whose levels become their baselines; a slot without an
active edge runs every tracked event whose level moved to its active
edge. After each wave commits and logic settles, the domains not run yet
whose clocks moved to their active edge run in another, until none
does. Baselines are the levels of the tracked events at the slot's
start, in the levels slot, which now covers the derived clocks too, so
a run that returns in the middle of a slot leaves their levels as the
reference does.
RTL logic may drive exactly those derived clocks. A design with derived
clocks keeps the reference loop when a waiting kernel stages
nonblocking assignments, a tracked domain commits in the active region,
or a tracked domain may end the run; and when the host observes a
derived clock, which changes in the slots of its sources.
Change-Id: Ibb48c1e36a21599607c012f0e6748de35e2616ae
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Two cases where the waves of a slot with derived clocks differed from the reference loop's: - A host clock input with no clock armed kept its slot-start level out of the levels slot, which only the clock-apply block filled. The waves compared against zero, so a gate on a clock input the host had set high fired its source's domain at every slot. The levels of every tracked event are now recorded at the slot's start. - A waiting kernel woken by a clock's change runs in a pass after the settle that judges the clocks gated by it; what it writes moves those clocks only for the waves after the commit. The waves judge once, after every pass, so a design with gated clocks whose waiting kernels write what combinational logic reads keeps the reference loop. Change-Id: I42793209eeebcfeffaf0fbc08b91fc586edc58f0
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Contributor
Merge Queue Status
This pull request spent 39 minutes 44 seconds in the queue, including 39 minutes 10 seconds running CI. Required conditions to merge
|
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1123, step 3b-2: #1786 PR D (derived clock domains in the compiled scheduler), after #1844 and #1888; C (batched
clk.next(n)on derived events) follows.The compiled scheduler rejected every design with gated, inverted or divided clocks ("the design has derived clocks", "RTL logic drives an event signal"), so those designs ran every slot in the reference loop. They now run in compiled slots: a divided clock costs ~110 Ir per cycle over the plain design instead of ~12,000.
What changes
EventTopology::derived_eventsandcombinational_derived).SchedulerSlots::levelsholds the level of every tracked event at the slot's start, soSchedulerSchema::eventsnow lists the derived clocks too; a run that returns in the middle of a slot leaves their levels as the reference does.continue_round/batch_round), in a newPlan::batch:judge_derived_edges);replace_triggers_with_stable_edges);exit_arg.$finish, an error).set_observed_signals), no slot runs compiled.Not covered yet: a gated clock whose gate folds to a constant (
logic en = 1; assign gclk = clk & en;— the topology does not list it as derived, so the old rule rejects it), four-state designs, and kernels that wait on a derived clock.Validation
derived_clocks_run_in_compiled_slots(a kernel's clock gated by a kernel's enable, gated by an enable its domain raises, inverted,clk ^ togmoved back by the commit, divided, a divided clock gated by an enable changing with the edge, divided twice) andderived_host_clocks_run_in_compiled_slots(a host clock gated by a kernel's enable, divided, gated by a host input; with and without kernels).cargo test -p celox --features systemverilog --test systemverilog --test sv_update_events --test derived_register_clock --test cascade_race --test ff_comb_clockin the compiled, differential and differential-runs scheduler modes: 4,808 + 36 passed each after rebasing on master (4,711 + 36 + 24 + 2 + 1 with derived_register_clock, cascade_race and ff_comb_clock before);--lib222; the timed-runtime integration tests (tick_semantics, clock_alias_edges, checkpoint, state_file, vcd, sv_vcd, simulation_step/stop/limits, processes, tiered, …): all passed. Compiled-scheduler coverage of the SV suite: 152/363 kernels.-D warnings(celox, celox-runtime, celox-napi; tests, examples), the default-feature lib test build without warnings,cargo fmt --check: clean. wasm32 NAPI build: builds.Perf
examples/sched_bench, callgrind, Ir per cycle = (Ir at 200,000 cycles − Ir at 20,000) / 180,000, median of 3, release, native backend; the derived variants are local, not committed (64 registers on the derived clock):b1(plain)ac(plain, host clock)b1d: b1, registers ondiv(always_ff @(posedge clk) div <= ~div)acd: ac, registers ondivb1g: b1, registers onclk & en(enraised by the clock's domain)Review fixes
derived_clocks_of_an_unclocked_host_input_keep_its_level).gates_written_by_waiting_kernels_keep_the_reference_loop). Judging gated clocks per pass would lift this; v1 rejects structurally (any comb input, a superset of the gates' cones).