Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
文件: op_host/masked_softmax_with_rel_pos_bias_tiling.cpp:573
uint32_t stackNum = (aicoreParams_.ubSize - static_cast<uint32_t>(attenBiasAndTempSize - bf16AttenAndBiasCastTempSize)) / (xYUbSize * 2 + static_cast<uint32_t>(bf16XCastTempSize) + softMaskMinTmpSize);
问题: attenBiasAndTempSize - bf16AttenAndBiasCastTempSize 在 uint64_t 下为负时回绕为极大值,然后 static_cast<uint32_t> 截断。 触发: 所有 FP16/BF16 B-tiling 路径均受影响。 后果: stackNum 垃圾值(被 std::min 部分掩盖但不可靠)。
attenBiasAndTempSize - bf16AttenAndBiasCastTempSize
文件: op_kernel/masked_softmax_with_rel_pos_bias_BWN.h:52
uint32_t offsets1s2_ = offset * s1s2_; // offset 是 int64_t, s1s2_ 是 uint32_t
触发: bwns1s2 > 4.29B(接近 64GB 上限时可触发)。 后果: 读写错误的 GM 地址 → 数据损坏。 修复: offsets1s2_ 改为 int64_t。
文件: tiling.cpp:969-971 (S1Bias), tiling.cpp:1304 (BWNS1), tiling.cpp:1436 (ONES2)
int64_t totalSize = b_ * w_ * n_ * s1_; // RHS 全 uint32_t,溢出后赋给 int64_t
触发: b_*w_*n_*s1_ > 4.29B(FP16 下 ≈ 8.6GB,可触发)。 后果: totalSize 截断为 0 或小值 → 所有核处理零元素。 修复: static_cast<int64_t>(b_) * w_ * n_ * s1_
static_cast<int64_t>(b_) * w_ * n_ * s1_
910B/910_93
输入shape导致乘法链超过int32上限
不存在int32/uint32溢出风险
无
Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
Describe the current behavior / 问题描述 (Mandatory / 必填)
HIGH R1: B-tiling stackNum 计算中 uint64_t 无符号减法回绕
文件: op_host/masked_softmax_with_rel_pos_bias_tiling.cpp:573
uint32_t stackNum = (aicoreParams_.ubSize - static_cast<uint32_t>(attenBiasAndTempSize - bf16AttenAndBiasCastTempSize)) / (xYUbSize * 2 + static_cast<uint32_t>(bf16XCastTempSize) + softMaskMinTmpSize);问题:
attenBiasAndTempSize - bf16AttenAndBiasCastTempSize在 uint64_t 下为负时回绕为极大值,然后 static_cast<uint32_t> 截断。触发: 所有 FP16/BF16 B-tiling 路径均受影响。
后果: stackNum 垃圾值(被 std::min 部分掩盖但不可靠)。
HIGH R2: BWN 内核 GM 偏移 int64_t → uint32_t 截断
文件: op_kernel/masked_softmax_with_rel_pos_bias_BWN.h:52
uint32_t offsets1s2_ = offset * s1s2_; // offset 是 int64_t, s1s2_ 是 uint32_t触发: bwns1s2 > 4.29B(接近 64GB 上限时可触发)。
后果: 读写错误的 GM 地址 → 数据损坏。
修复: offsets1s2_ 改为 int64_t。
HIGH R3-R4: totalSize / singleCoreSize 在 uint32_t 域计算后赋给 int64_t
文件: tiling.cpp:969-971 (S1Bias), tiling.cpp:1304 (BWNS1), tiling.cpp:1436 (ONES2)
int64_t totalSize = b_ * w_ * n_ * s1_; // RHS 全 uint32_t,溢出后赋给 int64_t触发: b_*w_*n_*s1_ > 4.29B(FP16 下 ≈ 8.6GB,可触发)。
后果: totalSize 截断为 0 或小值 → 所有核处理零元素。
修复:
static_cast<int64_t>(b_) * w_ * n_ * s1_Environment / 环境信息 (Mandatory / 必填)
910B/910_93
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
输入shape导致乘法链超过int32上限
Describe the expected behavior / 预期结果 (Mandatory / 必填)
不存在int32/uint32溢出风险
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
无
Special notes for this issue/备注 (Optional / 选填)