已合并
perf: 限制V2 stride计算上限 #1955
perf: 限制V2 stride计算上限 #1955
已合并
gaoxin创建于 11 天前
gaoxin成员
11 天前

Pull Request

描述

为 V2 LoadStoreStride 性能模型中的 stride_used 增加 4096 的常量上限,避免 stride 成本计算超出模型适用范围。

变更类型

关联的Issue

如何测试

描述测试此变更的步骤和前提条件:

  1. source $ASCEND_HOME_PATH/set_env.sh
  2. cmake --build build --target aihac_codegen -j 8
  3. 构建目标未完成,命令执行期间被用户中止;已完成 git diff --check 和 clang-format 检查。

核对清单

其他信息

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 gaoxin 的贡献)
Ggaoxin成员
11 天前 创建了 pull request,commit fe25b45c
atomgit-bot
atomgit-bot
11 天前 评论:

变更摘要

本 PR 为 V2 LoadStoreStride 性能模型中的 stride_used 增加 4096 的常量上限,避免 stride 成本计算超出模型适用范围。改动位于 autofuse/att/gen_model_info/api_perf_register/utils/api_perf_utils.cpp:新增常量 kMaxStrideUsed = 4096U,并在 LoadStoreStrideV2Func 中通过 af::sym::Min(stride_used, CreateExpr(kMaxStrideUsed))stride_used 进行截断,随后再乘以 block_count 与惩罚系数 k 参与成本计算。

主要改动

  • 新增 kMaxStrideUsed 常量: 在匿名命名空间中定义 constexpr uint32_t kMaxStrideUsed = 4096U,作为 stride 使用的上限值。
  • stride_used 施加上限: 在 LoadStoreStrideV2Func 中,基于 LimitedStrideUpperBound 计算得到 stride_used 后,追加 stride_used = af::sym::Min(stride_used, CreateExpr(kMaxStrideUsed)),将其限制在 4096 以内。
  • 影响成本计算链路: 截断后的 stride_used 继续参与 af::sym::Mul(k, af::sym::Mul(block_count, stride_used)) 的惩罚项计算,确保最终 stride 成本不超出性能模型的有效适用范围。
likedislike
不准确?
atomgit-bot
atomgit-bot
11 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
11 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
11 天前 评论:

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, xchu42 (3/2) yangyongqiang0606 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
此处折叠了58条消息 查看更多
xchu42
xchu42成员
7 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:lgtm
yangyongqiang
yangyongqiang成员
7 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:approved
CANN-robotCANN-robot成员
7 天前 合入了pull request