Repository navigation
feat(runtime)!: fuse clock-waiting kernels into compiled slots - #1801
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.
Reviewed commit: 523350117c
ℹ️ 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".
c867378 to
97108e9
Compare
|
Queued — the merge queue status continues in this comment ↓. |
97108e9 to
fe58ec1
Compare
Merge Queue Status
This pull request spent 29 minutes 18 seconds in the queue, with no time running CI. ReasonPull request #1801 has been dequeued Queue conditions are not satisfied:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for
All conditions
Requeued — the merge queue status continues in this comment ↓. |
|
@Mergifyio dequeue |
fe58ec1 to
5a60bf3
Compare
The compiled scheduler now also runs kernels whose every wait is the same single edge of a one-bit signal that one compiled delay-only kernel alone drives, whose statuses are Wait, Nba, Done or Finish, and whose nonblocking sites stage their values into targets nothing else writes. Such a kernel wakes at most once a slot, so a site is never staged again before the NBA region. A slot runs the ready kernels lowest first, tests the waits after each run while kernels remain ready or the kernel resumes at once, and again after each pass's settle, as the reference's process phase does; a wait compares against a baseline that follows every tested change. The ready set is a mask over the compiled kernels in kernel order. Staged values publish after the domains, or with a settle of their own without one. Waiting kernels move between Waiters and the scheduler's slots at each run, and a run that ends in the middle of a slot hands back the ready set and the baselines as the reference leaves them. Kernels that drive or wait for a clock whose domain commits blocking results in the active region keep the reference loop. A staged site's target must also lie outside every occurrence probe: the reference publishes nonblocking updates through the runtime, which bumps the probes' counters, and the scheduler's publication does not. BREAKING CHANGE: SchedulerSlots has new fields, `ready` and `baseline`. Native images use container format 30; images written by earlier versions must be rebuilt. Change-Id: Ib033a13b9ad213155c0ffca86c4e891fe61876b2
5a60bf3 to
8931be8
Compare
A delay-only kernel that pulses the signal another kernel waits on within one activation, by two stores or in a loop, makes the frontend count the signal's occurrences, and the compiled scheduler leaves a design that counts occurrences to the reference loop. The test checks that every mode wakes on each pulse as the reference does, the guard for when counted designs become compilable. Change-Id: I479dec1591e33514389937797b7283eb3baefba2
Merge Queue Status
This pull request spent 50 minutes 15 seconds in the queue, including 47 minutes 53 seconds running CI. Required conditions to merge
|
Part of #1123, step 3b-1 (compiled scheduler), PR 4 of 7. Builds on #1777 (merged); rebased onto master with #1764.
The compiled scheduler now also runs kernels that wait for one clock edge, such as
initial forever @(posedge clk) stim = stim + 3;orstim <= stim + 3;, together with the delay-only kernels that drive the clock. The testbench shape of the scheduler bench, (b1) and (b5), drops from about 10,200 to about 1,260 Ir per cycle.A slot that touches a kernel the scheduler does not run still runs entirely in the Rust reference loop, as in #1777; the fallback is per kernel and per slot.
BREAKING CHANGE
celox_design::SchedulerSlots(public) has new fields,readyandbaseline.Stacked on #1777: review the last commit (
feat(runtime)!: fuse clock-waiting kernels into compiled slots).Which kernels
A kernel that waits compiles when:
Nbain a compiled slot (anNbastatus there is an internal exit). A loop that does not suspend yields every 2^16 iterations, andYieldkeeps the kernel in the reference loop;Wait,Nba,DoneorFinish(no delay, no host request, no$stop, no yield, noPending);select_nba_paths), with a static target range that nothing else writes, no other site targets, and nothing watches; the target also lies outside every occurrence probe (fix(sim)!: wake processes on value changes that are undone in the same time slot #1764): the reference publishes nonblocking updates through the runtime, which bumps the probes' counters, and the scheduler's publication does not;What a compiled slot does now
The reference's process phase (
process_phase/run_ready/settle_pass) with waiting kernels:BTreeSet::pop_first), and after a run, while kernels remain ready or the kernel resumes at once (anNbareturn), the waits are tested (observe_driven); a kernel woken in the middle of a pass joins it;check_waits/advance); a kernel that waits again takes the current level (register_waiter);publish_nba) right aftereval_apply, or after the applies with several domains, then the settle; without a domain, staged values publish and combinational logic settles once more.The ready set is a mask over the compiled kernels, one bit per compiled kernel in kernel order (so a design may have any number of other processes), and every kernel copy, comb and the domain units are inlined once, as before. Waiting kernels move between the runtime's
Waiterentries and the scheduler's waiting/baseline slots at every run; a run that ends in the middle of a slot hands back the ready mask (ready kernels stay ready) and the baselines as the reference leaves them.Coverage and fallback stats
compiled_scheduler_coverage(test output): 129 of 296 kernels of the timed SV suite cases compile, against 126 with #1777. The kernels that wait still mostly fall back, for reasons the next steps address:@*: 3b-2)In the differential SV suite 190 case-backend runs execute compiled slots. The bench's (b1) and (b5), the testbench shape this PR targets, now run every slot compiled (
compiled slots 4000, kernels [Compiled, Compiled]at 2,000 cycles).Perf
Callgrind, whole program, Ir per cycle = (Ir at 200,000 cycles − Ir at 20,000) / 180,000, median of 5. Base: #1777's head (3885415, on master 3766461); both built with the same
sched_bench.rs.Simulator::tickSimulation+add_clockalways #5 clk = ~clk+forever @(posedge clk) stim = stim + 3+ RTLstim <= stim + 3always #5 clk = ~clk+ RTLValidation
cargo test -p celox --features systemverilog --test systemverilog(all groups, native/cranelift/parallel/wasm): 4,222 passed, 20 ignored in each ofCELOX_SCHEDULER=differential,differential-runsand the default (compiled).--lib: 194 passed, with new tests: clock kernels feeding the domain of their edge, blocking and nonblocking; kernels woken in the middle of a pass, declared before and after the clock kernels; falling and any-change waits; a clock kernel's$finish; compiled kernels declared after 66 other processes. Each runs in the compiled, differential and differential-runs modes and compares the state file with the reference's. Tests check that a waiting kernel whose loop yields falls back, and that a nonblocking site in a loop (kept,i < n, or unrolled,i < 2, with and without a$finishafter it) keeps the kernel in the reference loop with the reference's state file in every mode.celox-runtime,celox-design,celox-frontend-core,celox-sir,celox-heap,shared_jit_cache(image format 30): all passed.napi build --platform --target wasm32-wasip1-threads(WASI SDK 25): builds.-D warnings(tests, examples) andcargo fmt --check: clean.