Pull Request已成功合入, 合并人@CANN-robot
(感谢 ling-DT 的贡献)变更摘要
该 PR 修复 CV Fusion 代码生成时将 ScalarData(常量/标量输入)误当作 GM Tensor 处理的问题,涉及 autofuse/codegen/codegen_kernel.cpp 中的 Kernel::GlobalTensorAssign 与 AutoFusionVector。改动后常量输入不再参与 Global Buffer 绑定,生成的 Arguments、Params 及实际入参初始化会按输入类型区分:GM 地址类型(kGmAddrT)输入用 nullptr 初始化,标量输入改用 0 初始化,避免生成 float{nullptr} 以及对标量调用 SetGlobalBuffer。
主要改动
- 跳过常量输入的 Global Buffer 绑定:在
Kernel::GlobalTensorAssign中新增对tensor->second.is_constant的判断,常量(ScalarData)输入直接continue,不再对其调用SetGlobalBuffer。 - 按类型初始化
Arguments与Params结构体成员:在AutoFusionVector生成Arguments和Params结构体时,依据input.type.name == kGmAddrT.name判断,GM 地址输入保持{nullptr}初始化,标量输入改为{0}。 - 实际入参初始化同样按类型区分:在
AutoFusionVector生成入参对象的初始化处应用相同的is_gm_input判断,标量参数以{0}而非nullptr初始化,杜绝对标量类型生成{nullptr}的非法初始化。


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, xchu42, 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
ling-DT, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/approve


Pull Request
描述
修复 CV Fusion 生成代码将 ScalarData 误当作 GM Tensor 输入的问题。跳过常量输入的 Global Buffer 绑定,并按输入类型分别初始化 GM 地址和标量参数,避免生成
float{nullptr}以及对标量调用SetGlobalBuffer。变更类型
关联的Issue
如何测试
20061b3a1c32编译aihac_codegen和pyautofuse。tc_af_inductor_netexit_rmsnorm_lm_head_logit_softcap。torch.Size([4, 256, 4096])、torch.bfloat16,数值校验通过。核对清单
其他信息
源分支基于本地
develop分支,目标分支为cann/graph-autofusion:develop。