Merged
feat(pypto): Add pypto.experimental.auto_mix_partition 0/1 config (9.2.0) #6654
feat(pypto): Add pypto.experimental.auto_mix_partition 0/1 config (9.2.0) #6654
Merged
dbjAdd on Sep 23
dbj
dbjCollaborators
Sep 23

feat(pypto): Add pypto.experimental.auto_mix_partition 0/1 config

Cherry-pick of #6648 onto 9.2.0.

The level-based auto_mix_partition config (off/default/high strings and the
N>100 custom op-limit) is removed from pypto.set_pass_options. The auto CV
Mix merging switch of the ReduceCopyMerge pass is now configured solely via
pypto.experimental.auto_mix_partition(0/1), defaulting to disabled (0).
The C++ ReduceCopyMerge level mapping (MapAutoMixPartitionToLimits) is kept
unchanged.

Changes:

  • Add pypto.experimental.auto_mix_partition(value) accepting only 0/1, other values raise ValueError
  • Remove the auto_mix_partition parameter from pypto.set_pass_options and its read-back key from pypto.get_pass_options
  • Converge the tile_fwk_config default to 0 and tighten the schema range to 0~1
  • Update the interface UT (test_config_options.py) and the set_pass_options API doc
  • Remove the sg_set_atomic_scope description from the set_pass_options doc
  • Update the precision-pass skill to use the experimental entry

Related Issues: #3431

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for dbj's contribution.)
dbjdbjCollaborators
Sep 23 Created pull request, commit 38eae093
dbjdbjCollaborators
Sep 23 Associated issue: [Task|任务跟踪]: auto_mix_partition 配置收敛为 pypto.experimental 入口并仅保留 0/1
atomgit-bot
atomgit-bot
Sep 23 Comments:

变更摘要

本次变更将 ReduceCopyMerge pass 的自动 CV Mix 合图开关从 pypto.set_pass_options 的档位式配置中剥离,改为仅通过新的实验性接口 pypto.experimental.auto_mix_partition(0/1) 配置,默认关闭(0)。原基于档位名(off/default/high)与 N>100 自定义 op 上限的配置被移除,配置项取值范围收紧为 0~1。

主要改动

  • 新增实验接口 pypto.experimental.auto_mix_partition: 在新增文件 python/pypto/experimental/pass_config.py 中实现该函数,仅接受 0/1,其他值(含布尔、字符串、浮点等)抛出 ValueError,并通过 set_options(pass_options={'auto_mix_partition': value}) 写入配置;同时在 python/pypto/experimental/__init__.py 中导出该函数。
  • 移除 set_pass_options/get_pass_options 的 auto_mix_partition 支持: 删除 python/pypto/config.py 中的 auto_mix_partition 参数、文档说明及写入逻辑,并删除档位编解码相关的 _AUTO_MIX_PARTITION_LEVELS、_encode_auto_mix_partition、_decode_auto_mix_partition 及 get_pass_options 中的读回逻辑。
  • 收敛默认值与 schema 范围: framework/src/interface/configs/tile_fwk_config.json 中 auto_mix_partition 默认值由 2 改为 0;tile_fwk_config_schema.json 的 default 改为 0、maximum 由 100000 改为 1,并将中英文 label 说明简化为 0(关闭)/1(开启,Cube op ≤ 2000 且 Vector op ≤ 2240)。
  • 更新接口 UT: python/tests/ut/interface/test_config_options.py 中 test_auto_mix_partition 改为验证实验接口对 0/1 的接受以及对非法值、非法字符串、非法类型和布尔值的 ValueError 拒绝。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 23 Comments:

代码审查

发现 1 个问题,其中 1 个高优先级问题建议在合并前修复。

类型 数量
🔴 阻塞 1
🟡 建议 0

