Pull Request已成功合入, 合并人@CANN-robot
(感谢 tianbaolin 的贡献)变更摘要
本 PR 修复 CV UBFuse 场景下 host tiling 求解器与 device 侧 tmp 分配不一致导致的 UB 越界问题。由于 GetTmpBuffer 会为 tmp 公式套上 v1 repeat cap 壳(Min(size, 255 * 256 + 32)),而 CV UBFuse 的 Pow epilogue 内联公式按原始需求分配 tmp,两侧不一致使求解器误判 UB 可行并选出较大 stage,最终 buf_cube + b0_raw + 队列 超出 UB。改动将 is_cv_ub_fusion 透传给 AscGraphUbExprBuilder,在 CV UBFuse 下对 tmp 剥离 v1 repeat cap,使 UB 约束与 device 分配保持一致,从而让求解器收缩 stage 或走 common 兜底。
主要改动
- 新增 v1 repeat cap 剥离逻辑:在
asc_graph_ub_expr_builder.cpp中新增常量kMaxV1RepeatTmpBytes与StripV1RepeatCap,对形如Min(size, 255 * 256 + 32)的表达式剥离 cap 壳,还原原始 tmp 需求。 Build接口增加原始 tmp 尺寸开关:AscGraphUbExprBuilder::Build与AddTmpBuffer新增use_raw_tmp_size参数,为真时按原始 tmp 需求累加node_tmp_buffer_bytes,默认值为false保持原有行为。UbExprContext新增字段:ub_expr_types.h中UbExprContext增加use_raw_tmp_size字段,用于承载 CV UBFuse 下 UB 约束按原始 tmp 计算的语义。- host 侧透传 CV UBFuse 标识:
gen_model_info.cpp中RefreshCommonUbExprContext新增is_cv_ub_fusion参数并传入Build,使GenerateSingleModelInfoWithContext能把 CV UBFuse 状态传递到 UB 表达式构建。 - 补充单元测试:
test_ub_expr_utils.cpp新增BuildStripsV1RepeatCapForRawTmpSize,验证默认构建得到 capped 值65312、开启use_raw_tmp_size后得到原始值80000。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to 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 |
|---|---|---|
| repo-cann/graph-autofusion | ✅ yangyongqiang0606, zhang_shengjie, xuyafei (3/2) | ✅ yangyongqiang0606 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
tianbaolin, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/lgtm


/approve


Pull Request
描述
fix(cv-ubfuse): host UB 约束按原始 tmp 需求计算, 修复 matmul+pow UB 越界
CV UBFuse 的 Pow epilogue 内联调用 Power 高精度 API, tmp 需求为
12B/元素(如 stage=15488 时需 185856B)。device 侧已按原始公式分配
(去 v1 repeat cap), 但 host tiling 求解器的 UB 约束仍使用 capped
tmp(Min(size, 65312)), 两侧不一致: 求解器按 capped 值判定 UB 可行
并选出较大 stage, 而 device 实际按原始 tmp 分配, 导致
buf_cube + b0_raw + 队列超出 UB, 设备侧报 MTE2/MTE3 地址越界。
将 is_cv_ub_fusion 透传给 AscGraphUbExprBuilder, CV UBFuse 下 UB
约束对 tmp 剥离 v1 repeat cap, 与 device 分配保持一致, 求解器据此
收缩 stage(或走 common 兜底), 使原始 tmp 能落入 UB 预算。
验证: tc_af_MMBC_0287(mm+pow CV 融合)由设备越界 Failed 恢复 Pass
(100%); 新增 UT 覆盖 cap 剥离行为。
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
baize 环境下测试tc_af_MMBC_0287
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。