已关闭
[Requirement|需求]: DynamicMxQuantWithDualAxis 补充 -1 轴尾块 mxscale2 搬出的 UT 覆盖 #7826
hejc_hw创建于  3 天前关闭于  1 天前
hejc_hw
hejc_hw
3 天前 创建

Backgroud(背景信息)

quant/dynamic_mx_quant_with_dual_axis(arch35)的 CopyOut 中,mxscale2 搬出的源 stride scaleSrcStride 已由「按 dataLen 推算」修正为「按 ubRowLen_ 推算」:

uint32_t scaleSrcStride = (DIGIT_TWO * ubRowLen_ - ops::CeilAlign(DIGIT_TWO * dataLen, UBBlockSize_)) /
                          UBBlockSize_;

原因:UB 中一个 row-pair(两个 32 行组 scale 交织后)固定占 2 * blockW(blockW = 256),与本次 task 的有效列数 dataLen 无关;旧公式在 dimNeg1 不是 blockW 整数倍时会算小跨距。该修复已随 commit 690291182 合入。

说明:当前 248KB UB 下 host tiling 恒有 groupPerUb = 1、splitBlockH = 64,mxscale2 搬出的 burst 恒为 1,该 stride 不参与寻址,因此修复属防御性改动(更大 UB 平台 groupPerUb >= 2 时才是有效路径)。

当前 tests/ut/op_kernel/test_dynamic_mx_quant_with_dual_axis.cpp 的用例都使用 dimNeg1 = blockW = 256(满块),未覆盖 dimNeg1 < blockW 的尾块分支。

Origin(信息来源)

代码修改(commit 690291182)完成后的 UT 补充,属同一改动的配套用例。

Benefit / Necessity(价值/作用)

  • 覆盖 -1 轴尾块(dimNeg1 = 200 / 224)下的 CopyIn / CopyOut 分支(零填充、行/列尾偏移、scale1 组数补偶、scale2 行对搬出),防止尾块寻址逻辑回退;
  • 同时覆盖「尾轴长度已 32B 对齐」(224)与「未对齐」(200)两种输入。

Design(设计方案)

在 tests/ut/op_kernel/test_dynamic_mx_quant_with_dual_axis.cpp 新增两个 CPU 调试用例(ICPU_RUN_KF,blockDim = 2),直接构造 DynamicMxQuantWithDualAxisTilingData:

用例 dimNeg1 dimNeg1Tail dimNeg1IsPad 说明
test_case_tail_dimNeg1_200_unaligned 200 200 1 尾块且未 32B 对齐
test_case_tail_dimNeg1_224_aligned 224 224 0 尾块但已 32B 对齐

公共参数:dimNeg2 = 128、dimNeg2Tail = 64、splitBlockH = 64、blockW = 256、dimNeg2SplitBlockNum = 2、dimNeg1BlockNum = 1、scaleAlg = 0、roundMode = 4(rint)、dstType = 35(FLOAT8_E5M2)、usedCoreNum = 2;kernel 入口 ::dynamic_mx_quant_with_dual_axis<0, 4, 0>(...)。

验证方式:用例正常执行、无 UB/GM 越界访问(冒烟/回归;数值正确性由 ST 用例比对 golden 保证)。

likedislike
hejc_hwhejc_hw
3 天前 添加了label:requirement
hejc_hwhejc_hw
3 天前 关联了pull request:[test]DynamicMxQuantWithDualAxis 补充 -1 轴尾块 mxscale2 搬出 UT 用例
yuning_chenyuning_chen成员
3 天前 将 jianchao_He 设为负责人
CANN-robotCANN-robot成员
1 天前 关闭了 issue
CANN-robotCANN-robot成员
1 天前 添加了label:resolved
hejc_hwhejc_hw
1 天前 issue状态由 进行中 改变为 已解决