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

未关闭
#516 0 条评论 0 个 reaction 已指派 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 小时
30 天内合并 PR
71

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vortexgpgpu/vortex 的其他 Issue

查看 vortexgpgpu/vortex 的全部 Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。