Repository navigation
Conversation
…E, default off)
The L0's next-line prefetch comes back too late when its line misses the
icache, so straight-line code larger than the icache waits on memory.
With the knob on (it needs VX_CFG_ICACHE_L0_ENABLE), a slice also asks
the icache for the line 4 past the one a fetch or a run enters, at the
lowest priority on its request buffer, and drops the response. It runs
only while recent prefetch responses came back late (two or more 16-cycle
ticks, carried in the request tag); a line already wanted or one of the
last two sent is not asked again.
SimX models the same in fetch_l0(); a stream request in flight is counted
in pending_ifetches_, so the core does not go quiescent before its
response returns (dogfood had hung at test 20 without it). With the knob
off the RTL is the L0's (Beacon: identical depth and LUTs, L0 on and off).
model_parity: parity-l0-stream-{jacobi,dogfood,fw2}.
… hash The new knob changes the resolved config, so every perf_gate case's config_hash moves. Cycles and instruction counts are unchanged in all 51 cases (the knob is off by default). Command: pytest ../ci -m perf_gate --update-baselines (from a configured XLEN 32 build tree). Re-recorded by: agent, authorized by jel221 2026-12-03
jel221
marked this pull request as ready for review
December 3, 2026 21:58
This branch has not been deployed
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.
Human comment: The L0 prefetches into the icache. So this isn't an icache prefetch at the icache controller, but more like the L0 requesting an icache line early and ignoring it. This closes the most of the last bit of the fetch bottleneck.
Stacked on #581. The base is
perf/fetch-l0-cache, so the diff shows only this change: the stream prefetch and its baseline re-record.Summary
An icache-only stream prefetch driven by the fetch L0, behind
VX_CFG_ICACHE_STREAM_ENABLE(default off; it needsVX_CFG_ICACHE_L0_ENABLE).The L0 prefetches the next line into itself. When that line misses the icache, the prefetch returns too late and the warp waits on memory. That is the common case for long, unrolled code larger than the icache, which is what kernels with many registers per thread look like.
With the knob on, a slice also asks the icache for the line 4 past the one a fetch or a run enters, and drops the response; the icache keeps the line.
fetch_l0(). A stream request in flight counts inpending_ifetches_, so the core does not go quiescent before its response returns. Without that, SimX dogfood hung at test 20 with a 4 KB icache.Gain on master is about neutral. SimX, which tracks rtlsim within 0.1–2% on these cases, over 9 kernels larger than a shrunken icache (dogfood, flash_attn, jacobi, lazy_fetch, ldst_matrix, printf, raycast, sgemm_v1, softmax). Stream on vs the L0 alone:
Master has no kernels of the kind this is for. On the 256-register branch (
feature/256-registers, unrolled kernels at 2 warps × 256 registers), the stream moved the frontend's gain from −4.0% to −10.9% cycles geomean, and a 64-key sort by −26%. Those kernels come with the register-window PRs.Impact and evidence
Impact class: R3 (
pipeline-stage,gpu-pkg-types,config-knobs).Contracts touched:
ICACHE_FETCH_PF_BITSis 6 with the stream on (prefetch bit, stream bit, 4-bit tick), 1 with the L0 alone, and 0 without the L0; the width flows throughICACHE_TAG_WIDTH.VX_config.toml. AddsVX_CFG_ICACHE_STREAM_ENABLE. Both models assert that the L0 is on when the stream is enabled.make -C tests/regression run-simxandrun-rtlsimwith-DVX_CFG_ICACHE_L0_ENABLE -DVX_CFG_ICACHE_STREAM_ENABLE: all pass. The 40-run SimX screen above (2 and 4 warps, 2 and 4 KB icache) also passes, dogfood 25/25 in each. xrt not run: no FPGA flow for this preliminary change.model_parityparity-l0-stream-jacobi2.05%,parity-l0-stream-dogfood0.89%,parity-l0-stream-fw20.10%, all at a 4 KB icache; instruction counts equal in all three. The L0's five cases (stream off) pass with cycles identical to #581 on both SimX and rtlsim.perf_gatepytest ../ci -m perf_gate --update-baselines: onlyconfig_hashchanges; cycles and instruction counts are identical in all 51.logic_gateperf/fetch-l0-cache: knob off,coreandtop_vortexPASS with identical depth and LUTs; L0 on and stream off,top_vortexidentical (15 → 15 levels, 135,041 → 135,041 LUTs). Knob on: item 4 below.fpga_gate/asic_gate)Self-check: precheck: 7 pass, 0 with findings, 0 fail, 0 not run (against
perf/fetch-l0-cache)Departures from SHOULD rules: none
Design note:
docs/proposals/icache_stream_prefetch_design_note.mdV-ISO-6 justification
VX_fetch, knows which lines its warps are about to enter. No extension point sees it.top_vortex(two cores) against the L0 alone: deepest path 15 → 15 levels; LUTs +574 (+0.4%), FFs +312 (+0.2%), LUTRAM +11. Registers at 8 or more levels 434 → 438. The fetch stage's own deepest path moves 10 → 11 levels (thesched_line + 4adder ahead of the filter compares).perf_gate: all 51 cases identical in cycles and instructions.Review notes
An independent review found two must-fix issues. Both are fixed here:
Also from that review:
Not done:
sched_line + 4) in front of the filter compares. The fetch stage's deepest path moves 10 → 11 levels, under the threshold. A shadow register would remove it, but the depth does not justify one yet.Checklist
known_issue:, wider tolerance, smaller args, removed case) without a root-cause plan.