Repository navigation
Conversation
…ault off)
A warp fetches again only after its instruction is decoded, so with few
warps per fetch slice each instruction pays the whole icache round trip.
The L0 keeps VX_CFG_ICACHE_L0_LINES (default 4) whole icache lines per
fetch slice, fully associative, round-robin:
- a hit reaches decode the next cycle through a two-entry registered
output buffer; a miss asks the icache for the whole line and keeps it;
- runs: the L0 delivers the warp's next instructions behind a delivered
one (up to 16, across into the next line when held), the warp locked
until the run's last is decoded; decode drops the instruction behind a
stalling one and its ibuffer slot is refunded (run_take/run_refund);
- one next-line prefetch per slice in flight; slices share one icache
port (round-robin) and the icache has one bank returning whole lines;
- the icache flush invalidates the L0; a prefetch in flight across it is
not installed.
SimX models the same structure in Core::fetch_l0(). With the knob off
every package width, tag and scheduler path reduces to master's (Beacon:
identical depth and LUTs on core and top_vortex).
rtlsim, 1 core, 4 threads: -23.6% cycles geomean at 4 warps and -33.6%
at 2 warps over sgemm, sgemv, softmax and vecadd. model_parity cases
parity-l0-{sgemm,sgemm-2w,vecadd-fw2,sgemm-fw4,vecadd-vm}.
The new knobs change 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
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: Adds the L0 instruction cache. This is the first of the series of frontend changes to support 256 registers per thread. The problem with the current Vortex frontend is that the latency of instruction fetch is extremely high, and you can't really hide it because you have lower occupancy with more registers.
This adds the L0, which caches responses from the Icache so that it avoids the full icache trip. More details in the AI-generated summary below.
Summary
A per-fetch-slice L0 instruction cache in front of the shared icache, behind a new knob
VX_CFG_ICACHE_L0_ENABLE(default off).A warp fetches its next instruction only after the previous one is decoded, so every instruction pays the whole icache round trip: request buffer, icache, response. With few warps per slice nothing hides that latency, and it, not the operands, bounds issue. Kernels that use many registers per thread leave few warps resident, so this is the first step toward 256 registers per thread.
With the knob on:
VX_CFG_ICACHE_L0_LINES(default 4) whole icache lines, fully associative and replaced round-robin. A hit reaches decode the next cycle. A miss asks the icache for the whole line and keeps it.run_take), and only from a slot that was free the cycle before.fetch_l0()incore.cppmodels the same structure: line store, output buffer, runs and their drop, prefetch, and the shared port with its per-slice two-entry request buffers.The L0 serves the fixed-length fetch path only. It is static-asserted against the C extension in both models.
Gain (rtlsim cycles, 1 core, 4 threads; instruction counts equal off and on):
Impact and evidence
Impact class: R3 (
pipeline-stage,rtl-interface,gpu-pkg-types,config-knobs).Contracts touched:
VX_decode_sched_if: gainscont(underVX_CFG_ICACHE_L0_ENABLE). Decode sets it for a run's instruction, and the scheduler advances that warp's PC by 4.VX_gpu_pkg::fetch_t: gainsrun_more/run_cont(under the same ifdef).VX_config.toml: addsVX_CFG_ICACHE_L0_ENABLEandVX_CFG_ICACHE_L0_LINES.VX_CFG_ICACHE_NUM_BANKSbecomes 1 when the L0 is on (unchanged otherwise).make -C tests/regression run-simxandrun-rtlsimwith-DVX_CFG_ICACHE_L0_ENABLE: all pass. Knob on, also passed on both models: vecadd at issue width 2 / fetch width 1 (frontend xbar), withVX_CFG_VM_ENABLE, withICACHE_DISABLE, and sgemm at 4 fetch slices. Knob off: the 51perf_gatecases pass. xrt not run: no FPGA flow for this preliminary change.model_parityparity-l0-sgemm0.02%,parity-l0-sgemm-2w0.02%,parity-l0-vecadd-fw20.00%,parity-l0-sgemm-fw41.18%,parity-l0-vecadd-vm1.43%; instruction counts equal in all five.perf_gatepytest ../ci -m perf_gate --update-baselines: onlyconfig_hashchanges (the new knobs change the resolved config); cycles and instruction counts are identical in all 51.logic_gatecoreandtop_vortexPASS, identical depth (15 → 15) and LUTs (127,132 → 127,132; 126,581 → 126,581). Knob on,top_vortex: see V-ISO-6 item 4 below. The STALE verdict a local run prints is the Beacon version (local 134d03b9e, baselines 4060e3af4), not this change: the config hash does not includeVX_config.toml.fpga_gate/asic_gate)Self-check: precheck: 7 pass, 0 with findings, 0 fail, 0 not run
Departures from SHOULD rules: none
Design note:
docs/proposals/fetch_l0_design_note.md; the user-facing description is the new "Fetch L0" section ofdocs/designs/mlp_optimizations.md.V-ISO-6 justification
top_vortex(two cores, Beacon against 923d4e2, the parent before the rebase onto current master):fetch) is +1,268 LUTs, +376 FFs and +410 LUTRAM. Most of the rest carries whole lines on the icache response path: the icache response queue and crossbar, the flush arbiter's buffer, and the iMMU's output pipes and skid buffers.warp_ctx/ibuf_size_r,ibuf_full_r), 5 → 9 levels, from the L0 output buffer throughrun_take. The L0's own deepest path is 10 levels; its two next-line tag compares take precomputed tag−1 and tag−2 copies instead of an adder.coreandtop_vortex: identical depth and area (evidence table).perf_gate: all 51 cases re-recorded with the knob off, cycles and instructions identical to master; only the config hash moves.Review notes
An independent review found no correctness bug. Its smaller findings are in this PR:
ifetches/fetch_stallscounters count what the RTL's count.Not done:
VX_fetch_l0module (and a SimX class). Worth doing once the register-file work settles its interface. Today the L0 shares the scheduler and decode handshakes with the rest ofVX_fetch.Checklist
known_issue:, wider tolerance, smaller args, removed case) without a root-cause plan.