已开启
fix(lint): Unify loop detection across OL43/OL23/OL56 for loop_unroll #584
fix(lint): Unify loop detection across OL43/OL23/OL56 for loop_unroll #584
已开启
lizixuan创建于 1 天前
lizixuan
lizixuan
1 天前

Closes #118 / Closes #116

说明:#116 与 #118 为同一问题的重复提交(同一作者、同一标题、同一内容,#116 创建更早),本 PR 的修复同时覆盖两者。

问题

unroll_list 是"能用、都在用、但文档不写"的参数,且 lint 三条规则对 loop 的识别口径互不相同:

  • OL43:文本正则 pypto.loop\\s\\*( 匹配不上 loop_unroll((被误拦),且 AST 兜底只看 jit_funcs[0]
  • OL23:AST 识别认 loop_unroll,但只查主 jit 入口函数——loop 写在同文件 helper 里就漏检。
  • OL56f.attr == "loop" 严格相等 → loop_unroll 逃逸单值 unroll_list 门禁。

修复(统一为 AST 级、口径一致)

  • OL43:删文本正则捷径,改对所有 jit 函数做 AST loop 检测。
  • OL23/OL43:新增 _has_loop_structure_with_helpers,跟随一层同文件 helper 委托(覆盖 loop-in-helper 形态)。
  • OL56_is_pypto_loop_for_node 接受 looploop_unroll,单值门禁对两条 API 一致生效。

文档(上游 pypto 仓,仓外)

pypto-loop.md kwargs 表补 unroll_list 参数说明及两条 API 分工——不在本仓,另立项。

验证

新增 5 个测试(loop_unroll 内联 OL43 PASS、loop in helper OL43/OL23 PASS、loop_unroll 多值 OL56 FAIL、单值 PASS);lint 267 个测试全部通过。

likedislike
合并受阻
lizixuanlizixuan
1 天前 创建了 pull request,commit e35e7446
lizixuanlizixuan
1 天前 关联了issue:[Bug-Report|缺陷反馈]: [断裂点]unroll_list 参数官方文档没写、lint 三条规则各认各的——写 loop_unroll 被硬拦,写 loop 靠猜
CANN-robotCANN-robot成员
1 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
1 天前 评论:

CLA Signature Pass

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

likedislike
CANN-robot
CANN-robot成员
1 天前 评论:

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

⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)

Module Approval Details

module lgtm status approve status
repo-cann/pypto-gym ❌ (0/2)(You can also ask: DCGDDD, wangzheng97, tsungl4, xinweiliu, jason_yuan_ye) ❌ (0/1)(You can also ask: DCGDDD, jason_yuan_ye, gaoxingwang, foundea, 尹杰)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
lizixuanlizixuan
1 天前 修改了pull request 的描述