Pull Request has been successfully merged by CANN-robot.
(Thank you for bynshard's contribution.)变更摘要
本 PR 在 framework/src/interface/operation/operation_impl.cpp 中对 GatherInUB 相关实现进行了可读性重构,将原先散落在 TiledGatherInUB 和 experimental::GatherInUB 中的魔法数字替换为具名常量,不改变原有逻辑与行为。新增了 GATHER_IN_UB_INDICES_LEADING_DIM 与 GATHER_IN_UB_SUPPORTED_AXIS 两个常量,分别表示 indices 前导维度长度和仅支持的 axis 取值。
主要改动
- 新增具名常量: 在
TiledGatherInUB前定义constexpr int64_t GATHER_IN_UB_INDICES_LEADING_DIM = 1与constexpr int GATHER_IN_UB_SUPPORTED_AXIS = -2,用于表达indices前导维度与受支持的axis值。 - 替换分块视图中的魔法数字: 在
TiledGatherInUB内将indices->View的形状参数由字面量1改为GATHER_IN_UB_INDICES_LEADING_DIM,语义保持一致。 - 替换维度校验中的魔法数字: 在
experimental::GatherInUB中将indices.GetShape()[0] == 1的判断改为与GATHER_IN_UB_INDICES_LEADING_DIM比较。 - 替换 axis 校验并调整报错信息: 将
axis == -2的判断改为与GATHER_IN_UB_SUPPORTED_AXIS比较,并在CHECK的提示信息中改为输出该常量,使提示与常量定义保持同步。


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 |
|---|---|---|
| 9.2.0 | ✅ gcw_kUomxQ2l, 尹杰 (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


compile


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


/approve


/approve


/lgtm


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/approve: 尹杰


gatherinub 代码中魔鬼数字整改
Related Issue:
https://gitcode.com/cann/pypto/issues/3413