已合并
fix(pypto_pro): relax MX matmul physical shape checks #6670
yzf创建于 9月23日
fix(pypto_pro): relax MX matmul physical shape checks #6670
已合并
yzf创建于 9月23日
yzf
yzf
9月23日

relax MX matmul physical shape checks

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 yzf 的贡献)
yzfyzf
9月23日 创建了 pull request,commit 6b092e5b
atomgit-bot
atomgit-bot
9月23日 评论:

变更摘要

本 PR 针对 pypto_pro 的 MX matmul 物理形状校验进行放宽:在 _check_mx_operands 中移除了基于输入物理形状推断逻辑窗口的约束(lhs/rhs 的 K 维度必须相等、dst_tile 形状必须为 [lhs M, rhs N]),因为 set_validshape 更新的是描述符状态而非 TileType.shape,构建器不应据此推断逻辑输出窗口;同时将 dst_tile 与 acc_tile 形状一致性校验抽取为独立辅助函数 _check_matmul_acc_shape,并在 _ir_matmul_acc 中统一调用。

主要改动

  • 新增形状校验辅助函数: 在 block_ops.py 中新增 _check_matmul_acc_shape,集中校验 acc_tile 与 dst_tile 形状是否一致,不一致时抛出 InvalidShape。
  • matmul_acc 增加形状校验: 在 _ir_matmul_acc 中调用 _check_matmul_acc_shape,使普通(非 MX)matmul_acc 路径也执行 acc_tile/dst_tile 形状匹配检查。
  • 放宽 MX matmul 物理形状约束: _check_mx_operands 删除了 lhs/rhs K 维度必须相等以及 dst_tile 必须等于 [lhs M, rhs N] 的校验,仅保留 K 维度须为 64 倍数的检查,并将 acc_tile 形状校验改为复用新辅助函数。
  • 测试用例更新: test_matmul_mx.py 将原先的 K 不匹配、输出形状不匹配拒绝用例改为允许用例(allows_physical_k_selected_by_valid_shape、allows_output_shape_selected_by_valid_shape),test_block_ops.py 新增 test_matmul_acc_rejects_mismatched_acc_shape 覆盖 acc_tile 形状不匹配场景。
likedislike
不准确?
atomgit-bot
atomgit-bot
9月23日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
9月23日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
9月23日 评论:

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, gaoxiang618 (2/2) ✅ gcw_kUomxQ2l (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

fafafafafa, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
此处折叠了50条消息 查看更多
CANN-robotCANN-robot成员
9月24日 添加了label:approved
gaoxiang618
gaoxiang618成员
9月24日 评论:

/approve
/lgtm

likedislike
CANN-robot
CANN-robot成员
9月24日 评论:

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

likedislike
CANN-robotCANN-robot成员
9月24日 添加了label:lgtm
CANN-robotCANN-robot成员
9月24日 合入了pull request