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

オープン
#516 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@youzi27 がすでに取り組んでいます。

2026年11月27日 から。

  • #517 @youzi27 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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!

主要言語
Verilog
スター
2.4k
フォーク
563
平均マージ
1日 7時間
マージ済み PR(30日)
71

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vortexgpgpu/vortex のほかの issue

vortexgpgpu/vortex の issue をすべて見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。