TFR tensor core with DSM drops an MXFP4/NVFP4 NaN block scale when its elements are masked

Offen
#516 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@youzi27 arbeitet bereits daran.

Seit 27.11.2026.

  • #517 von @youzi27 — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet

Rechercherichtung

Read hw/rtl/tcu/tfr/VX_tcu_tfr_mul_f4.sv at the two exception assignments identified in the issue, then compare the scale NaN handling in VX_tcu_tfr_mul_f8.sv. Reproduce with the listed tcu_fedp commands for --fmt=10 and --fmt=11; done means both return NaN for the masked NaN scale cases. Pull request #517 is already open for this issue.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Hi there,

With VX_CFG_TCU_DSM_ENABLE, a NaN block scale (E8M0 0xFF for MXFP4, UE4M3 0x7F for NVFP4) no longer makes the result NaN when every element it scales has a zero operand. MXFP8 and MXBF8 do return NaN in that case (the fp8 multiplier raises the scale NaN for masked lanes since #460), and so do builds without DSM, SimX and the TfrFedp reference.

The FEDP unit test shows it on master 2221ee286 with the MX configuration of run-tcu-unit; --sparsity=100 zeroes A and clears the valid bits the way DSM does:

make -C hw/unittest/tcu_fedp NUM_REGS=2 SF=1 CONFIGS="-DSIMULATION -DSV_DPI -DVX_CFG_EXT_TCU_ENABLE -DVX_CFG_TCU_TYPE_TFR -DUSE_FEDP -DVX_CFG_TCU_MX_ENABLE -DVX_CFG_TCU_FP8_ENABLE -DVX_CFG_TCU_FP4_ENABLE -DVX_CFG_TCU_MXFP4_ENABLE -DVX_CFG_TCU_NVFP4_ENABLE"
./hw/unittest/tcu_fedp/tcu_fedp --fmt=10 --W=25 --ulp=0 --sfa=255 --sparsity=100 --no-trace
./hw/unittest/tcu_fedp/tcu_fedp --fmt=11 --W=25 --ulp=0 --sfa=127 --sparsity=100 --no-trace

Both fail at test 0 with expected=nan (0x7fc00000), actual=3.08809e+09 (0x4f38108d), which is C. --fmt=8 and --fmt=9 with the same options pass. The same happens with LANE_MASK=0, the core's setting. In a full WMMA run on rtlsim (NT=8, TFR, DSM), an MXFP4 or NVFP4 row of A that is all zero under NaN scales gives 0 in that row of C; without DSM, and on SimX, the row is NaN.

The cause is in hw/rtl/tcu/tfr/VX_tcu_tfr_mul_f4.sv, lines 262 and 523, which gate the scale NaN with the lane's valid bits (term_on = vld_mask):

assign exceptions_mxfp4[i].is_nan = ((sf_a == 8'hFF) || (sf_b == 8'hFF)) && (|term_on);
assign exceptions_nvfp4[i].is_nan = sf_nan && (|term_on);

Suggested fix: drop && (|term_on) (and the then unused term_on), as was done for sf_nan in VX_tcu_tfr_mul_f8.sv. Without DSM the mask is all ones, so default builds do not change. A PR follows.

Thanks!

Vorherrschende Sprache
Verilog
Sterne
2.4k
Forks
563
Ø Merge
1 T. 7 Std.
Gemergte PRs (30 T.)
71

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus vortexgpgpu/vortex

Alle Issues in vortexgpgpu/vortex

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.