Pull Request已成功合入, 合并人@CANN-robot
(感谢 caorenlei 的贡献)变更摘要
此 PR 修复了 arch35 平台下 dequant_swiglu_quant 算子中由于 tmpBuffer stride 不匹配导致的 VEC 越界 AIC Error。核心问题在于 kernel 中 tmpBuffer 地址计算使用的对齐参数(xTypeUbAlignB32_)与 buffer 初始化时分配的对齐基准(xUbAlignB32_)不一致,导致 stride 偏移错误。修复方案包括:在 host 端 tiling 引入 vecRegLen_ 参与 UB 可用空间计算以预留向量寄存器 padding,同时在 kernel 端统一 tmpXAddr 的 stride 计算为 xUbAlignB32_,并在 tmpBuffer 初始化时追加 AscendC::GetVecLen() 的额外 padding。
主要改动
-
新增
vecRegLen_字段用于 tmpBuffer padding 计算:在DequantSwigluQuantV35DskTiling类中添加uint32_t vecRegLen_ = 256成员变量,并在GetPlatformInfo()中通过ascendcPlatform.GetVecRegLen()获取实际向量寄存器宽度,用于 host 端 tiling 的 padding 预留计算。 -
host 端 UB 可用空间计算纳入向量寄存器 padding:
DoOpTilingNotFull()和DoOpTiling()中的ubAvailable计算均额外减去vecRegLen_,确保预留足够的向量寄存器对齐空间,避免因 padding 不足导致的越界。 -
kernel 端
tmpBuffer初始化追加向量寄存器 padding:InitBuffer(tmpBuffer, ...)的 size 参数从tl_->UbFactorDimx * xUbAlignB32_ * sizeof(float)改为追加+ AscendC::GetVecLen(),与 host 端 padding 策略保持一致。 -
统一
tmpXAddr地址计算的 stride 参数:kernel 中所有tmpXAddr计算从使用xTypeUbAlignB32_(类型相关对齐)改为使用xUbAlignB32_(统一对齐),包括 dequant 阶段、量化阶段的整块与尾块处理分支,消除了 stride 不匹配的根因。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| quant | ✅ 陈风, 汤平川 (2/2) | ✅ 陈风, 汤平川 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
caorenlei, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [2775c7d073234a40bc576fb9b9ec8acd][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_report_lcov | ✅ SUCCESS | >>>>> |
[2026-08-12 17:31:22] CI执行结束


流水线任务触发成功
任务链接 [07daa8a349bf4a9ca0d09697d86b8294][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> |
[2026-08-12 17:08:24] CI执行结束


/lgtm
/approve


流水线任务触发成功
任务链接 [030b9705d0e64a52acb1b14c6f2c519f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_report_lcov | ✅ SUCCESS | >>>>> |
[2026-08-17 15:43:44] CI执行结束


流水线任务触发成功
任务链接 [7839acdf24864dddb6b94b518c1dd07b][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> |
[2026-08-17 15:29:54] CI执行结束


/lgtm
/approve


/lgtm
/approve


描述
修复
dequant_swiglu_quant算子 arch35 kernel 中tmpBufferstride 不匹配导致 VEC 越界 AIC Error 的问题。改动原因
tmpBuffer在分配时使用xUbAlignB32_作为行 stride(line 220),但在后续访问tmpXPtr(指向tmpBuffer)时,错误使用了xTypeUbAlignB32_作为行 stride 计算地址。当输入数据类型为 bfloat16 时,xTypeUbAlignB32_与xUbAlignB32_取值不同,导致地址计算偏移与实际 buffer 布局不匹配,引发 VEC 越界访问,产生 AIC Error。改动方法
将
dequant_swiglu_quant.h中 4 处tmpXPtr地址计算从xTypeUbAlignB32_修改为xUbAlignB32_,与tmpBuffer分配时的 stride 保持一致:dstAddr = tmpXPtr + i * xUbAlignB32_ + j * sizePerRepeattmpXAddr = tmpXPtr + i * xUbAlignB32_ + j * sizePerRepeat(尾块处理)tmpXAddr = tmpXPtr + i * xUbAlignB32_ + j * sizePerRepeat(整块处理)tmpXAddr = tmpXPtr + i * xUbAlignB32_ + j * sizePerRepeat(FP4 量化路径)关联的Issue
测试
使用 ttk 工具对 bfloat16 输入场景进行精度验证,修复后 AIC Error 消失,精度验证通过。
文档更新
无
类型标签
AI/Agent生成声明