| Files | Last commit | Last update |
|---|---|---|
fix(machine): Split runtime headers and use secure bundle functions Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !6428 merge fix/master_cleancode into master fix(machine): Split runtime headers and use secure bundle functions Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: cleancode 超大头文件、不安全函数修改 See merge request: cann/pypto!6428 | 2 months 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 | |
feat(machine): Support offline compilation and packaging Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !4974 merge jd into master feat(machine): Support offline compilation and packaging Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 支持离线打包二进制 See merge request: cann/pypto!4974 | 3 months ago | |
fix(machine): Align bundle host control-flow cache Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !7265 merge fix/bundletestbug into master fix(machine): Align bundle host control-flow cache Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: bundle加载cache时,将其复制到vector<uint_8>,未保证64字节对齐,导致偶现未对齐段错误情况,现改为使用已有的CtrlFlowCacheBlob确保对齐 源码:using CtrlFlowCacheBlob = std::vector<uint8_t, npu::tile_fwk::AlignedAllocator<uint8_t, 0x40>>; See merge request: cann/pypto!7265 | 26 days ago | |
fix(machine): Align bundle host control-flow cache Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !7265 merge fix/bundletestbug into master fix(machine): Align bundle host control-flow cache Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: bundle加载cache时,将其复制到vector<uint_8>,未保证64字节对齐,导致偶现未对齐段错误情况,现改为使用已有的CtrlFlowCacheBlob确保对齐 源码:using CtrlFlowCacheBlob = std::vector<uint8_t, npu::tile_fwk::AlignedAllocator<uint8_t, 0x40>>; See merge request: cann/pypto!7265 | 26 days ago | |
feat(machine): Support offline compilation and packaging Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !4974 merge jd into master feat(machine): Support offline compilation and packaging Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 支持离线打包二进制 See merge request: cann/pypto!4974 | 3 months ago | |
fix(machine): Align bundle host control-flow cache Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !7265 merge fix/bundletestbug into master fix(machine): Align bundle host control-flow cache Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: bundle加载cache时,将其复制到vector<uint_8>,未保证64字节对齐,导致偶现未对齐段错误情况,现改为使用已有的CtrlFlowCacheBlob确保对齐 源码:using CtrlFlowCacheBlob = std::vector<uint8_t, npu::tile_fwk::AlignedAllocator<uint8_t, 0x40>>; See merge request: cann/pypto!7265 | 26 days ago | |
fix(machine): Align bundle host control-flow cache Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !7265 merge fix/bundletestbug into master fix(machine): Align bundle host control-flow cache Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: bundle加载cache时,将其复制到vector<uint_8>,未保证64字节对齐,导致偶现未对齐段错误情况,现改为使用已有的CtrlFlowCacheBlob确保对齐 源码:using CtrlFlowCacheBlob = std::vector<uint8_t, npu::tile_fwk::AlignedAllocator<uint8_t, 0x40>>; See merge request: cann/pypto!7265 | 26 days ago | |
fix(machine): Align bundle host control-flow cache Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !7265 merge fix/bundletestbug into master fix(machine): Align bundle host control-flow cache Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: bundle加载cache时,将其复制到vector<uint_8>,未保证64字节对齐,导致偶现未对齐段错误情况,现改为使用已有的CtrlFlowCacheBlob确保对齐 源码:using CtrlFlowCacheBlob = std::vector<uint8_t, npu::tile_fwk::AlignedAllocator<uint8_t, 0x40>>; See merge request: cann/pypto!7265 | 26 days ago | |
fix(machine): Align bundle host control-flow cache Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !7265 merge fix/bundletestbug into master fix(machine): Align bundle host control-flow cache Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: bundle加载cache时,将其复制到vector<uint_8>,未保证64字节对齐,导致偶现未对齐段错误情况,现改为使用已有的CtrlFlowCacheBlob确保对齐 源码:using CtrlFlowCacheBlob = std::vector<uint8_t, npu::tile_fwk::AlignedAllocator<uint8_t, 0x40>>; See merge request: cann/pypto!7265 | 26 days ago | |
feat(machine): Support offline compilation and packaging Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !4974 merge jd into master feat(machine): Support offline compilation and packaging Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 支持离线打包二进制 See merge request: cann/pypto!4974 | 3 months ago | |
refactor(machine): Remove DeviceRunner and redistribute init flow Co-authored-by: wan_jianfen<wanjianfen@hisilicon.com> # message auto-generated for no-merge-commit merge: !5426 merge refactor/remove-device-runner into master refactor(machine): Remove DeviceRunner and redistribute init flow Created-by: wan_jianfen Commit-by: wan_jianfen Merged-by: cann-robot Description: refactor(machine): Remove DeviceRunner and redistribute init flow DeviceRunner was a god-class singleton that mixed device init, HostProf management, DevicePerf management, stream synchronization, and AiCpu .so loading. This PR dissolves it entirely, redistributing each responsibility to its natural module. Changes: - Move init flow (InitDeviceArgs / InitDeviceArgsCore / GetAicoreRegs / InitAiCpuSoBin / SetAiCpuSoOverride) into KernelBinary with static g_deviceArgs + std::call_once guard (EnsureInitialized / InitMetaData / GetEnableDumpDevPref) - Move HostProf methods (SetHostProfFunction / GetHostProfType / ReportHostProfInfo) into HostProf::GetInstance() singleton - Move DevicePerf methods (ResetPerData / SyncProfData / SetDebugEnable) into DevicePerf::GetInstance() singleton - Move DynamicLaunchSynchronize into DeviceLauncher - Move KernelLaunchInfo struct into device_launcher_types.h - Delete device_runner.h and device_runner.cpp - Update all call sites: device_launcher.cpp, kernel_bundle_launch.cpp, pypto_bundle_api.cpp, test_dev_func_runner.h, UT files - Remove device_runner.h from CMakeLists.txt install list Related Issues: #2967 See merge request: cann/pypto!5426 | 3 months ago | |
feat(machine): Support offline compilation and packaging Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !4974 merge jd into master feat(machine): Support offline compilation and packaging Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 支持离线打包二进制 See merge request: cann/pypto!4974 | 3 months ago | |
feat(machine): Support offline compilation and packaging Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !4974 merge jd into master feat(machine): Support offline compilation and packaging Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 支持离线打包二进制 See merge request: cann/pypto!4974 | 3 months ago | |
fix(machine): Report queued errors on bundle launch failure Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !6167 merge fix/bundle_aicore_exception into master fix(machine): Report queued errors on bundle launch failure Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 原离线路径遇到DeviceSynchronize失败只返回rc值而不触发异常信息队列的打印,导致单算子复现aicore异常部分场景info.txt中无异常日志。 现在bundlelaunch结尾检测rc值并显式调用OutputErrorMessage将首条异常信息打印 See merge request: cann/pypto!6167 | 2 months ago | |
fix(machine): export std::any<long> manager for bundle cross-DSO type identity Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !6018 merge longlong into master fix(machine): export std::any<long> manager for bundle cross-DSO type identity Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 运行时配置以 std::any 存储在 libtile_fwk_interface.so 中,并在 libtile_fwk_bundle.so 中通过 AnyCast<int64_t> 读取。 tile_fwk_bundle.version 中的 local: * 将 bundle 内的 std::any<long> manager 符号本地化,导致 interface 和 bundle 使用不同地址的 manager。 当前 libstdc++ 实现通过 manager 地址判断 std::any 类型,因此将相同的 long 误判为不同类型。 在 bundle 版本脚本中精确导出 std::any<long> manager: _ZNSt3any17_Manager_internalIlE9_S_manage*; 使动态链接器能够统一 interface 和 bundle 中的 manager 符号。 See merge request: cann/pypto!6018 | 2 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 2 months ago | ||
| 1 month ago | ||
| 3 months ago | ||
| 26 days ago | ||
| 26 days ago | ||
| 3 months ago | ||
| 26 days ago | ||
| 26 days ago | ||
| 26 days ago | ||
| 26 days ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 2 months ago |