Skip to content

Fix FEDP2K on FPGA builds - #474

Merged
tinebp merged 1 commit into
masterfrom
fix/fedp2k-fpga
Nov 15, 2026
Merged

tinebp merged 1 commit into
masterfrom
fix/fedp2k-fpga

Conversation

@jel221

@jel221 jel221 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Human comment:
FEDP2K fails on the FPGA build because TCU_MAX_INPUTS was not being sized after TC_K is doubled with FEDP2K. You can observe this bug on the FPGA by seeing that it produces wrong results on the FPGA build, where the computed results undershoot the reference results by around half.

AI-generated comment:

Fixes WGMMA computing wrong results on FPGA with VX_CFG_TCU_FEDP2K and the dual-side sparse mask (VX_CFG_TCU_DSM_ENABLE), while simulation passed. First of the standalone fixes in #457's review (§8, item 1).

Root cause

Under FEDP2K the FEDP dot product is FEDP_K = 2 × TC_K words wide, but two things were still sized by TC_K:

  • VX_tcu_dsm was instantiated with .N (TCU_TC_K) while its a_row/b_col ports were driven with FEDP_K words, so the upper half of the K inputs was truncated and never got a valid mask.
  • TCU_MAX_INPUTS, which sizes that mask and every TFR multiplier's vld_mask, was TC_K × TCU_MAX_ELT_RATIO.

Vivado only warns on the truncated port connection, so the bitstream built and computed wrong results. No simulation case combined FEDP2K with DSM on the synthesizable TFR datapath, so nothing caught it.

Change

  • VX_tcu_pkg.sv: TCU_MAX_INPUTS = TCU_WG_FEDP_K × TCU_MAX_ELT_RATIO.
  • VX_tcu_core.sv: VX_tcu_dsm #(.N (FEDP_K)).

TCU_WG_FEDP_K equals TCU_TC_K without FEDP2K, so builds without FEDP2K are unchanged.

Gate

New case tensor_wg:sgemm_tcu_wg-fedp2k-dsm: sgemm_tcu_wg on rtlsim with the TFR datapath, FEDP2K and DSM.

  • On master it does not elaborate: Verilator stops with WIDTHTRUNC on VX_tcu_dsm's a_row/b_col (64-bit ports driven with 128 bits).
  • With the fix it passes at XLEN 32 and 64.

Change impact: R2

ci/change_impact.py: R2 (path:rtl, evidence:simx-rtl-lockstep).

  • SimX/RTL lockstep: no SimX change is needed. SimX has no DSM model, and the change moves no cycles: the mask stays a combinational lane-valid input behind the same pipe register. Every perf_gate and model_parity case passed unchanged in CI, including perf_gate-wgmma-fedp2k-rs and model_parity-wgmma-fedp2k-rs.
  • Synthesis/Beacon: no gated build combines FEDP2K with DSM (the only DSM build, the opt-in gpu32_full, has no FEDP2K), so no golden data moves.

Evidence

  • run: sgemm_tcu_wg-fedp2k-dsm on rtlsim at XLEN 32 and 64: pass. On unfixed master: build fails (WIDTHTRUNC).
  • run: ci/testcase.py lint.
  • run (CI, 43609861523): 114 of 116 jobs pass. The failures are tests (logic_gate, rtlsim, 32) and the complete job that depends on it: tensor: dsp 267 -> 283 (+6.0%). That failure is identical on master (e.g. run 43199063171 on 6fcd25477) and is in a build without FEDP2K or DSM, so this change does not cause it.
  • not run: FPGA bitstream on hardware.

@jel221
jel221 requested a review from tinebp November 15, 2026 02:08
@tinebp
tinebp merged commit 768069f into master Nov 15, 2026
114 of 118 checks passed
@tinebp
tinebp deleted the fix/fedp2k-fpga branch November 15, 2026 04:25
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.

2 participants