Pull Request has been successfully merged by CANN-robot.
(Thank you for lidongsheng's contribution.)变更摘要
本 PR 改变了 outcast 的生成语义:此前同一个 raw tensor(同一个 slot)的多次 assemble 只会保留"最新"的一个 outcast 版本,现在改为保留该 slot 的每一个 assemble 版本作为独立的 outcast 条目,且同一组版本共享第一个版本的 outcast 缓冲区(运行时同一个 slot、每个 assemble 写对应一个 outcast 条目),并让 outcast 参数与对应版本的 slot 通过 TensorSlotManager::SetSameSlot 关联,解决多版本写入同一 slot 时的 WAR(写后读)冲突问题。核心改动分布在 Function::MakeOutcasts/CreateOutcastTensor、RootFunctionBuilder::ComputeOutcast/FinalizePathFunc、TensorSlotManager::SetSameSlot/Dump,并新增 Python 侧 GetSlotInfo 接口及相应测试。
主要改动
-
MakeOutcasts/CreateOutcastTensor支持多版本 outcast:CreateOutcastTensor新增shareRaw与name参数;MakeOutcasts先快照原始 raw tensor 并按rawmagic分组,组内后续版本复用第一个版本的 outcast 缓冲区(outSymbol->tensor = shareRaw),同时保留各自的版本名,并对origin与outSymbol调用SetSameSlot使 outcast 参数解析到对应版本的 slot id。 -
ComputeOutcast由"按 raw magic 去重保留最新"改为"保留全部版本":先收集所有被消费/函数输出/IsGetTensorDataOutcast的 operand 的rawMagic,再遍历 op 把所有命中 raw magic 的 operand 都通过AddOriginOutcast注册为 origin outcast;FinalizePathFunc中还为共享同一 raw tensor 的 outcasts 建立同 slot 关联。 -
SetSameSlot合并逻辑改为顺序无关、保留较早 slot:当srcTensor->Id() > dstTensor->Id()时交换二者,使先创建的 slot tensor(参数先入槽)保持规范,已捕获到 ioslot 列表中的 id 依然有效;Dump改为对 (index, slot) 对排序输出,以适配 slot index 即 tensor id、可能超出条目数的情况。 -
新增 Python 接口与类型桩更新:绑定层新增
GetSlotInfo(返回{tensor name: slot id},同名 slot 共享运行时缓冲)并补充.pyi桩;Program.functions由list[Function]调整为按函数名索引的dict[str, Function]。 -
测试重构与新增用例:
test_common.py抽取_run_pass_pipeline/run_root_function公共流程;新增test_issue_2912.py验证 unroll 后多个out版本共享同一 out slot;原test_assemble_latest_outcast.pypto更名为test_assemble_all_versions.pypto,相关.py/.pypto黄金文件更新为"每个 assemble 版本均保留为 outcast 条目且共享一个 slot"的期望结果。


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 |
|---|---|---|
| framework/src/interface/function | ✅ gaoxiang618, 尹杰 (2/2) | ✅ gaoxiang618, 尹杰 (2/1) |
| framework/src/interface/tensor | ✅ gaoxiang618, 尹杰 (2/2) | ✅ gaoxiang618, 尹杰 (2/1) |
| python/pypto/pypto_impl | ✅ 尹杰, gaoxiang618 (2/2) | ✅ 尹杰 (1/1) |
| repo-cann/pypto | ✅ gaoxiang618, 尹杰 (2/2) | ✅ gaoxiang618, 尹杰 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


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


/approve


/approve
/lgtm


Related Issue: #2559