Pull Request has been successfully merged by CANN-robot.
(Thank you for LiuChang's contribution.)变更摘要
该 PR 修复了 PIL(Python 中间层)中 dotted slot(带点号的槽位,如 d.a)在循环携带(loop-carry)场景下导致的崩溃问题。核心改动位于 python/pypto/pil/pir.py 的 Scope 类赋值逻辑:当槽位当前值和新赋的值都是 pypto.Tensor 时,不再用 setattr 整体替换对象,而是通过 Journal.record(current) 记录旧 tensor 后调用 current.set_logical_tensor(value.logical_tensor()) 进行原地更新,从而避免在循环迭代中因替换 dotted-slot 对象而崩溃;非 Tensor 场景仍保持原有「记录 + setattr」行为。配套更新了多个 .pypto IR 测试期望输出与 test_incr_fa.py 中的断言(PR 背景为同步主线修改)。
主要改动
- 修复
Scope的 dotted-slot 赋值逻辑(python/pypto/pil/pir.py):当getattr(obj, key)的当前值与新值均为pypto.Tensor时,改为Journal.record(current)后原地更新 logical tensor(current.set_logical_tensor(value.logical_tensor())),其余情况保持原有的Journal.record(obj, key)+setattr(obj, key, value)行为,修复循环携带变量导致的崩溃。 - 更新
test_attr_move1~test_attr_move7的 IR 期望输出:循环内的迭代变量由带点号名称(如%d.a_1、%e.a_0、%h.inner.c_0)改为匿名临时变量(如%$0_2、%$2_0),反映 tensor 原地更新后不再产生命名 dotted-slot 变量的新 IR 形态。 - 更新
python/tests/ut/ir/test_incr_fa.py断言:循环迭代变量名称断言由带点号的形式(如ctx.loop_tensors.attention_output_3、ctx.temp_update_tensors.max_update)改为不带点号的名称(如attention_output_19、max_update_1),与新的命名规则保持一致。


compile


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 |
|---|---|---|
| python/pypto/pil | ✅ tsungl4, DCGDDD (2/2) | ✅ tsungl4, DCGDDD (2/1) |
| repo-cann/pypto | ✅ DCGDDD, tsungl4 (2/2) | ✅ DCGDDD, tsungl4 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
seu_chang, thanks for your pull request. All authors of the commits have signed the CLA. 👍


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


compile


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


/approve


/lgtm
/approve


同步主线修改