Repository navigation
perf(sv): instrument each unit once for all probes - #2000
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. |
Merge Queue Status
This pull request spent 9 minutes 30 seconds in the queue, with no time running CI. ReasonPull request #2000 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. Requeued — the merge queue status continues in this comment ↓. |
Closes #1991 Change-Id: Ied3fc477003f360c2ea17b71e19b6fd1a4559abb
295fd8a to
f8985cf
Compare
Merge Queue Status
This pull request spent 1 hour 45 minutes 39 seconds in the queue, including 1 hour 6 minutes 39 seconds running CI. Required conditions to merge
|
Closes #1991.
Summary
The probe instrumentation in
assembly.rscalledinstrument_unitonce per probe over every process kernel and every flip-flop unit. Each call rescanned the unit's instructions and its wholeregister_mapto find the next free register. That is O(probes × program size), and it is most of the C906 frontend time now. The counted-signal loop for flip-flop evaluations that may store a signal twice had the same shape (one pass per signal).The new
watch::instrument_writes_in_passesproduces exactly what oneinstrument_writescall per pass would produce, in a single walk over the unit:watch_for(instruction, after)names the first pass fromafteron that watches the write. The code a pass adds is examined again by the later passes only, so a write watched by several passes is nested the same way, and a counter store matching a later pass is also handled.next_registeris computed once per unit. The new registers are then renumbered in the order the passes one after another would allocate them (pass, then block in map order, then position), so the instrumented units are identical, register ids included.In
assembly.rs, each probepis pass2pover the stable state and pass2p + 1over a flip-flop evaluation's working state. That matches the old loop's order, where all stable instrumentation for a probe ran before its working-state instrumentation. The probes are looked up by written address, using a binary search over each signal's probe indices. The counted-signal loop now runs one pass per signal in signal order. Theinstrument_storeshelper is no longer used and is removed.Tests
instrumenting_in_passes_matches_one_pass_after_another: on 3000 generated units, it compares the result against the per-passinstrument_writesloop withassert_eq!on the wholeExecutionUnit(blocks, instructions, register map). The units have several blocks, stores at different offsets, commits, and bit and logic values. Passes can be store-only or any-write, and their counters may be written by other passes. A mutation that renumbers by block before pass makes the test fail.systemverilogfeature (see below).Per the decision for complexity-order fixes, no timing comparison was run.
Local run (
--features systemverilog):systemverilog4974 passed, pluscelox-frontend-core,celox-frontend-sv,frontend_sdk,processes,edge_api,ff_event_snapshot,sv_update_events,sv_untimed_processesandsv_scheduled_startup, all passed.