Pull Request已成功合入, 合并人@CANN-robot
(感谢 gaoxin 的贡献)变更摘要
本 PR 旨在完善 Where/Select V2 的 ATT 性能建模与 codegen 传参链路:新增 WhereNodeParams 数据结构并将其从 codegen 侧经 AscirNodeParams 一路透传到 ATT 性能建模侧,同时修正 Where V2 的 outer loop 传参与参数拆分,并按 WhereCompute 中的 Reg:: 调用补全 1D WhereImpl 性能模型,2D WhereExtend 路径则复用公共建模逻辑。
主要改动
-
新增
WhereNodeParams并打通透传链路: 在ascir_node_param.h中新增WhereNodeParams结构体(含valid、is_bcast_src0、is_bcast_src1、outer_call_count、output_dims、output_strides、mask_strides、input_strides等字段)并加入AnySpecificParamsvariant;api_perf.h的NodeDetail与tuning_space.h的NodeInfo同步增加where_node_params字段;specific_params_builder.cpp新增FillWhereParams并对kWhere/kSelect节点类型分发填充;ascir_api_perf_v2.cpp的WhereApi将node.where_node_params赋值给node_info。 -
codegen 侧填充 Where 参数并修正 outer loop 传参:
reg_where_api_call.cpp新增FillWhereNodeParams(通过SetExtAttr(kAscirNodeParams, ...)将参数写入节点,缺失时自动创建AscirNodeParams)、BuildWhereLoopParams(按 outer repeats 计算outer_call_count及 dims/strides)与GetWhereOuterForRepeats(拆分 outer repeats,剔除最后一个内层 repeat);GenerateLoopParams签名增加输出参数merge_info,各 scalar/normal 分支按 x2/x3 是否为标量(即 src0/src1 是否 broadcast)分别调用FillCurrentWhereNodeParams填充参数。 -
重构
WherePerf性能模型并新增 1DWhereImpl模型:ascendc_regbase_perf.cpp中WherePerf改为按where_node_params.valid分流:有效时走AddWhereExtendPerf(1D 走AddWhereImplPerf,2D 走AddWhereExtend2DPerf),否则回退AddLegacyWherePerf;1DAddWhereImplPerf按Reg::调用序列(CreateMask/Placeholder、broadcast 源的Duplicate、UpdateMask、conditionLoadAlign、CompareScalarNE、MaskUnPack、src0/src1LoadAlign、Select、StoreAlign)建模,repeat 次数由Ceiling(count / repeat_elm)计算。 -
补充 2D
WhereExtend公共建模与辅助函数:AddWhereExtend2DPerf以block_count = counter_first * repeat_time复用AddWhereComputePerf的公共建模逻辑;新增GetWhereRepeatElm(按 dtype 取 repeat 元素数,int64/uint64 加倍)与GetWhereMaskUnPackCount(按 dtype 计算 mask 解包次数);WherePerf在参数有效时对结果乘以outer_call_count。


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
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 | ✅ 张德鹏, xchu42, zhang_shengjie (3/2) | ✅ 张德鹏 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
gcw_V3YyYBt1, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Pull Request
描述
完善 Where/Select V2 的 ATT 性能建模与 codegen 传参链路,修正 1D WhereImpl 和 2D WhereExtend 的计数建模。
背景
修改方案
WhereNodeParamsWhereExtend参数拆分WhereCompute中的Reg::调用补全 1DWhereImpl性能模型WhereExtend路径的公共建模逻辑变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
source /home/developer/Ascend/cann/set_env.sh && export ASCEND_HOME_PATH=/home/developer/Ascend/canncmake --build build --target aihac_codegen -j 8核对清单
其他信息
无。