Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
MoeInitRoutingV3 算子(arch35)在部分测试用例中出现精度失败。
moe_v2_gather_static_quant.h 中 floatQueue_ 的 Buffer 初始化大小计算存在缺陷:
moe_v2_gather_static_quant.h
floatQueue_
AlignBytes(perLoopCols_, sizeof(float))
perLoopCols_
在 AlignBytes 之前增加 Align(perLoopCols_, sizeof(T)),确保先按数据类型 T 对齐,再按 float 字节要求对齐:
AlignBytes
Align(perLoopCols_, sizeof(T))
// 修复前 pipe_->InitBuffer(floatQueue_, 1, AlignBytes(perLoopCols_, sizeof(float))); // 修复后 pipe_->InitBuffer(floatQueue_, 1, AlignBytes(Align(perLoopCols_, sizeof(T)), sizeof(float))); ### Environment / 环境信息 (Mandatory / 必填) Ascend950 ### Steps to reproduce the issue / 重现步骤 (Mandatory / 必填) 使用指定用例即可复现 ### Describe the expected behavior / 预期结果 (Mandatory / 必填) 算子精度PASS ### Related log / screenshot / 日志 / 截图 (Mandatory / 必填) 暂无 ### Special notes for this issue/备注 (Optional / 选填)
Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
Describe the current behavior / 问题描述 (Mandatory / 必填)
MoeInitRoutingV3 算子(arch35)在部分测试用例中出现精度失败。
根因分析
moe_v2_gather_static_quant.h中floatQueue_的 Buffer 初始化大小计算存在缺陷:AlignBytes(perLoopCols_, sizeof(float))直接按perLoopCols_计算,未考虑数据类型 T 的对齐perLoopCols_未按 T 类型大小对齐时,分配的 Buffer 空间不足,导致后续计算精度异常修复方案
在
AlignBytes之前增加Align(perLoopCols_, sizeof(T)),确保先按数据类型 T 对齐,再按 float 字节要求对齐:// 修复前 pipe_->InitBuffer(floatQueue_, 1, AlignBytes(perLoopCols_, sizeof(float))); // 修复后 pipe_->InitBuffer(floatQueue_, 1, AlignBytes(Align(perLoopCols_, sizeof(T)), sizeof(float))); ### Environment / 环境信息 (Mandatory / 必填) Ascend950 ### Steps to reproduce the issue / 重现步骤 (Mandatory / 必填) 使用指定用例即可复现 ### Describe the expected behavior / 预期结果 (Mandatory / 必填) 算子精度PASS ### Related log / screenshot / 日志 / 截图 (Mandatory / 必填) 暂无 ### Special notes for this issue/备注 (Optional / 选填)