固定源码 cann/ops-nn 提供的 V2 文档规定:dstTypeMax 只支持 0.0 或 [6.0, 12.0],且仅在 dstType=FLOAT4_E2M1、scaleAlg=2 时设置。 Host tiling 的 GetAttr 仅检查 <0、0<x<6 和 >12,没有检查有限性,也没有把非零 dstTypeMax 与 dstType/scaleAlg 组合绑定。因此 dstTypeMax=NaN 会被接受;在合法的 dstType=FLOAT4_E2M1, scaleAlg=2 调用中,kernel 将 1/NaN 乘到输入块最大值,生成 NaN 的 E8M0 scale,破坏量化输出契约。类似地,dstTypeMax=6 与 FP8 或 scaleAlg=0/1 的非法组合也会通过 Host 校验。 修复应拒绝非有限值,并在非零时要求 FLOAT4_E2M1 + scaleAlg=2。
cann/ops-nn
dstTypeMax
0.0
[6.0, 12.0]
dstType=FLOAT4_E2M1
scaleAlg=2
GetAttr
<0
0<x<6
>12
dstType/scaleAlg
dstTypeMax=NaN
dstType=FLOAT4_E2M1, scaleAlg=2
1/NaN
dstTypeMax=6
scaleAlg=0/1
FLOAT4_E2M1 + scaleAlg=2
master
clang-format
关联 PR: https://gitcode.com/cann/ops-nn/merge_requests/12425
DynamicMxQuantWithDualAxisV2 接受非有限及非法组合的 dstTypeMax
固定源码
cann/ops-nn提供的 V2 文档规定:dstTypeMax只支持0.0或[6.0, 12.0],且仅在dstType=FLOAT4_E2M1、scaleAlg=2时设置。Host tiling 的
GetAttr仅检查<0、0<x<6和>12,没有检查有限性,也没有把非零dstTypeMax与dstType/scaleAlg组合绑定。因此dstTypeMax=NaN会被接受;在合法的dstType=FLOAT4_E2M1, scaleAlg=2调用中,kernel 将1/NaN乘到输入块最大值,生成 NaN 的 E8M0 scale,破坏量化输出契约。类似地,dstTypeMax=6与 FP8 或scaleAlg=0/1的非法组合也会通过 Host 校验。修复应拒绝非有限值,并在非零时要求
FLOAT4_E2M1 + scaleAlg=2。验证
master均通过适用性检查;目标仓库的单文件clang-formatpre-commit 检查通过。关联 PR: https://gitcode.com/cann/ops-nn/merge_requests/12425