⛔ 需要修改

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 23 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Sep 23 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 23 Comments:

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, zhangyuebing (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

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 23 Set xinweiliu,lyz0328,cam_bxh,dai-zhentao,TianXL,lululu40888,shi-dingkun,gguuaanngg,codehjp423,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,gcw_kUomxQ2l,Andy-lb,WenboCodes as approver
CANN-robotCANN-robotCollaborators
Sep 23 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
atomgit-bot
atomgit-botSep 23Start code review2
python/pypto/config.py
@@ -286,4 +255,3 @@
286255 experimental: Optional[Dict[str, int]] = None,
287256 ooo_sched_mode: Optional[str] = None,
288- auto_mix_partition: Optional[Union[int, str]] = None,
289257 sg_set_tunevf_mode: Optional[int] = None,
atomgit-bot
atomgit-botSep 23Comments:

🟠 High Priority

变更点:python/pypto/config.py 的 set_pass_options 签名删除了关键字参数 auto_mix_partition: Optional[Union[int, str]] = None(新文件第 256/257 行之间),且该函数签名形如 def set_pass_options(*, ...),没有 **kwargs 兜底。

受影响契约:set_pass_options 是 jit / runtime 的统一入口,python/pypto/frontend/parser/entry.py:978 会执行 pypto.set_pass_options(**self._pass_options),其中 _pass_options 就是用户传给 pypto.frontend.jit(pass_options=...) 的字典(entry.py:278 dict(pass_options))。

失败模式:仓库内未同步修改的调用方 python/tests/st/test_dualdst.py:51 仍为 pypto.frontend.jit(..., pass_options={"auto_mix_partition": 1})。该 kernel 被调用时会以关键字参数 auto_mix_partition 调用 set_pass_options,由于参数已被删除且无 **kwargs,直接抛出 TypeError: set_pass_options() got an unexpected keyword argument 'auto_mix_partition',导致该 ST 用例(及其覆盖的 dualdst 编译流程)失败。同理,任何沿用旧写法把 auto_mix_partition 放进 pass_options 的存量用户代码也会从“可用”变为“报错”。

建议:保留 set_pass_options 的 auto_mix_partition 参数作为兼容入口(内部转发到 pass_options['auto_mix_partition'] 或新的 experimental 入口),或同步更新 python/tests/st/test_dualdst.py:51 等仍使用 pass_options={"auto_mix_partition": ...} 的调用方为 pypto.experimental.auto_mix_partition(...)。

likedislike
Incorrect?
dbj
dbjCollaborators
Sep 23 Comments:

已修改

likedislike
dbjdbjCollaborators
Sep 23 Pre merge succeeded (commit_id: aed06159ad3bbe04c04c41a713848d25a7810484)
dbjdbjCollaborators
Sep 23 Pushed 1 commits:4978a625-fix(test): Move auto_mix_partition out of jit pass_options in dualdst test
dbjdbjCollaborators
Sep 23 Pre merge succeeded (commit_id: d1fddc6b90e00063ac6a1e0b8264af56f9ecc768)
CANN-robotCANN-robotCollaborators
Sep 23 Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
Sep 23 Added label: cann-cla/yes
dbj
dbjCollaborators
Sep 23 Comments:

/compile

likedislike
dbjdbjCollaborators
Sep 23 Pre merge succeeded (commit_id: d377cd90c67cb819311d9c35ddca5dab3e3f7d8f)
CANN-robot
CANN-robotCollaborators
Sep 23 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 23 Added label: ci-pipeline-running
dbjdbjCollaborators
Sep 23 Pre merge succeeded (commit_id: 190098cab2465fb6c683838f3e03da55f65eca0a)
dbjdbjCollaborators
Sep 23 Pushed 1 commits:b71307a0-fix(test): Configure auto_mix_partition per kernel in dualdst test
dbjdbjCollaborators
Sep 23 Pre merge succeeded (commit_id: 106437568692ad31d575221bbcc762e2940c6350)
CANN-robotCANN-robotCollaborators
Sep 23 Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
Sep 23 Added label: cann-cla/yes
dbj
dbjCollaborators
Sep 23 Comments:

/compile

likedislike
dbjdbjCollaborators
Sep 23 Pre merge succeeded (commit_id: 8eede25e8287d15c791d35cbdfa4d517a7db6ca2)
CANN-robot
CANN-robotCollaborators
Sep 23 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 23 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 23 Added label: ci-pipeline-failed
dbj
dbjCollaborators
Sep 23 Comments:

/compile

likedislike
CANN-robot
CANN-robotCollaborators
Sep 23 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 23 Removed label: ci-pipeline-failed
5 event messages are collapsed here。 See more
dbjdbjCollaborators
Sep 23 Resolved final issue
liulun0308
liulun0308Collaborators
Sep 23 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 23 Added label: approved
zhangyuebing
zhangyuebingCollaborators
Sep 23 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Sep 23 Added label: lgtm
CANN-robotCANN-robotCollaborators
Sep 23 Merged pull request