| Files | Last commit | Last update |
|---|---|---|
feat(operation): Support A6 vector operations Co-authored-by: bynshard<zhangbingshuai@huawei.com> # message auto-generated for no-merge-commit merge: !7173 merge A6-vec into master feat(operation): Support A6 vector operations Created-by: bynshard Commit-by: bynshard Merged-by: cann-robot Description: pypto 支持 A6 vector 操作 1. 主要修改了每个算子支持类型 2. 部分算子需要添加 A6宏 3. simt 类算子,dcache 大小重新配置 See merge request: cann/pypto!7173 | 8 days ago | |
fix(machine): Restore and Reloc dyn-CM freelist for CF-cache continue Co-authored-by: songyangyang18<songyangyang18@huawei.com> # message auto-generated for no-merge-commit merge: !7559 merge topo into master fix(machine): Restore and Reloc dyn-CM freelist for CF-cache continue Created-by: songyangyang18 Commit-by: songyangyang18 Merged-by: cann-robot Description: ## Summary Host CF-cache 录制装不下触发 Device **partial continue** 时,dyn-CM 的 CM.ptr 仍挂着 **Host 占槽地址**(不能当 Device freelist 条目还池/Reloc)。assemble 缓冲已 Restore,不再走 AllocateAssembleSlot,表也不会再分配 → PartialUpdateStitch 读空/野表 → AICPU SIGSEGV → **507018**。 本 PR:continue 后 **丢掉 Host CM.ptr**,用独立标记 **isDynamicCellMatchNeedAlloc**(与 isAssembleSlotNeedAlloc 解耦)驱动 Device 池 **TryAllocate 重占槽**;UpdateSlots 保持父提交 Prepare-only。 ## 问题背景 默认 stitch CF-cache 约 100M。Host 录制中途 StopRecording 后,Device 先 replay 已录段,再 **continue** live stitch。 continue 时: - slot / outcast / tensor freelist:仍 Restore + Reloc - assemble:**已有** rtOutcastIter → 不进 AllocateAssembleSlot - dyn-CM:CM.ptr 来自 Host 录制,**不是** Device 池槽;不能 Deallocate / 迁 freelist 父提交(0bdb466e6)上 eb_probe_assemble_memory(l=100000)稳定 **507018**。 ## 修复方案 text continue (DuppedRootUpdateAndCachedAllSubmitted) ├─ RuntimeAddrRestore / RelocWorkspace // tensor 侧不变 ├─ for outcast: CM.ptr = {} // 不接 Host 占槽;不 Deallocate └─ for dyn partial (mask≠NONE): isDynamicCellMatchNeedAlloc = true 后续 root · ResolveOutcast ├─ assemble NeedAlloc → AllocateAssembleSlot // 仅 tensor ├─ output / assemble → TryAllocate // 只认 isDynamicCellMatchNeedAlloc └─ Stitch → UpdateSlots // Prepare-only(size==0 && Data!=nullptr) | 标记 | 管什么 | |------|--------| | isAssembleSlotNeedAlloc | assemble **tensor 缓冲** | | isDynamicCellMatchNeedAlloc | dyn-CM **表槽**(Fill 首次 / continue 置位;分配后清) | 要点: - **不**对 dyn-CM 做 CF freelist Backup/Restore/Reloc - 清 CM.ptr **不**走 Device Deallocate(地址属 Host 录制生命周期) - TryAllocate **只认 flag**;调用方不再叠 partial∧mask 门禁 - view 由 TryAllocate 覆盖;UpdateSlots 不 Allocate、不按 CM.ptr 重绑 ## 涉及文件 | 文件 | 变更 | |------|------| | device_execute_context.cpp | continue:清 CM.ptr + 置 isDynamicCellMatchNeedAlloc | | device_slot_context.cpp | Fill/MarkPartialUpdateSlots:首次 Data 空时置 need-alloc | | dev_encode_program_ctrlflow_cache.h | 新增 isDynamicCellMatchNeedAlloc | | dev_workspace.cpp | AllocateAssembleSlot 仅 tensor;Resolve 上 TryAllocate 只认 flag | | test_ctrlflow_cache_dyn_cm.cpp | 2 条 UT:flag 门禁 + continue 清 ptr/置位 | ## 验证 同机同卡对比 eb_probe_assemble_memory(xrunfk -i=test_cases/machine/error_branch_F7.json -s=40 -e=40,case_idx=41,l=100000): | 版本 | 结果 | |------|------| | 父提交 0bdb466e6 | **507018**,精度 FAILED | | 本修复 | **精度 PASS**,无 507018 | UT:CtrlFlowCacheDynCmUt.* 2/2 PASS。 See merge request: cann/pypto!7559 | 2 days ago | |
fix(config|frontend): Refresh JIT options when global config changes Co-authored-by: zhaojunhan<zhaojunhan1@huawei.com> # message auto-generated for no-merge-commit merge: !7567 merge fix/jit-config-refresh into master fix(config|frontend): Refresh JIT options when global config changes Created-by: nanguag Commit-by: zhaojunhan Merged-by: cann-robot Description: ## 问题 同一个 JIT kernel 在不同静态 shape 下重新编译时,可能继续使用首次创建 KernelModule 时读取的配置: - 全局 compile_monitor_enable 从 2 改为 0 后,后续编译仍输出监控信息。 - 全局 runtime_debug_mode 按 3 → 0 → 3 切换时,dump 开关未随配置变化。 ## 修改 - 每次调用 JIT kernel 时读取当前全局配置,刷新未在 @pypto.jit 中显式指定的 compile_monitor_enable 和 runtime_debug_mode;JIT 显式参数保持更高优先级。 - 将这两个配置值纳入 KernelModule 缓存键,使配置变化后创建使用新配置的模块。 - 移除三个 dump 入口对 runtime_debug_mode 首次读取结果的静态缓存。 ## 验证 使用不同静态 shape 触发重新编译: - Host DFX 用例:compile_monitor_enable 从 2 改为 0,监控输出从 178 行降为 0 行,2/2 断言通过。 - Debug DFX 用例:runtime_debug_mode 按 3 → 0 → 3 切换,三次编译分别产生 7、0、7 个 dump 文件,3/3 断言通过。 在当前测试环境中,需设置 PTO_TILE_LIB_CODE_PATH=/home/zjh/pto-isa,以使用与 PyPTO 匹配的 PTO 头文件。 ## 性能 固定 shape、复用已编译 kernel 的测量显示:刷新配置使 Python 调用路径增加约 8 µs/次;完整 NPU 调用观察到约 15 µs/次的差值,其中包含设备调度波动。 See merge request: cann/pypto!7567 | 10 days ago | |
refactor(dist): Fold window memory registration and connect into create_window Co-authored-by: tsungl4<lidongsheng4@huawei.com> # message auto-generated for no-merge-commit merge: !7776 merge channel1 into master refactor(dist): Fold window memory registration and connect into create_window Created-by: tsungl4 Commit-by: tsungl4 Merged-by: cann-robot Description: The previous window setup required a strict 3-step protocol (create_window -> register_memory -> connect), which was easy to misuse: a temporary tensor passed to register_memory could be garbage-collected while the window still referenced its address, region names had to be kept identical across ranks by hand, a not-yet-connected window had to be rejected at launch time, and the jetty table was allocated and copied to device even when no region used the URMA plane (kernels never touch it there). This PR simplifies the flow to a single collective call and skips the useless jetty work. See merge request: cann/pypto!7776 | 2 days ago | |
feat(machine): Support for 9201 Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !6940 merge dev-adapt-next into master feat(machine): Support for 9201 Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 适配 9201 特性 See merge request: cann/pypto!6940 | 15 days ago | |
fix(machine): TryAllocate dyn-CM on incast when need-alloc flag is set Co-authored-by: songyangyang18<songyangyang18@huawei.com> # message auto-generated for no-merge-commit merge: !7785 merge topo into master fix(machine): TryAllocate dyn-CM on incast when need-alloc flag is set Created-by: songyangyang18 Commit-by: songyangyang18 Merged-by: cann-robot Description: ## 问题 Host Control-Flow Cache 录制装不下、触发 Device **partial continue** 时,动态 Cell Match(dyn-CM)表仍可能挂着 **Host 侧地址**。Device 上若继续按该指针做 stitch / 还池,会出现: - AICPU **SIGSEGV**( PartialUpdateStitchConsumer 解引用空/野表) - 或 freelist / Reloc 异常(如 **507018**) 典型复现:op_combo_matrix case174(op_combo_cv_2v2c_waw_single_conv_s3_tail_eager,stitch_function_max_num=2)。 ## 原因 1. **Fill 清表(预期行为)** Device 启动 FillInputOutputSlot 时,将落在 devProg 镜像外的 Host dyn-CM Data 清成 nullptr,避免把 Host 地址当 Device 指针使用。 2. **表与 assemble tensor 生命周期解耦后的缺口** 引入独立标记 isDynamicCellMatchNeedAlloc 后,TryAllocate **只认 flag**;AllocateAssembleSlot 只负责 tensor,不再顺带分配 dyn-CM。 Fill / continue 在 Data()==nullptr 时置 flag,期望由后续 **outcast Resolve** 调用 TryAllocate 从 Device 池重占槽。 3. **Consumer 可能先于 outcast 分配到达** 单次 root 顺序为:AssignIncast → AssignOutcast(此处才 TryAllocate)→ **Stitch(先 Consumer 读表)** → UpdateSlots。 若 live root **只 incast 读**该 slot,本拍不会走对该 slot 的 outcast Resolve → flag 已置上但 **从未 TryAllocate** → PartialUpdateStitchConsumer 读到 Data()==nullptr → SEGV。 父提交能避开该洞,是因为 AllocateAssembleSlot(incast 常会先触达)内部仍会 TryAllocate;本设计把分配从 assemble 拆出后,调用点未覆盖「纯 consumer 先读」路径。 > 说明:仅在 consumer 对空指针 return 0 **不足以**替代分配——case174 上可消除 SEGV,但精度失败。后续 Prepare / UpdateSlots 填表依赖非空 Data 缓冲。 ## 修复方法 1. **独立 need-alloc 标记(与 assemble NeedAlloc 解耦)** - Fill / MarkPartialUpdateSlots:Data()==nullptr 且需 partial stitch → isDynamicCellMatchNeedAlloc = true - CF-cache continue(Restore + Reloc 之后):同样按 Data()==nullptr 置 flag - TryAllocateDynamicCellMatchForAssembleSlot:**只认 flag**;分配成功后清 flag 2. **分配调用点** - output / assemble **outcast Resolve**:flag 为真时 TryAllocate(既有) - **incast**(AssignIncastAddresses,rtOutcastIter 已有效之后):同样调用一次 flag 门闩的 TryAllocate - 覆盖「consumer 先于任何 outcast Resolve 读表」的洞 - 门闩仍是 flag:无 need-alloc 时为空操作 - 不把「表内容由 outcast producer 填写」的语义改成由 incast 生产;此处只保证 Device 侧表缓冲在 Stitch 前存在,便于后续 Prepare / 填表与安全读表 3. **刻意不做** - continue 后不对 CM.ptr 做 bulk clear(由 TryAllocate 覆盖写入) - UpdateSlots 保持 Prepare-only,不按 CM.ptr 重绑 See merge request: cann/pypto!7785 | 2 days ago | |
feat(machine): Optimize left pingpong Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !6866 merge fix-ctrlflow-pypto-page-align into master feat(machine): Optimize left pingpong Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: ## Summary 控制流 cache 重放头两处优化:Mix wrap 队列 ping-pong,以及 DRCO ready-queue shadow 与 metadata predcount ping-pong。 PushTask 前不再整段重建这两块。 ## 1. Mix wrap 队列 ping-pong ### 原来的缺点 readyWrapCoreFunctionQue 的 elem 会被调度改掉。旧路径在 PushTask 前 MixTaskDataRestore 整段 memcpy,串在所有核前面。opWrapList / wrapIdNum 录制后只读,却和队列元素捆在同一次恢复里。 ### 现在的做法 录制 MixTaskDataBackup 留下: | 字段 | 含义 | |---|---| | queue.elem | 不可变快照,只作 restore 源 | | queue.head/tail/capacity | 录制时刻游标 | | pingElem / pongElem | 两块工作缓冲;pong OOM 时回退 in-place memcpy | | opWrapList / wrapIdNum | backup 写一次;Swap 时仍写回 live(sche 依赖) | 重放: 1. **头**(须在 ReadyQueue swap **之前**):MixTaskDataPingPongSwap。回退路径 DrcoReadyQueueDataRestore 会读 wrap 队列,必须先干净。 2. **退出** MixTaskDataPingPongRestore:把快照 memcpy 进当前未挂载的那一块。 旧 API MixTaskDataRestore 已删除。 ## 2. DRCO 重放 ping-pong ### 原来的缺点 enableAicoreResolve 时,每次重放都在 PushTask 前做两件事:DrcoPredCountDataRestore 重填 metadata predcount,以及 DrcoReadyQueueDataRestore + DrcoRootFuncListRestorePrecount 按 ready queue 重新铺 per-core pending / local ready。Die ready queue 的 swap 还会再往 per-core 队列灌一次。 ### 现在的做法 录制结束 BackupDrcoReplayShadow 为下列结构各留 canon(不可变快照)、ping(录制时的 live)、pong(第二份工作副本): - per-core pending - local ready queue / local ready matrix - stitch node matrix / hub task matrix metadata predcount 另留 drcoPredCountImage,以及 ping/pong 两个 offset;选中的 offset 写在 funcDynamicDataOffset 低 32 位。 重放: 1. **头** DrcoPredCountPingPongSwap:把 funcDynamicDataOffset 切到另一块 predcount。 2. **头** ReadyQueueDataPingPongSwap:shadow 已就绪(drcoShadowReady)时改走 DrcoShadowPingPongSwap,只交换指针并 RestorePrecount。shadow 未就绪(backup OOM)时仍回退 DrcoReadyQueueDataRestore。 3. Die ready queue 只交换自己的 elem,不再向 per-core 队列重灌;那份镜像由 DRCO shadow swap 负责。 4. **退出** DrcoShadowPingPongRestore / DrcoPredCountPingPongRestore:把 canon / image memcpy 进当前未挂载的那一块。 ## Ping-pong 的数据 录制发生在 PushTask 之前。此时 per-core pending 已经按 wrap、AIC、AIV 和 die 队列派发完;local ready、local matrix、stitch、hub 还是分配时的空表。影子把这个初态 memcpy 成 canon 和 pong,重放只换指针。launch 结束后把 canon 再 memcpy 进没挂上的那一块,下一轮换上来仍是初态。 和主线 DrcoReadyQueueDataRestore 的对应: | 数据 | 作用 | 主线重放 | 影子 | |---|---|---|---| | per-core pending | 每个核开跑时直接执行的初始 leaf 列表 | 先把 head/size 清 0,再按 wrap、AIC、AIV 重入队,die swap 再补 die 任务 | memcpy 录制时已经派发好的队列,换指针。内容与重入队相同,不再重灌 | | local ready queue | 矩阵放不下的后继就绪队列,AIC/AIV/MIX 各一组 | head/tail 置 0,任务区 memset 0 | 录制时空表,memcpy 后换指针,等价于清零 | | local ready matrix | 按消费者行投放刚解开的后继 | rowList memset 0 | 同上 | | stitch node matrix | 跨核帮忙展开的 stitch 槽,空槽为 0 | stitchNodeList memset 0 | 同上 | | hub task matrix | hub 溢出和类型越界的兜底任务槽,空槽为 0 | hubTaskList memset 0 | 同上 | | metadata predcount | AICore 使用的 int32 前驱计数 | 从 uint16 backup 逐项写回当前缓冲 | drcoPredCountImage 加一块 pong,切换 funcDynamicDataOffset。pong 没申请到时仍逐项写回 | | mix wrap elem | mix 任务的 AIC/AIV 包装,DrcoReadyQueueDataRestore 回退路径会读它 | 整段 memcpy 回 live elem | ping/pong 换指针;pong 申请失败时仍 memcpy | 不进影子、两边都直接写的字段: - readyMatrixPushCol:每轮写 0,后继行游标从 0 开始。 - staticExecCount 和完成 flag:DrcoRootFuncListRestorePrecount 写回录制时的预计数。 - shardExecCount:设备运行时的动态分片计数。主线每轮清 0;影子换指针不管这块,所以交换后同样清 0。 - devTaskFinished:每轮写 0。 没有做 ping-pong 的: - middleQueue:队列内容只读,设备不写回 GM,沿用 slab 镜像。 - bitmap:仍是原来的 BitmapDataRestoreTask,full cache 只恢复一次。 - AIC/AIV ready queue 和 die ready queue 的 elem ping-pong 是更早的改动,这次只让 die swap 在影子成功时不再往 per-core 重灌。 影子申请失败时 drcoShadowReady 保持 0,重放退回 DrcoReadyQueueDataRestore,die 任务仍按主线补进 pending。 ## 重放头顺序 text for each deviceTask: RelocIncastOutcastTask PredCountPingPongSwap [enableAicoreResolve] DrcoPredCountPingPongSwap [!fullCache || !bitmapRestoreDone] BitmapDataRestoreTask MixTaskDataPingPongSwap // before ReadyQueue ReadyQueueDataPingPongSwap // publishes DRCO shadow when ready DieReadyQueuePingPongSwap PushTask 优化前后头开销对比:  See merge request: cann/pypto!6866 | 1 month ago |
| Files | Last commit | Last update |
|---|---|---|
| 8 days ago | ||
| 2 days ago | ||
| 10 days ago | ||
| 2 days ago | ||
| 15 days ago | ||
| 2 days ago | ||
| 1 month ago |