Skip to content

FPU: carry the header through the pipeline, round-robin commit - #588

Open
jel221 wants to merge 3 commits into
feature/fdiv-tfufrom
feature/fpu-tag-pipeline
Open

jel221 wants to merge 3 commits into
feature/fdiv-tfufrom
feature/fpu-tag-pipeline

Conversation

@jel221

@jel221 jel221 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Human comment: Just to repeat my last PR, copy pasted here. The next reason is that it removes the tag and the 2 ops in flight limitation from the FPU. So you can remove this by carrying the tag like any other unit like ALU in the FPU pipeline registers. However, the 17 stages of FDIV and FSQRT makes the area blow up immensely if you do this. So, we make it a pipeline. Because of this, it actually gives you a speedup because FMA is fully pipelined and has better throughput.


Summary

Stacked on the FDIV/FSQRT-to-TFU PR (#587), which removes the FPU's 17- and 32-stage divide and square-root pipelines. With those gone, two changes become affordable.

1. The FPU carries the instruction header through its pipeline (VX_fpu_block). Before, the header waited in a tag store (VX_index_buffer, VX_CFG_FPU_QUEUE_SIZE = 2 × SIMD width / FPU lanes) while the operands were in the backend. That capped each FPU block at 2 operations in flight, even though the FMA pipeline is several stages deep. Now the header rides the backend's pipeline registers, like the ALU's does, so an FMA block keeps its whole pipeline busy. VX_CFG_FPU_QUEUE_SIZE is removed. SimX models the same.

This only works if every FPU backend is a fixed-length pipeline. With the iterative divide and sqrt in the FPU, the header would need 17 or 32 extra pipeline stages, which costs much of the area PR1 saves.

2. Commit is granted round-robin instead of FPU first (VX_commit_slice, and the commit path in SimX core.cpp). The FPU-first priority existed because of the tag store: a finished FPU result held one of only two tags. Once the tags are gone, FPU-first lets a busy FPU starve ALU and LSU commits.

Performance

perf_gate (51 rtlsim cases, re-recorded):

  • Geomean −0.81% vs master and −1.05% vs PR1.
  • The biggest moves vs PR1:
case PR1 cycles this PR change
tensor:perf_gate-sgemm_tcu-ldm 245,496 195,745 −20.3%
tensor:perf_gate-fp16-mc-nt4 218,111 191,955 −12.0%
tensor:perf_gate-fp16 246,051 228,191 −7.3%
core:sgemmx-nt4 3,987,094 3,699,717 −7.2%
dxa:perf_gate-wgmma-dxa-mcast-nt4 378,836 353,714 −6.6%
core:sgemm-nt16 1,556,536 1,574,058 +1.1%
dxa:perf_gate-wgmma-dxa 28,114 28,649 +1.9%
tensor:perf_gate-fp16-mc-nt16 35,638 41,492 +16.4%

fp16-mc-nt16 is a real regression, explained below. Its cause is not root-caused yet.

FMA throughput microbenchmark (rtlsim, 16 warps, 4–8 independent FMA chains, cycles vs master, measured before the rebase onto #584):

4 threads × 4 warps 8 × 16 32 × 16
this PR 0.88 0.53–0.55 0.53–0.55

10-app geomean (rtlsim, measured before the rebase):

4 × 4 8 × 16 32 × 16
this PR 0.999 0.984 0.978

The biggest gains were stencil3d (−6.5% / −8.3%), raycast (−4.2%) and conv3 (−4.2%). The worst was sgemm2: +1.4% / +3%.

Area

Cost over PR1:

build metric PR1 this PR change
Beacon core, 16 threads × 16 warps LUT 116,403 117,064 +0.6%
FF 103,820 105,829 +1.9%
Beacon ASIC core cells 429,305 430,592 +0.3%
FF 76,744 77,851 +1.4%
Yosys core area (µm²) 54,700 54,993 +0.5%
Fmax 1046 MHz 1038 MHz
Vivado core LUT 123,981 123,775 −0.2%
FF 86,336 86,189 −0.2%
Fmax 287.1 MHz 301.1 MHz now meets the 300 MHz target
Vivado top Fmax 252.8 MHz 254.6 MHz
LUT 132,571 132,839 +0.2%

Max logic depth is unchanged at 15 levels.

V-ISO-6: the round-robin commit change

  1. Goal. Remove the FPU's 2-in-flight cap without letting the FPU starve the other units at commit. The commit arbitration policy lives only in the commit stage, so no extension point can change it.
  2. The isolated alternative. This PR without its last commit: header-in-pipeline, but FPU-first commit kept. Measured before the rebase onto TFU timing fix #584, at 8 threads × 16 warps, FPU-first made sgemm 3.8% and stencil3d 1.9% slower than round-robin. On the TCU perf cases after the rebase:
case master FPU-first (alternative) round-robin (this PR)
fp16-mc-nt16 35,638 35,638 41,492 (+16.4%)
fp16-mc-nt4 218,111 219,158 191,955 (−12.0%)
sgemm_tcu-ldm 245,496 245,496 195,745 (−20.3%)
  1. The gain. Round-robin is what turns the FPU's extra throughput into app speedups: geomean −1.05% vs PR1 across all 51 perf cases. It costs fp16-mc-nt16 16.4% and helps the other TCU cases by 12–20%. Under round-robin, the 16-thread TCU results likely wait their turn at commit behind the other units; this is not yet confirmed with a trace, and it is the follow-up.
  2. The cost to every configuration. The arbiter changes from a fixed priority to a round-robin over the same requesters. Beacon shows no deeper path: the core's maximum stays at 15 levels.
  3. Knob-off identity. Not met: the change is not behind a knob. It applies to every configuration, because the FPU-first rule it replaces was only there for the tag store.
  4. Approval. Needs a maintainer's approval in this PR.

Baselines re-recorded

The last commit re-records, on top of PR1's, the golden baselines this PR moves. Each was recorded with its update command and is authorized by jel221:

  • ci/baselines/perf/*.json: pytest ci -m perf_gate --update-baselines. All 51 entries, because removing VX_CFG_FPU_QUEUE_SIZE changes every entry's config_hash.
  • ci/baselines/synthesis/beacon/core.json: ci/logic_gate.py --update-baseline (core, core_ldst, top_vortex).
  • ci/baselines/synthesis/beacon_asic/core.json: ci/logic_gate.py --tool beacon_asic --update-baseline (core, top).
  • ci/baselines/synthesis/yosys/core.json: ci/asic_gate.py --update-baseline (core, top).
  • ci/baselines/synthesis/xilinx/core.json: ci/fpga_gate.py --update-baseline (core, top).

Impact and evidence

Impact class: R3 (detector:config-knobs, detector:pipeline-stage; from ci/change_impact.py)

Contracts touched:

  • VX_config.toml: VX_CFG_FPU_QUEUE_SIZE removed.
  • Shared pipeline stage: VX_commit_slice, with the SimX commit path changed alongside it. See the V-ISO-6 section above.
evidence status detail
functional tests (simx / rtlsim / xrt) run Before the rebase: make -C tests/regression run-simx and run-rtlsim, and the rv32 ISA suites on both, all pass; every app passes at 4×4, 8×16 and 32×16. After the rebase: the 51 perf_gate workloads pass on rtlsim. The full suite was not re-run locally after the rebase; CI runs it. xrt not run.
model_parity run Before the rebase: SimX and RTL instruction counts match exactly and cycles are within 2.2% on every case checked, including the FMA microbenchmark under heavy load.
perf_gate run re-recorded with --update-baselines; table above
Beacon logic_gate run core, core_ldst, top_vortex: no deeper unit, max 15 levels as before
synthesis (fpga_gate / asic_gate) run core, top on Vivado 2024.2 and Yosys/OpenSTA (ASAP7)
XLEN 64 build not run not run locally; CI's XLEN 64 cells cover it

Self-check: ci/precheck.sh summary: precheck: 7 pass, 0 with findings, 0 fail, 0 not run

Departures from SHOULD rules: V-ISO-3. The commit arbitration change is not gated by a knob (see V-ISO-6 item 5).

Design note: docs/designs/floating_point_unit.md and docs/designs/microarchitecture.md, updated in this PR.

  • 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.

Removing VX_CFG_FPU_QUEUE_SIZE changes the resolved config, so every perf
entry's config_hash moves; the core synthesis entries move with the FPU
header pipeline and the commit arbiter. Re-recorded with:

  pytest ci -m perf_gate --update-baselines                 (all 51 cases)
  ci/logic_gate.py --update-baseline                        (core, core_ldst, top_vortex)
  ci/logic_gate.py --tool beacon_asic --update-baseline     (core, top)
  ci/asic_gate.py --update-baseline                         (core, top)
  ci/fpga_gate.py --update-baseline                         (core, top)

gfx, gfxvm and tensor were re-run too; they contain no FPU and their
metrics did not move, so they are not re-recorded.

Tools: TOOLCHAIN_REV v3.0.4, beacon 134d03b9e, CIRCT 90c5fd313,
Yosys 0.69, OpenSTA 3.1.0 (asap7 rvt tt), Vivado 2024.2 (xcu55c).

Re-recorded by: agent, authorized by jel221 2026-12-03.
@jel221
jel221 added this pull request to stack #589 December 4, 2026 08:28
@jel221
jel221 marked this pull request as ready for review December 4, 2026 08:28

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