| Files | Last commit | Last update |
|---|---|---|
style(all): Apply additional clang-format corrections across codebase Co-authored-by: junjieHuang<huangjunjie38@h-partners.com> # message auto-generated for no-merge-commit merge: !4883 merge style-cpp into master style(all): Apply additional clang-format corrections across codebase Created-by: junjieHuang Commit-by: junjieHuang Merged-by: cann-robot Description: Apply additional clang-format corrections across codebase See merge request: cann/pypto!4883 | 4 months ago | |
feat(Machine): Add FedProf and AicpuProf for machine profiling Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !6980 merge pgo-framework into master feat(Machine): Add FedProf and AicpuProf for machine profiling Created-by: yinjie27_ Commit-by: Jie Yin Merged-by: cann-robot Description: feat(Machine): Add FedProf and AicpuProf for machine profiling Rework the machine-side profiling data path around a unified host profiler (FedProf). The old free-function dump machinery is replaced by a class-owned design; profiling buffers are allocated once at device init and addressed directly through DeviceArgs, so device cores no longer rely on the sharedBuffer slot to locate their per-core prof data. Changes: - Add the FedProf singleton: owns per-core prof buffers, the AICPU launch-round prof buffer, the dump thread and JSON dumping; split into fed_prof.{h,cpp}, fed_prof_aicpu_prof.cpp and fed_prof_io_json.{h,cpp}; remove dump_device_perf.* and runtime/runner/device_perf.* - Add DeviceArgs::perCoreProfAddr / aicpuProfAddr; per-core prof slots are addressed as perCoreProfAddr + idx * FED_PROF_PER_CORE_PROF_ALIGNED_SIZE, and aicore entry/dfx/drco, the AICPU task manager, AICoreHAL and the ESL model are updated accordingly; SHAK_BUF_PER_CORE_PROF_INDEX is removed - Allocate per-core prof data as a single contiguous 512B-aligned block at device init (DeviceDfx::Init -> FedProf::PerCoreProfAllocateData), gated by DUMP_DEVICE_PERF / HostProf / runtime debug mode, idempotent and released together with the AICPU prof buffer - Add AICPU launch-round profiling (FedProfAicpuProf): dump thread, swimlane JSON and machine_perf_trace.py integration, output via KEY_AICPU_PERF_GRAPH_PATH - Reorganize device headers: add aikernel_profile.h (prof structures and sizes) and aikernel_launch.h (KernelArgs/KernelSharedBuffer/TaskEntry/ParallelDevTask moved out of aicpu_common.h); rename aicpu_perf.h to aikernel_profile_aicpu.h and update the CMake install list - Update UT/ST cases, the ESL model hook and launcher call sites to the new interfaces Commits: - feat(Machine): Add FedProf as the profiler - feat(Machine): Add AicpuProf for profiling - feat(Machine): Normalize AicpuProf - feat(Machine): Normalize profiling allocation See merge request: cann/pypto!6980 | 1 month ago | |
feat(machine): Add new memory pool for dupped_stitch Co-authored-by: duanhaotian<duanhaotian@huawei.com> # message auto-generated for no-merge-commit merge: !6534 merge duanhaotian18 into master feat(machine): Add new memory pool for dupped_stitch Created-by: duanhaotian Commit-by: duanhaotian Merged-by: cann-robot Description: text Host 编码 CalcStitchWorkspace 共享 stitch 池,不再含 << 4 CalcDuppedStitchWorkspace 独立池 = 页大小 << 2 memBudget.metadata.duppedStitchPool / duppedStitchSlabSize | Launch FillDeviceRuntimeOffset 在 stitch 池之后铺 duppedStitchPoolOffset DevStartArgs 填 duppedStitchPoolAddr = runtime 基址 + offset | Device 初始化 InitMetadataAllocators InitAicpuDuppedStitchSlabAllocator 只注册 WsAicpuSlabMemType::DUPPED_STITCH | 运行中 AllocateStitch -> SlabAlloc(DUPPED_STITCH) -> duppedStitchSlab.Alloc Alloc 成功:allocatedObjCount++,unPopAllocatedObjCount++,挂上 stage 链表 | 切窗 活节点达到 80% SubmitToAicoreAndRecycleMemory SlabGetStageAllocMem -> PopStageAllocMem objCnt = 本窗 unPopAllocatedObjCount 记入 DynDeviceTask.taskStageAllocMem.duppedStitchStageMem | 回收 DeviceTaskMemTryRecycle FreeStageAllocMem:allocatedObjCount -= objCnt,节点回到 freeList 针对 slab metadata 共享内存池中的 type 间资源侵占问题,当前已有的问题中主要导致侵占的元数据是不可评估的DUPPED_STITCH,另外,当前因为DUPPED_STITCH不易评估因此预留了较大的内存池,针对这类不可评估的元数据问题考虑的方案是独立内存池并在即将使用完时直接submit | 算子 |pre ringbuffer | after ring buffer| 减少 | 降幅 | pre metadatasize | after metadatasize | metadata减少 | |---|---:|---:|---:|---:|---:|---:|---:| | glm_attention low_latency | 126,395,688 (120.54 MiB) | 76,168,744 (72.64 MiB) | 50,226,944 (47.90 MiB) | 39.7% | 31,598,904 | 19,042,168 | 12,556,736 | | glm_attention high_throughput | 138,460,904 (132.04 MiB) | 88,270,824 (84.18 MiB) | 50,190,080 (47.87 MiB) | 36.2% | 34,615,216 | 22,067,696 | 12,547,520 | | flash_attention_mha pre_training | 123,784,616 (118.05 MiB) | 73,551,528 (70.14 MiB) | 50,233,088 (47.91 MiB) | 40.6% | 30,946,136 | 18,387,864 | 12,558,272 | | interleave_rope low_latency | 103,559,208 (98.76 MiB) | 53,270,824 (50.80 MiB) | 50,288,384 (47.96 MiB) | 48.6% | 25,889,784 | 13,317,688 | 12,572,096 | See merge request: cann/pypto!6534 | 1 month ago | |
fix(machine): Add metadata memory usage print Co-authored-by: duanhaotian<duanhaotian@huawei.com> # message auto-generated for no-merge-commit merge: !7289 merge duanhaotian into master fix(machine): Add metadata memory usage print Created-by: duanhaotian Commit-by: duanhaotian Merged-by: cann-robot Description: 新增元数据运行时使用率打印,每一轮devicetask下发时,打印每一类元数据的当前使用量,总评估量,地址分布 See merge request: cann/pypto!7289 | 24 days ago | |
fix(machine): fix mismatch and incomplete error descriptions in machine and misc files Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5806 merge pyptolog_fix3 into master fix(machine): fix mismatch and incomplete error descriptions in machine and misc files Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine 日志内容整改 See merge request: cann/pypto!5806 | 2 months ago | |
refactor(build): Replace hardcoded paths with CMake imported targets Co-authored-by: wangmingjun<wangmingjun13@huawei.com> # message auto-generated for no-merge-commit merge: !5147 merge header-deps into master refactor(build): Replace hardcoded paths with CMake imported targets Created-by: hwwangmingjun Commit-by: wangmingjun Merged-by: cann-robot Description: 为实现全量源码构建场景(issue #2573),将 CMake 构建系统中对 cann-toolkit 头文件、库文件的硬编码路径依赖(ASCEND_CANN_PACKAGE_PATH) 替换为 CMake imported targets,通过 find_cann_package 查找 acl_rt、ascend_hal、hcomm/hccl、runtime、atrace、slog 等依赖。 Changes: - 顶层 CMakeLists.txt 增加 acl_rt、ascend_hal、hcomm、hccl、runtime 的 find_cann_package 调用,并处理 hcomm_headers 别名 - cmake/device/CMakeLists.txt 增加 ascend_hal、atrace、hcomm/hccl、slog 的依赖查找 - adapter/machine/device 各 CMakeLists.txt 移除硬编码 include/link 目录,改用 target_link_libraries 引用 imported targets - c_sec 安装改用 $<TARGET_FILE> 生成表达式,头文件安装改用 $<TARGET_PROPERTY> - version.cmake 增加 runtime、hcomm 的构建依赖声明 Related Issues: #2573 See merge request: cann/pypto!5147 | 3 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 |
| Files | Last commit | Last update |
|---|---|---|
| 4 months ago | ||
| 1 month ago | ||
| 1 month ago | ||
| 24 days ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 1 month ago |