Skip to content

scoreboard: dispatch credits beyond the queue depth for the ALU and FPU (VX_CFG_DISPATCH_CREDITS) - #582

Open
jel221 wants to merge 2 commits into
masterfrom
perf/dispatch-credits
Open

jel221 wants to merge 2 commits into
masterfrom
perf/dispatch-credits

Conversation

@jel221

@jel221 jel221 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Human comment: This gives more dispatch credits than the number of dispatch queue depth for ALU and FPU. The credit doesn't come back through the ~6 cycle operand read, so it's actually a lot more pessimistic than it needs to be, which actually puts the bottleneck at issue. LSU and TCU keeps one credit per entry.


Summary

A new knob, VX_CFG_DISPATCH_CREDITS, sets the ALU's and FPU's scoreboard credits per issue slice above their dispatch queue depth. Default: the queue depth, which is the same hardware as master.

The scoreboard holds one credit per dispatch-queue entry. An op's credit comes back only when its unit takes the op from the queue, not when the op reaches the queue. So the ~6-cycle operand read between issue and the queue holds credits that no queue entry is using, and issue stops while the queue still has room.

With more credits than entries:

  • An ALU or FPU op issued beyond its queue's depth waits at the operand collector's output until the queue frees an entry. Later ops of that issue slice wait behind it.
  • The LSU, SFU and TCU keep one credit per entry.
  • SimX: update_queue_full() takes the same per-unit limit (dispatch_credits()).

