Repository navigation
simx: launch checkpoints, per-launch PC profile, and idle units out of the tick scan - #565
Conversation
4bdefdb to
2dafca1
Compare
6e9368e to
47c244a
Compare
tinebp
left a comment
There was a problem hiding this comment.
Review of #565: simx launch checkpoints, per-launch PC profile, and idle units out of the tick scan
Head 47c244a, own commit 47c244a. The PR is stacked on an unpushed rebase of #560, so its GitHub diff also shows #560's commits and 2dafca1. Static review: nothing built or run. Rules: master 3fb83fd (incl. the review policy v5). Each recommendation carries a 1-5 rating (5 = must fix) beside the policy F0-F3.
Summary
- Tooling, all off by default: launch checkpoints (save and replay), a per-launch PC profile (
SIMX_PCPROF), and a better diagnostic for an undecoded custom-1 instruction. - Speed: an idle core takes a reduced tick, and an idle cache port arbiter, dispatcher and operand collector leave the tick scan.
The tooling is clean. The speed half is meant to change no simulated cycle, but the cache port arbiter's new early exit skips state updates the old sleep rule waited for, and the only evidence is isa-1 on simx. The pipeline-stage detector will flag core.cpp, scheduler.h and cta_dispatcher.h; these are SimX framework changes with no model change intended, so §13 applies only if cycles move.
R2 (R3 by the detector, see above). Verdict: land after the [4] change.
Recommended changes
[4] F2 medium reasoned-risk · sim/simx/mem/cache.cpp:2849-2859 — the port arbiter's early return skips update_realign() and the held_ update
What: The old sleep rule waited for two idle ticks: "the second idle tick settles the realign registers, so a skipped tick cannot change them". The new code returns as soon as ports_idle(), before update_realign() and before held_ is recomputed from the offers (~2805-2815). It does this on every idle-port tick, even while the tree is busy and the unit is not asleep. Two consequences:
- Realign registers: under line merging (
realigns()),realign_[i].head_valid,waitsandholdkeep the last busy cycle's values instead of settling to "no head", and the next request computesstart/owes_headfrom them. held_: it keeps its old value while the offers drain, and the cache's own tick reads it throughany_held().
Scenario: A merging data cache (merge_group_ == 2) whose ports go idle for one cycle between bursts. The next burst sees stale realign state and may merge or hold differently. Cycles move, which the PR says cannot happen.
Alternative: Keep one full idle tick before skipping, as the old rule did. Run update_realign() and the held_ update, then return when ports_idle(). Sleep only when tree_idle() && io_idle() and the realign registers have settled, which a realign_settled() check over realign_[i].head_valid/ahead expresses directly.
Why better: The speedup is the same; the skipped work in the idle state is a few comparisons. It also makes "cycle-identical" true by construction.
[3] F2 medium missing-test · PR evidence — no cycle comparison
What: "Cycles and instructions unchanged by construction" rests on regression isa-1 (simx) and the config_hash. perf_gate is rtlsim-only, so it cannot see a SimX change.
Alternative: Compare cycles on simx, master versus this PR: the model_parity cases' SimX legs (core, cache, amo, bar-vis, fence-mp) plus sgemm and raycast, requiring exact equality. Re-run it after the [4] change.
Why better: That is the only check that proves a framework-only change is framework-only. It costs minutes on simx.
[2] F1 medium reasoned-risk · sim/simx/core.cpp:1476-1480 — a change to the barrier-drain model inside a tooling commit
What: mem_req_drained() stops waiting on a single-channel lane adapter's ReqIn. If a request can sit in that port for a cycle, this moves when a barrier releases. That is model timing (#560's F1), not tick skipping.
Alternative: Move this hunk into #560's barrier-drain commit, which defines mem_req_drained() and owns its parity case (model_parity-bar-vis). Keep this PR behaviour-neutral.
Why better: Each model change sits with its parity evidence, and the "cycle-identical" claim of this PR holds.
Checked, no finding
- Core
quiescent(): it covers pending instructions and fetches, a full ibuffer, the scheduler and CTA-dispatcher settle state (rasterfwd_armed_included), the branch, warp-control and barrier inputs, dispatch credits and ibuffer in-flight counts.idle_tick()advances the same counters the full tick would. The skip is disabled withEXT_C; C is off by default. - Layering:
sw/runtime/simx/vortex.cppincludinglaunch_ckpt.hfollows that driver's existingprocessor.hinclude. It is the simx driver, notsw/runtime/include. - Merge note: the PR's merge note (
!frag_release_reg_.validinScheduler::settled()when feat/vulkan-graphics lands) is the right resolution.
Not reviewed
launch_ckpt.h and pc_prof.h internals (diagnostic file formats), and the dispatcher and operand-collector sleep hunks beyond their wake conditions.
2dafca1 to
96ded66
Compare
…f the tick scan Tooling (diagnostics only, off by default): - Launch checkpoints: the runtime saves a launch's device memory and DCR state, and simx replays it (launch_ckpt.h; RAM::for_each_page). - SIMX_PCPROF=<dir>: per-launch PC profile (committed instructions, threads, warp residence per PC, with each PC's instruction word), one table per core merged in host context. - A custom-1 instruction a build leaves out names its unit when it is not decoded. Speed (no change in simulated behaviour; cycles and instructions identical): - An idle core's tick does only what shows (quiescent/idle_tick). - An idle cache port arbiter, dispatcher and operand collector drop out of the tick scan; a pass-through lane adapter holds no requests of its own. What survives of these after master's SimObject rewrite (its own sleep for the port arbiter is replaced by this one). Based on fix/master-bugfixes: the core's idle check reads F1's mem_req_drained. The scheduler's settled() checks master's raster state (fwd_armed_). feat/vulkan-graphics adds the fragment-release register (frag_release_reg_): when both land, the expected resolution is one hunk in Scheduler::settled(), adding "&& !frag_release_reg_.valid" under VX_CFG_EXT_RASTER_ENABLE. Branch commits: 538d08242, 680a990ec, aee5e6a85, aec915e07, 9b05f0fb5, 34bd23f40, a5ecfc9d1, d34cb850b, 43f7b0d53, 8ef41670f. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47c244a to
d7de862
Compare
…E_ENABLE at FLEN 64) (#568) VX_CFG_EXT_LDST_WIDE_ENABLE required FLEN 32, where vx_flw.d/.q are macro-ops of 2 or 4 flw uops. With 64-bit FP registers a vx_flw.d/.q is now one LSU instruction, as NVIDIA's LDS.128 and AMD's DS_READ_B128 are: each lane reads its 8 or 16 bytes in one memory access and one writeback writes the 2 or 4 registers, each word NaN-boxed in its own register. The address must be naturally aligned (8 / 16 B). vx_fsw.d/.q stay fsw uops. - RTL: decode carries the group size; the scoreboard reserves the aligned group; LSU lanes are 16 B with one addressed word in the low half; the LMEM engine reads whole lanes for a quad; VX_lsu_dcache_narrow (new) sends a quad to the D-cache in two half-lane passes; result/commit/writeback carry the upper 64 bits. - SimX: the same model (IntrLsuArgs::wide, group scoreboard, one writeback, local memory serving a quad lane's two banks in one pass, two half-lane coalescer passes). - Everything is under the derived LSU_WIDE_ENABLE (the extension on at FLEN 64); every other configuration elaborates master's logic. - Profiles: on in the NVIDIA and AMD root profiles (derived ones inherit); tinygpu unchanged. a100, one core, SimX: sgemm -n64 -18.4%, sgemm2 -n64 -t4 -24.0% cycles. - Tests: tests/ldst_wide covers FLEN 64 (NaN-boxing, junk upper halves, end of the read-only words); parity-ldst-wide-x64 is a 64-bit model_parity case (testcase.py lets a model_parity case name its own xlen). Rebased onto master after #565, #566 and #569: the LSU alignment assertion keeps #569's fault exemption on both the wide and the normal path. On the final tree: parity-ldst-wide-x64 instructions equal, cycle gap 0.01%. CI goldens, re-recorded on this tree with toolchain v3.0.4 (#566 moved some instruction counts and the Beacon version) by the gates' own update flags: - logic_gate U55C (16 entries) and beacon_asic (14 entries): no build deeper or slower than its previous golden; LUT flat except raster +1%. - perf_gate (51 x32 entries): geomean +0.52% cycles; dxa/wgmma up to +6.7% (accepted); core:sgemm2-wide +4.74% from #560's barrier/fence memory drain (a correctness fix; SimX moves the same way); everything else within +/-0.4%. - parity on the paths where the merged PRs meet (atomics, fences, ldst-wide, ldst-matrix, lmem, barriers, traps): 13 of 14 pass. isa:parity-amo-scatter is 5.52% (> 5%) on master since #569: the RTL uop sequencer spends a start cycle on every macro-op, which SimX does not model, and #569 made every atomic a macro-op. Fixed separately. fpga_gate, asic_gate and the gpu logic_gate entries were not re-recorded (skipped for time). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base: fix/master-bugfixes (#560). Head: 47c244a (1 commit).
Rebased 2026-12-01 onto fix/master-bugfixes 2dafca1 (master cba70a4). The tree equals the tested tree plus only master's pipeline-isolation rules commit and #560's comment-only commit, so every result below carries over.
Depends on: fix/master-bugfixes. The core's idle check reads F1's
mem_req_drained.Tooling (diagnostics only, off by default):
SIMX_PCPROF=<dir>: a per-launch PC profile.Speed (no change in simulated behaviour; cycles and instructions identical): an idle core's tick does only what shows. Idle cache port arbiters, dispatchers and operand collectors drop out of the tick scan.
Default behaviour: none simulated. SimX runs faster.
Verification
Results name the commit they ran on. The tested tree 4356c0003 differs from the final 6e9368e only by fix/master-bugfixes' own rebase onto master 7470f62 (tree delta byte-identical to 22198fdea → 4bdefdb, normalized-patch md5 68e275b1).
Baselines
None. The resolved config is fix/master-bugfixes', so its perf_gate records apply unchanged.
Merge notes
When this PR and feat/vulkan-graphics have both landed,
Scheduler::settled()needs&& !frag_release_reg_.validunderVX_CFG_EXT_RASTER_ENABLE. It is a one-hunk resolution.CI on this PR inherits master's red jobs from run 46477391253 until fix/master-bugfixes merges; rebase after it lands.
🤖 Generated with Claude Code