Gain on master: small and kernel-dependent. This is preliminary work for 256 registers per thread. Its target is a frontend that no longer bounds issue (the fetch L0, #581) with the few warps that many registers leave. rtlsim cycles, 1 core, 4 threads, 8 credits, against the base (default credits). The isolated alternative, a dispatch queue of 8 (VX_CFG_DISPATCH_QUEUE_SIZE=8), is beside it for V-ISO-6:

config sgemm -n64 sgemmx -n64 sgemv 512² vecadd 16384 geomean
L0, 4 warps: credits 8 −1.3% −0.3% −0.2% 0.0% −0.46%
L0, 4 warps: queue 8 −3.2% −0.9% +0.6% 0.0% −0.91%
L0, 8 warps: credits 8 −0.5% −1.6% +1.4% −0.2% −0.23%
L0, 8 warps: queue 8 −3.1% +0.3% +0.1% +1.4% −0.34%
no L0, 8 warps: credits 8 −1.2% +8.4% +0.6% −0.3% +1.83%
no L0, 8 warps: queue 8 −4.2% +7.3% −0.6% −0.8% +0.31%
no L0, 16 warps: credits 8 −0.3% −0.1% +0.9% +2.4% +0.71%
no L0, 16 warps: queue 8 −2.3% +13.8% −0.2% −0.3% +2.54%

At 2 and 4 warps without the L0, both are within ±0.6%: fetch bounds issue there.

Where it loses: sgemmx at 8 warps without the L0 loses with either form of extra room (+8.4% credits, +7.3% queue). SimX counters for the credits run, base → 8 credits:

  • scoreboard stalls 96% → 87%;
  • ibuffer-full stalls 16% → 26%;
  • the warps' idle time 64% → 69%.

The kernel is 39% loads and 49% FPU, and bound by load latency. FPU ops issued into the extra room delay the loads behind them in the same issue stream. With the L0 on, the same kernel at 8 warps gains 1.6% with credits. So the knob stays at the queue depth by default, for the register-file work to turn on where it pays.

Impact and evidence

Impact class: R3 (pipeline-stage, gpu-pkg-types, config-knobs).

Contracts touched:

  • VX_config.toml. Adds VX_CFG_DISPATCH_CREDITS (default $VX_CFG_DISPATCH_QUEUE_SIZE).
  • VX_gpu_pkg. Adds DISPATCH_CREDIT_UNITS and DISPATCH_CREDITS, with PACKAGE_ASSERT(DISPATCH_CREDITS >= 2). SimX has the matching static_assert.
evidence status detail
functional tests (simx / rtlsim / xrt) simx, rtlsim run; xrt not run make -C tests/regression run-simx and run-rtlsim with -DVX_CFG_DISPATCH_CREDITS=8: all pass. xrt not run: no FPGA flow for this preliminary change.
model_parity run parity-dispatch-credits-sgemm 1.26%, -sgemmx 0.29%, -q2-lanes 0.98%, -iw2 0.89%; instruction counts equal in all four.
perf_gate run All 51 cases pass (XLEN 32, toolchain v3.0.4). The second commit re-records the baselines with pytest ../ci -m perf_gate --update-baselines: only config_hash changes; cycles and instruction counts are identical in all 51.
Beacon logic_gate run Default, against master (c6deb1c): core, core_ldst, tensor and top_vortex PASS with identical depth and LUTs (e.g. core 15 → 15 levels, 127,132 → 127,132 LUTs). 8 credits, core against 923d4e2 (the parent before the rebase): 15 → 15 levels, +7 LUTs; Beacon ASIC core: +2 cells, +2 FFs. The deeper queue's numbers are in V-ISO-6 item 3.
synthesis (fpga_gate / asic_gate) not run Default is the same netlist by Beacon.
XLEN 64 build not run Author policy: XLEN 32 only.

Self-check: precheck: 7 pass, 0 with findings, 0 fail, 0 not run

Departures from SHOULD rules: none

Design note: docs/proposals/dispatch_credits_design_note.md

V-ISO-6 justification

  1. Goal. Let issue run while the ALU and FPU queues have room, with their operands still in flight. The limit is the scoreboard's credit count, in issue, a shared stage; no extension point reaches it.
  2. The isolated alternative. A deeper dispatch queue, built and measured (table above): VX_CFG_DISPATCH_QUEUE_SIZE=8.
  3. The gain against it. On cycles the deeper queue wins or ties in most rows (table above). The credits' case is area:
    • On the FPGA the queues sit in LUTRAM, so the deeper queue is almost free there. Beacon core: +36 LUTs and +18 FFs for the queue, against +7 LUTs for the credits.
    • On an ASIC the queue stores four more full dispatch packets per unit. Beacon ASIC core: +13,810 FFs (+14.7%) and +13,922 cells for the queue, against +2 FFs and +2 cells for the credits.
    • The maintainer is asked to weigh this item with the ASIC cost and the preliminary state.
  4. The cost to every configuration. Default: none (item 5).
  5. Knob-off identity. Beacon: identical depth and LUTs on core, core_ldst, tensor and top_vortex (evidence table). perf_gate: all 51 cases identical in cycles and instructions.
  6. Approval. Pending the maintainer.

Review notes

An independent review found no correctness bug. Its notes:

  • The forward-progress argument is in the scoreboard comment and the design note. A held op releases when its unit dequeues. Neither unit waits on another unit's inputs, and at commit the ALU yields only to the FPU, whose results its tags bound.
  • Stress: parity-dispatch-credits-q2-lanes (a two-entry queue with half-width ALU and FPU lanes, so the longest wait) and parity-dispatch-credits-iw2 (issue width 2).

Pre-existing on master, out of scope: the scoreboard spends a credit per issued instruction (fu_issue), and the dispatcher returns one per packet it hands to the unit (fu_release). With SIMD_WIDTH < NUM_THREADS an instruction is several packets, so the two counts differ. This change does not touch that accounting.

Checklist

  • No test silenced (known_issue:, wider tolerance, smaller args, removed case) without a root-cause plan.
  • Golden data changed only through its update command; the commit names the command and who ran it (X-EV-1).
  • Cycle-moving RTL changes carry the matching SimX change, or the parity case that shows none moved.
  • A toolchain pin moves only after the prebuilt tag exists.

…PU (VX_CFG_DISPATCH_CREDITS)

The scoreboard holds one credit per dispatch-queue entry, and an op's
credit comes back only when the unit takes it from the queue, not through
the operand read in between. With one credit per entry, issue stops while
the queue still has room for ops that are only being read.

VX_CFG_DISPATCH_CREDITS sets the credits of the ALU and the FPU per issue
slice; the other units keep one per entry. An op issued beyond the queue
depth waits at the operand collector's output until its queue frees an
entry. Default: the queue depth, the same hardware as before (Beacon:
identical depth and LUTs on core, core_ldst, tensor and top_vortex).

SimX: update_queue_full() takes the same limit (dispatch_credits()).
model_parity: parity-dispatch-credits-{sgemm,sgemmx,q2-lanes,iw2}.
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 default is the queue depth).

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
jel221 marked this pull request as ready for review December 3, 2026 21:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant