| Files | Last commit | Last update |
|---|---|---|
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 | |
refactor(ci): Adapt common cmake build process. Co-authored-by: Feiteng Zheng<zhengfeiteng1@h-partners.com> # message auto-generated for no-merge-commit merge: !5145 merge 20260728-add-pre-package into master refactor(ci): Adapt common cmake build process. Created-by: zhengfeiteng Commit-by: Feiteng Zheng Merged-by: cann-robot Description: 适配通过cmake公共仓的build.sh拉起pypto编译,打出pypto的run包。该场景为“全量源码构建”的一个子场景。 - install命令添加COMPONENT参数,在通过cmake公共仓拉起多个子包编译时,用于区分不同子包的编译产物。 - add_pypto_device_project使用add_cann_device_project公共函数替换。 - ENABLE_UNIFIED_BUILD场景set_cann_cpack_config添加PRE_PKG参数,打包前调用pre_package.cmake脚本,打出whl包。 Related Issue: #2573 See merge request: cann/pypto!5145 | 3 months ago | |
fix(machine): Increase max resolve tasknum to 144 Co-authored-by: duanhaotian<duanhaotian@huawei.com> # message auto-generated for no-merge-commit merge: !4136 merge code0617 into master fix(machine): Increase max resolve tasknum to 144 Created-by: duanhaotian Commit-by: duanhaotian Merged-by: cann-robot Description: A5上总共72个AIV,考虑pending与runing的话,同时schedCpuNum=1的话,核用满,resloveCtx就需要144 See merge request: cann/pypto!4136 | 5 months ago | |
Normalized framework for pgo Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !7044 merge pgo-framework into master Normalized framework for pgo Created-by: yinjie27_ Commit-by: Jie Yin;LordOfMysteries Merged-by: cann-robot Description: # feat(machine): 重构 FedProf 为 Holder/Manager 实例化结构,并修复 CTRL 泳道只 dump 一轮的回归 ## 一、背景与问题 fed_prof(device 侧性能数据 dump)原实现是一个单例 FedProf:内部直接持有 perCoreProf_ / aicpuProf_ 两个裸 device 指针,dump 线程、轮次管理、JSON 序列化 全部堆在同一个类里;DeviceArgs 里也以 perCoreProfAddr / aicpuProfAddr 两个散落字段 传地址。新增一类 profile 需要同时改结构体、改分配逻辑、改 dump 分支,扩展成本高。 同时暴露出一个回归:DUMP_DEVICE_PERF=true 时 python/tests/st/test_ctrl_cpu_perf.py 断言 len(metrics) >= 30 失败,实际只解析出 **1 轮** CTRL 数据: AssertionError: expected >= 30 CTRL rounds, got 1 ... assert 1 >= 30 **根因链**: 1. DUMP_DEVICE_PERF=true ⇒ KernelBinary::GetEnableDumpDevPref() 恒为真, 于是**每次** LaunchKernel 都会走到 DeviceLauncher::SetDevPerfAddr()(device_launcher.cpp:658)→ FedProfManager::SetDebugEnable(); 2. SetDebugEnable() 每次都对**所有 core** 全量 memset per-core prof 元数据 (PerCoreProfResetMetadata()),把 device 侧 status.currLaunchRound 清零; 3. 而 currLaunchRound 只在 AICore 退出时 ++(aicore_entry_dfx.h:174), 因此连续 30 次 launch 后它仍然只有 **1**; 4. AicpuProfDumpSwimlaneCheck() 以 currLaunchRound 作为 dump 轮次上界 (fed_prof_manager_aicpu.cpp:101),FedProfLaunchAicpuDumpJson() 只遍历 [lastDumpRound, currLaunchRound)(fed_prof_io_json.cpp:181), 最终 dump 里只剩 round _0。 ## 二、改动总览 共 4 个提交,34 个文件。 ### 1. 数据结构:用 FedProfKind + 地址列表替代散落字段 framework/src/interface/machine/device/tilefwk/aikernel_profile.h - 新增 enum FedProfKind { FED_PROF_PER_CORE_PROF, FED_PROF_AICPU_PROF, FED_PROF_KIND_MAX } 与 struct FedProfDataBase {} 作为类型化基类; - FedProfPerCoreProf / FedProfAicpuProf 改为继承 FedProfDataBase。 framework/src/interface/machine/device/tilefwk/aicpu_common.h - DeviceArgs 中 perCoreProfAddr / aicpuProfAddr 两个字段合并为 uint64_t fedProfAddrList[FED_PROF_KIND_MAX]{},按 FedProfKind 索引。 ### 2. Host 侧:把单例拆成 Holder(数据面)+ Manager(控制面) - fed_prof.h / fed_prof.cpp → **删除**,拆为: - fed_prof_holder.h / fed_prof_holder.cpp:FedProfHolderBase 虚基类 + 模板 FedProfHolder<kind> + FedProfPerCoreProfHolder / FedProfAicpuProfHolder。 device buffer 的分配(DeviceDataAllocate)、清理(DeviceDataClear)、 D2H 搬运(DeviceDataGet<T>)、JSON 序列化(DumpJson<T> / DumpJsonAicpuProf) 全部收敛为按类型实现的虚接口;编排逻辑不再感知具体 profile 类型。 - fed_prof_manager.h / fed_prof_manager.cpp:FedProfManager 单例,负责 dump 线程生命周期、轮次判定(AicpuProfDumpSwimlaneCheck)、dump 编排与落盘。 - fed_prof_aicpu_prof.cpp → fed_prof_manager_aicpu.cpp。 - FedProfManager 内部用 std::unique_ptr<FedProfHolderBase> profList_[FED_PROF_KIND_MAX] 取代原来的两个具名成员,对外统一为 DeviceDataAllocate(FedProfKind), 新增 profile 类型只需在枚举和 profList_ 中登记一处。 - DeviceDfx::Init() 改为按 kind 遍历分配,并在拿到 devDfxArgAddr 后再次 InitDeviceArgs() 刷新 args_(device_dfx.cpp:57-70)。 - 顶层 CMakeLists.txt 的安装头文件清单同步更新(fed_prof.h → fed_prof_manager.h + fed_prof_holder.h)。 ### 3. Device 侧与调用方:地址来源统一切到 fedProfAddrList aicore_entry.h、aicore_entry_drco.h、device_sche.cpp、aicore_hal.h、 aicpu_task_manager.h、aicore_model_launcher.cpp、emulation_launcher.cpp、 kernel_binary.{h,cpp}、device_launcher.{h,cpp}、device_dfx.cpp、 framework/tests/st/utils/include/test_dev_func_runner.h - devArgs->perCoreProfAddr → devArgs->fedProfAddrList[FED_PROF_PER_CORE_PROF]; - devArgs->aicpuProfAddr → devArgs->fedProfAddrList[FED_PROF_AICPU_PROF]; - KernelBinary::InitMetaData() / GetEnableDumpDevPref() 改为按 kind 循环拷贝 / 判空。 ### 4. 关键缺陷修复:per-core 元数据不再被每轮清零 framework/src/machine/runtime/runner/fed_prof_manager.{h,cpp} - void PerCoreProfResetMetadata(const uint32_t coreId); + void PerCoreProfResetMetadata(bool multipleLaunch); - 外层 per-core 循环内移,函数自身负责 reset **全部** core; - 新增成员 bool perCoreProfDataInited_{false},在 multipleLaunch 下每个 core 只 reset 一次(恢复重构前的保护); - SetDebugEnable() 不再自己写循环,改为 PerCoreProfResetMetadata(AicpuProfDevAddr() != 0)——即 aicpu prof 使能 (DUMP_DEVICE_PERF=true)时传 true,否则传 false,保持「每次 launch 全量 reset」的原有语义。 修复后 status.currLaunchRound 随 launch 累加,dump 可覆盖全部 30 轮。 ### 5. 其它 - aikernel_define.h:UNUSED 由单参宏扩展为 1~16 变参宏 (UNUSED_SELECT 参数选择),满足 UNUSED(a, b, ...) 用法; 同时删除 framework/include/tilefwk/data_type.h 中重复的 UNUSED 定义。 - 626560468:析构时显式 AicpuProfReleaseData()(dump 线程 stop 之后), 修正 online 场景的资源释放顺序。 ### 6. UT 适配 test_device_perf.cpp(6 处调用点改 bool 实参,ResetMetadata_IndexOutOfRange 重命名为 ResetMetadata_MultipleLaunch)、test_dynamic_runner.cpp、 test_device_dfx.cpp、test_device_launcher_host/npu.cpp、 test_device_runner.cpp、test_dump_device_perf.cpp 等跟随接口调整。 ## 三、行为对比 | 场景 | 修复前 | 修复后 | |---|---|---| | DUMP_DEVICE_PERF=true(aicpu prof 使能)30 次 launch | 每次 launch 清零 currLaunchRound,dump 只含 1 轮 | 每 core 仅首次 reset,currLaunchRound 累加,dump 覆盖 30 轮 | | 仅 runtime debug / host prof(无 aicpu prof) | 每次 SetDebugEnable 全量 reset | 语义不变(multipleLaunch=false,仍每次全量 reset) | | 新增一类 profile | 需改结构体字段 + FedProf 成员 + dump 分支 | 加 FedProfKind 枚举项 + 一个 Holder 子类即可 | ## 四、验证 - **UT**(tile_fwk_utest,machine 模块,本机设备 0): 受影响的 14 个套件共 **43 例通过**,其中直接覆盖改动的 DevicePerfTest.*(含新增 ResetMetadata_MultipleLaunch)10/10 PASS, TestDeviceRunner.DevicePerf_SetDebugEnable、DeviceLauncherNpuTest.SetDevPerfAddr_*、 DumpDevicePerfTest.*、PerfEvtMgrTest.* / PerfettoMgrTest.* 等均 PASS。 另有 2 例(SetDevPerfAddr_CaptureMode、MiscNoOpFunctions_NoCrash)因本机 UT 运行环境未部署 libtilefwk_backend_server.so / pypto_op_info.json 而失败, 已确认抛错点在 SetDebugEnable 之前的条件求值阶段,与本次改动无关。 - **构建**:tile_fwk_runtime、tile_fwk_interface、tile_fwk_utest 编译通过。 - **待上板回归**:python/tests/st/test_ctrl_cpu_perf.py —— 期望 len(metrics) >= 30(本 PR 修复的目标用例);同时观察 mean/max EXEC_DYN、first DEV_TASK_BUILD 门限是否满足(该用例阈值按 ctrl cpu 效率标定,若仍有回退需单独定位)。 ## 五、影响面与风险 - **接口变更**:DeviceArgs.perCoreProfAddr / aicpuProfAddr → fedProfAddrList[FED_PROF_KIND_MAX],host/device 两侧同步修改, 属不兼容变更;生成侧、模拟器(aicore_model_kernel_meta_hook.h)与 ST 基建已同步。 - **文件结构变更**:fed_prof.h/.cpp 被删除并由 fed_prof_holder.* + fed_prof_manager.* 取代,需注意下游对旧头文件的直接 include(本仓已全部更新)。 - **风险点**:per-core 元数据 reset 时机的语义依赖 multipleLaunch 取值, 已在 UT 中分别覆盖 true / false 两条分支。 - **回滚**:本 PR 为独立重构 + 修复,回滚即回到 FedProf 单例实现。 See merge request: cann/pypto!7044 | 1 month ago | |
fix(machine): Fix in graph bug Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !6417 merge oom into master fix(machine): Fix in graph bug Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3381 ## 1. 停核代码风险 **原因**:同一颗 AICore 上一轮还没完全收干净,下一轮又上来了。原先停核时「清槽」和「发 GOODBYE」搅在一起,甚至 GOODBYE 之后又把握手缓冲清成 0,把下一轮刚写上的 HELLO 抹掉。 **改法**:固定顺序—— 1. 先让 STOP 被对面看见 2. 再清任务槽、清 HELLO 3. 再 barrier 4. 最后只发 GOODBYE 这样下一轮不会读到脏指针,也不会被误清握手标记。 --- ## 2. Ring sync 跨 eager / aclgraph 报错 **背景**:环形缓存槽复用时「ctrl 要等前几轮 aicore」这套 ring sync,**以前已经修好了**。 **现象**:同一算子先走eager,再走 aclgraph(capture / replay),在二者跨越部分插入的notify再底层会被拦截报错,这个硬同步信号不允许跨eager和aclgraph。 **原因**:原先 eager 和图模式共用同一对 ping-pong event、同一套序号。图里已经 record 过的 event,eager 侧再 wait 会碰到图里留下的旧信号;反过来也一样。 **本次改法**: - eager 和 aclgraph **各用一套 event**(两套 ping-pong)。 - 用 epoch 区分:普通模式 epoch=0,图模式用当前 capture model;换 epoch 时 **序号清零**,图模式再分配自己的 event 池(旧图的 event 留给 replay,不和新 capture / eager 混用)。 - wait / record 时带上「是不是 capture」,只碰对应那一套 event。 - 调用收成一次 BeginRingLaunch(切 epoch → 确保 event 建好 → 取本轮序号),语义不变。 **改前(串扰)**: text ── aclgraph capture / replay ── ── eager ── ctrl [c1][c2][c3 wait 共用 E0] ... [c' wait 共用 E0] ← 可能等的是图里的旧 E0 aicore [a1][a2] E0^ E1^ ... [a'] event 同一对 E0/E1 贯穿两种模式 ─────────────────────────────► **改后(隔离)**: text ── aclgraph(epoch=model,graphEvents)── ── eager(epoch=0,eagerEvents)── ctrl [c1][c2][c3 wait gE0] ... [c' wait eE0] ← 只等 eager 自己的 eE0 aicore [a1][a2] gE0^ gE1^ ... [a'] eE0^ sequence 在图内递增;切到 eager 时 sequence 归零,两套 event 互不 wait --- ## 3. 暂时关掉「控核缩核」 **现象**:按实际 maxC/maxV 把核数缩小后,和提前下发、多轮重叠叠在一起,整网执行发现控到极小核的几个核会卡死。 **改法(临时策略)**: - Host:启动前不再按缓存里的 maxC/maxV 改小 blockdim,一律用配置的满核数。 - Device:handshake 之后不再做按任务缩核(CalcAdjAicoreEnd)。 代码里用开关挡住,实现还留着,待定位清楚后再酌情打开。 --- ## 4. Sche 分波撞到同一个 threadIdx **现象**:A5 压测报 Duplicate threadIdx(例如 cpu=3, threadIdx=1, bitmap 已占用)。 **原因**:aicpu的任务调度是NormalMode, 一次 launch 的 AICPU block 数可以大于同时能跑的核。核不够时会分波:第一波跑完退出,第二波又绑到同一批物理核,算出的 threadIdx 和第一波一样。第一波其实已经把活干完了,第二波再跑同一编号是错的,也不该当成致命错误直接失败(还可能清不掉分配状态)。 **改法**:发现 threadIdx 已被占用时,把本 block 标成丢弃(threadIdx=-1),不再进 sche,但仍正常退出凑齐人数,好清状态。顺带给真正的失败路径补了更清楚的 ERROR 日志。 See merge request: cann/pypto!6417 | 2 months ago | |
fix(machine): Avoid dcci refresh timeout when devtask slab is reused Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !7270 merge aicore-devtask-refresh-slab-reuse into master fix(machine): Avoid dcci refresh timeout when devtask slab is reused Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: fix(machine): Avoid dcci refresh timeout when devtask slab is reused When AICore refreshes cachedDevTasks in RefreshParallelDevTaskByModifyFlag, the second dcci loop waits until header->seqNo equals idElements[slot]. If the AICPU side has already recycled the devtask slab memory and reused it to build a later devtask, the seqNo at the published address stays permanently ahead of the expected id, so the loop spins until AICORE_TIMEOUT_CHECK aborts the core with STAGE_UPDATE_PARALLEL_DEVTASK_TIMEOUT. Changes: - Change the second loop exit condition from seqNo != newDevTaskId to seqNo < newDevTaskId, so a slot whose slab was reused and advanced exits the wait immediately instead of dead looping - Skip the slot refresh (clear the mask bit) when seqNo > newDevTaskId. This is safe because no leaf task of the stale devtask can arrive: a new devtask rebind raises bindParallelCtxVersion and triggers a fresh modifyFlag refresh before its first leaf task runs - Verified with operator_smoke_cases_A3 s=6-e=6 (chunked gated delta rule unaligned case, device 0): 100+ consecutive runs PASS with identical precision metrics and no timeout Related Issues: #3737 See merge request: cann/pypto!7270 | 29 days 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 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 | |
refactor(all): Remove trailing whitespace Co-authored-by: tsungl4<lidongsheng4@huawei.com> # message auto-generated for no-merge-commit merge: !2188 merge pre-commit into master refactor(all): Remove trailing whitespace Created-by: tsungl4 Commit-by: tsungl4 Merged-by: cann-robot Description: Introduce pre-commit tools, and remove trailing white space with default plugin Related Issue: #1017 See merge request: cann/pypto!2188 | 7 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 | |
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 | |
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 | |
Normalized framework for pgo Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !7044 merge pgo-framework into master Normalized framework for pgo Created-by: yinjie27_ Commit-by: Jie Yin;LordOfMysteries Merged-by: cann-robot Description: # feat(machine): 重构 FedProf 为 Holder/Manager 实例化结构,并修复 CTRL 泳道只 dump 一轮的回归 ## 一、背景与问题 fed_prof(device 侧性能数据 dump)原实现是一个单例 FedProf:内部直接持有 perCoreProf_ / aicpuProf_ 两个裸 device 指针,dump 线程、轮次管理、JSON 序列化 全部堆在同一个类里;DeviceArgs 里也以 perCoreProfAddr / aicpuProfAddr 两个散落字段 传地址。新增一类 profile 需要同时改结构体、改分配逻辑、改 dump 分支,扩展成本高。 同时暴露出一个回归:DUMP_DEVICE_PERF=true 时 python/tests/st/test_ctrl_cpu_perf.py 断言 len(metrics) >= 30 失败,实际只解析出 **1 轮** CTRL 数据: AssertionError: expected >= 30 CTRL rounds, got 1 ... assert 1 >= 30 **根因链**: 1. DUMP_DEVICE_PERF=true ⇒ KernelBinary::GetEnableDumpDevPref() 恒为真, 于是**每次** LaunchKernel 都会走到 DeviceLauncher::SetDevPerfAddr()(device_launcher.cpp:658)→ FedProfManager::SetDebugEnable(); 2. SetDebugEnable() 每次都对**所有 core** 全量 memset per-core prof 元数据 (PerCoreProfResetMetadata()),把 device 侧 status.currLaunchRound 清零; 3. 而 currLaunchRound 只在 AICore 退出时 ++(aicore_entry_dfx.h:174), 因此连续 30 次 launch 后它仍然只有 **1**; 4. AicpuProfDumpSwimlaneCheck() 以 currLaunchRound 作为 dump 轮次上界 (fed_prof_manager_aicpu.cpp:101),FedProfLaunchAicpuDumpJson() 只遍历 [lastDumpRound, currLaunchRound)(fed_prof_io_json.cpp:181), 最终 dump 里只剩 round _0。 ## 二、改动总览 共 4 个提交,34 个文件。 ### 1. 数据结构:用 FedProfKind + 地址列表替代散落字段 framework/src/interface/machine/device/tilefwk/aikernel_profile.h - 新增 enum FedProfKind { FED_PROF_PER_CORE_PROF, FED_PROF_AICPU_PROF, FED_PROF_KIND_MAX } 与 struct FedProfDataBase {} 作为类型化基类; - FedProfPerCoreProf / FedProfAicpuProf 改为继承 FedProfDataBase。 framework/src/interface/machine/device/tilefwk/aicpu_common.h - DeviceArgs 中 perCoreProfAddr / aicpuProfAddr 两个字段合并为 uint64_t fedProfAddrList[FED_PROF_KIND_MAX]{},按 FedProfKind 索引。 ### 2. Host 侧:把单例拆成 Holder(数据面)+ Manager(控制面) - fed_prof.h / fed_prof.cpp → **删除**,拆为: - fed_prof_holder.h / fed_prof_holder.cpp:FedProfHolderBase 虚基类 + 模板 FedProfHolder<kind> + FedProfPerCoreProfHolder / FedProfAicpuProfHolder。 device buffer 的分配(DeviceDataAllocate)、清理(DeviceDataClear)、 D2H 搬运(DeviceDataGet<T>)、JSON 序列化(DumpJson<T> / DumpJsonAicpuProf) 全部收敛为按类型实现的虚接口;编排逻辑不再感知具体 profile 类型。 - fed_prof_manager.h / fed_prof_manager.cpp:FedProfManager 单例,负责 dump 线程生命周期、轮次判定(AicpuProfDumpSwimlaneCheck)、dump 编排与落盘。 - fed_prof_aicpu_prof.cpp → fed_prof_manager_aicpu.cpp。 - FedProfManager 内部用 std::unique_ptr<FedProfHolderBase> profList_[FED_PROF_KIND_MAX] 取代原来的两个具名成员,对外统一为 DeviceDataAllocate(FedProfKind), 新增 profile 类型只需在枚举和 profList_ 中登记一处。 - DeviceDfx::Init() 改为按 kind 遍历分配,并在拿到 devDfxArgAddr 后再次 InitDeviceArgs() 刷新 args_(device_dfx.cpp:57-70)。 - 顶层 CMakeLists.txt 的安装头文件清单同步更新(fed_prof.h → fed_prof_manager.h + fed_prof_holder.h)。 ### 3. Device 侧与调用方:地址来源统一切到 fedProfAddrList aicore_entry.h、aicore_entry_drco.h、device_sche.cpp、aicore_hal.h、 aicpu_task_manager.h、aicore_model_launcher.cpp、emulation_launcher.cpp、 kernel_binary.{h,cpp}、device_launcher.{h,cpp}、device_dfx.cpp、 framework/tests/st/utils/include/test_dev_func_runner.h - devArgs->perCoreProfAddr → devArgs->fedProfAddrList[FED_PROF_PER_CORE_PROF]; - devArgs->aicpuProfAddr → devArgs->fedProfAddrList[FED_PROF_AICPU_PROF]; - KernelBinary::InitMetaData() / GetEnableDumpDevPref() 改为按 kind 循环拷贝 / 判空。 ### 4. 关键缺陷修复:per-core 元数据不再被每轮清零 framework/src/machine/runtime/runner/fed_prof_manager.{h,cpp} - void PerCoreProfResetMetadata(const uint32_t coreId); + void PerCoreProfResetMetadata(bool multipleLaunch); - 外层 per-core 循环内移,函数自身负责 reset **全部** core; - 新增成员 bool perCoreProfDataInited_{false},在 multipleLaunch 下每个 core 只 reset 一次(恢复重构前的保护); - SetDebugEnable() 不再自己写循环,改为 PerCoreProfResetMetadata(AicpuProfDevAddr() != 0)——即 aicpu prof 使能 (DUMP_DEVICE_PERF=true)时传 true,否则传 false,保持「每次 launch 全量 reset」的原有语义。 修复后 status.currLaunchRound 随 launch 累加,dump 可覆盖全部 30 轮。 ### 5. 其它 - aikernel_define.h:UNUSED 由单参宏扩展为 1~16 变参宏 (UNUSED_SELECT 参数选择),满足 UNUSED(a, b, ...) 用法; 同时删除 framework/include/tilefwk/data_type.h 中重复的 UNUSED 定义。 - 626560468:析构时显式 AicpuProfReleaseData()(dump 线程 stop 之后), 修正 online 场景的资源释放顺序。 ### 6. UT 适配 test_device_perf.cpp(6 处调用点改 bool 实参,ResetMetadata_IndexOutOfRange 重命名为 ResetMetadata_MultipleLaunch)、test_dynamic_runner.cpp、 test_device_dfx.cpp、test_device_launcher_host/npu.cpp、 test_device_runner.cpp、test_dump_device_perf.cpp 等跟随接口调整。 ## 三、行为对比 | 场景 | 修复前 | 修复后 | |---|---|---| | DUMP_DEVICE_PERF=true(aicpu prof 使能)30 次 launch | 每次 launch 清零 currLaunchRound,dump 只含 1 轮 | 每 core 仅首次 reset,currLaunchRound 累加,dump 覆盖 30 轮 | | 仅 runtime debug / host prof(无 aicpu prof) | 每次 SetDebugEnable 全量 reset | 语义不变(multipleLaunch=false,仍每次全量 reset) | | 新增一类 profile | 需改结构体字段 + FedProf 成员 + dump 分支 | 加 FedProfKind 枚举项 + 一个 Holder 子类即可 | ## 四、验证 - **UT**(tile_fwk_utest,machine 模块,本机设备 0): 受影响的 14 个套件共 **43 例通过**,其中直接覆盖改动的 DevicePerfTest.*(含新增 ResetMetadata_MultipleLaunch)10/10 PASS, TestDeviceRunner.DevicePerf_SetDebugEnable、DeviceLauncherNpuTest.SetDevPerfAddr_*、 DumpDevicePerfTest.*、PerfEvtMgrTest.* / PerfettoMgrTest.* 等均 PASS。 另有 2 例(SetDevPerfAddr_CaptureMode、MiscNoOpFunctions_NoCrash)因本机 UT 运行环境未部署 libtilefwk_backend_server.so / pypto_op_info.json 而失败, 已确认抛错点在 SetDebugEnable 之前的条件求值阶段,与本次改动无关。 - **构建**:tile_fwk_runtime、tile_fwk_interface、tile_fwk_utest 编译通过。 - **待上板回归**:python/tests/st/test_ctrl_cpu_perf.py —— 期望 len(metrics) >= 30(本 PR 修复的目标用例);同时观察 mean/max EXEC_DYN、first DEV_TASK_BUILD 门限是否满足(该用例阈值按 ctrl cpu 效率标定,若仍有回退需单独定位)。 ## 五、影响面与风险 - **接口变更**:DeviceArgs.perCoreProfAddr / aicpuProfAddr → fedProfAddrList[FED_PROF_KIND_MAX],host/device 两侧同步修改, 属不兼容变更;生成侧、模拟器(aicore_model_kernel_meta_hook.h)与 ST 基建已同步。 - **文件结构变更**:fed_prof.h/.cpp 被删除并由 fed_prof_holder.* + fed_prof_manager.* 取代,需注意下游对旧头文件的直接 include(本仓已全部更新)。 - **风险点**:per-core 元数据 reset 时机的语义依赖 multipleLaunch 取值, 已在 UT 中分别覆盖 true / false 两条分支。 - **回滚**:本 PR 为独立重构 + 修复,回滚即回到 FedProf 单例实现。 See merge request: cann/pypto!7044 | 1 month ago | |
feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !5007 merge perf/aot-cf-code-pool into master feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2597 feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool Replace single-slot AOT CF binary caching with a multi-slot LRU pool, plus coding micro-optimizations that share encode_program surfaces (RuntimeVerify moved out of header, workspace/start-args tidy). Commits: - feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool - refactor(machine): Apply coding and style micro-optimizations Changes: - AOT_CODE_POOL multi-slot LRU - Encode hashKey assert for empty-slot sentinel - ST test_aot_code_pool - RuntimeVerify / workspace micro cleanups Related Issues: N/A See merge request: cann/pypto!5007 | 4 months ago | |
feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !5007 merge perf/aot-cf-code-pool into master feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2597 feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool Replace single-slot AOT CF binary caching with a multi-slot LRU pool, plus coding micro-optimizations that share encode_program surfaces (RuntimeVerify moved out of header, workspace/start-args tidy). Commits: - feat(machine): Cache AOT control-flow binaries in multi-slot LRU pool - refactor(machine): Apply coding and style micro-optimizations Changes: - AOT_CODE_POOL multi-slot LRU - Encode hashKey assert for empty-slot sentinel - ST test_aot_code_pool - RuntimeVerify / workspace micro cleanups Related Issues: N/A See merge request: cann/pypto!5007 | 4 months ago | |
perf(machine): Mix pending general Co-authored-by: xuyi_37<xuyi37@huawei.com> # message auto-generated for no-merge-commit merge: !4855 merge master into master perf(machine): Mix pending general Created-by: xuyi_37 Commit-by: xuyi_37 Merged-by: cann-robot Description: perf(machine): Mix pending general Related Issue: [#2670](https://gitcode.com/cann/pypto/issues/2670) See merge request: cann/pypto!4855 | 3 months ago | |
fix(simulation): Fix bad perf bug and optimize pv code Co-authored-by: zhiweiyuan<zhiweiyuan@huawei.com> # message auto-generated for no-merge-commit merge: !2597 merge master into master fix(simulation): Fix bad perf bug and optimize pv code Created-by: zhiweiyuan Commit-by: zhiweiyuan Merged-by: cann-robot Description: 1、解决Inner tensor问题 2、优化PvModel代码 See merge request: cann/pypto!2597 | 7 months ago | |
fix(machine): Fix control core bug Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !6157 merge expr into master fix(machine): Fix control core bug Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2597 # 控核 nrValidAic 竞态问题:根因与修复方案 ## 1. 背景 压测场景: - 同一 JIT kernel(DYNAMIC shape)在一张 aclgraph 里穿插多种 token 规格(如 T=1/4/8/16/32) - Host 控核(TryResetBlockDimForPreLaunch)按 tiling 的 maxC/maxV 收缩 ctrlBlockDim(常见为 1~4) - 未开启 AICore 解依赖(ENABLE_AICORE_RESOLVE);经典路径为 Sche handshake + 派 leaf - Early-launch / 多 stream 下,相邻 round 的 CTRL/SCHE/AICORE 可能时间重叠 长压后可出现 AICore 软件 Trap(等待 leaf / handshake 超时)或 Sche handshake 超时。 --- ## 2. 根因 ### 2.1 Host 双字段分叉(诱因) | 字段 | 角色 | 控核后行为 | |------|------|------------| | ctrlBlockDim | Host launch 的 AICore blockDim,并写入本轮 ctrlBlockNum | TryReset **只改这个** | | devArgs.nrValidAic | DeviceArgs「有效 AIC 数」:分核、ready 队列、handshake | 仍按满核 config.blockdim(capacity) | | devArgs.scheCpuNum | Sche 线程数 | 按满核算死,不随控核收缩 | 即:真正起核用的是收缩后的 k,共享 DevProg 上仍挂着满核口径的 capacity。 ### 2.2 致命点:原地改写共享 DevProg.devArgs.nrValidAic 旧逻辑在 CTRL/SCHE 入口: text ReCalcDevArgsAicoreNum: if ctrlBlockNum != 0 && ctrlBlockNum != nrValidAic: devProg->devArgs.nrValidAic = ctrlBlockNum; // 写共享 GM 同时: - **同一 Function** 的 device cfgdata(DevAscendProgram)只 CopyToDev 一次并缓存复用 - 多 shape / 多 round **共用同一份** cfgdata - Sche RunSche 曾通过 kargs->cfgdata **指针**读共享 DeviceArgs,Init 时取 aicValidNum_ = nrValidAic 在 early-launch 等跨流重叠下: text Round N: SCHE 已 ReCalc(kN),可能尚未 Init / 仍在跑 Round N+1: CTRL/SCHE ReCalc(kN+1) 改写同一 nrValidAic → Round N Sche 分核/handshake 按错误核数 → 与 Host launch 的 blockDim=kN 不一致 → handshake 等不到核 / AICore 等不到 leaf → 超时 Trap 未开 resolve 时,Trap 本质是 **Sche 断粮 / handshake 错位**,而不是 DRCO 按满核等 peer。 ### 2.3 次要问题:scheCpuNum 过配 控核到 blockDim=1~4 时,若仲裁/分核仍按满核 scheCpuNum=3~4,有效活压在少数 sche 上,放大仲裁与单 sche 脆弱性。 做法是:**共享保持 capacity,本轮仲裁用收缩后的 sche 数**(见 §3.2 / §3.4)。 --- ## 3. 修改方案 核心原则: > **共享 DevProg.devArgs 只表示 capacity;本轮拓扑放进 ring slot(DevStartArgs)和 Sche 本地 DeviceArgs 副本,禁止再原地改写共享 nrValidAic。** ### 3.1 Per-round 拓扑字段 DevStartArgs(每个 runtime ring slot 一份)增加: - nrValidAic:本轮有效 AIC 数 - scheCpuNum:本轮目标 sche 数(已按控核收缩) ### 3.2 解析辅助(device_common.h)——含 scheCpuNum 过配修复 - ResolveRoundNrValidAic(ctrlBlockNum, capacityNrValidAic) - ctrlBlockNum != 0 → 用控核结果,否则用 capacity - ResolveRoundScheCpuNum(nrValidAic, capacityScheCpuNum, arch) - CalcSchAicpuNumByBlockDim(本轮 nrValidAic),再 **clamp 到 capacity** - 例如 nrValidAic∈{1..4} → 本轮 scheCpuNum 一般为 **1**,不再用满核的 3~4 去仲裁 ### 3.3 CTRL(InitDyn) Allocate 本轮 DevStartArgs 后写入上述字段;devCtrlState.schAicpuNum 跟本轮 scheCpuNum。 **不再**调用 ReCalcDevArgsAicoreNum 写共享 GM。 ### 3.4 Sche(EntrySplittedStreamSche)——本轮用收缩后的 sche 数 - 从共享 DevProg 拷一份本地 roundArgs,用本轮 ctrlBlockNum 覆盖 nrValidAic / scheCpuNum(经 ResolveRound*) - RunSchInit(capacityScheCpuNum):机器只按 **capacity** 初始化一次(队列规模仍按满配) - AllocThreadIdx / 仲裁起点 / handshake / RunThread:用本轮 **已收缩** 的 roundArgs.scheCpuNum - 清多余 task queue:按 **capacity** 区间(arbitrated .. capacity) - 拓扑与 CTRL 同源(同一 launch 的 ctrlBlockNum),不再 Wait 后从 slot 二次覆盖 效果对照(典型 3510): | 本轮 ctrlBlockDim | 旧:仲裁用共享 sche | 新:本轮 ResolveRoundScheCpuNum | |---------------------|---------------------|----------------------------------| | 1~4 | 仍可能 3~4 | 一般为 **1** | | 满核 | capacity | capacity | ### 3.5 CTRL 消费路径 - Ready 队列 restore、CalcControlMaxAicore:只用 DevStartArgs::nrValidAic - **DRCO(aicore 解依赖)不改**:当前不支持控核,仍读共享 devProg->devArgs.nrValidAic ### 3.6 Host 控核(TryResetBlockDimForPreLaunch) - 只更新 ctrlBlockDim(进而进入本轮 ctrlBlockNum) - **不**收缩共享 devArgs.scheCpuNum / nrValidAic(避免毒化 capacity / 首次 CopyToDev) - 过配在 **device 本轮 Resolve** 解决,而不是改 host 共享字段 --- See merge request: cann/pypto!6157 | 2 months ago | |
refactor(all): Remove trailing whitespace Co-authored-by: tsungl4<lidongsheng4@huawei.com> # message auto-generated for no-merge-commit merge: !2188 merge pre-commit into master refactor(all): Remove trailing whitespace Created-by: tsungl4 Commit-by: tsungl4 Merged-by: cann-robot Description: Introduce pre-commit tools, and remove trailing white space with default plugin Related Issue: #1017 See merge request: cann/pypto!2188 | 7 months ago | |
feat(machine): Support BN parallel for DRCO Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !7246 merge drco-bn-parallel-final into master feat(machine): Support BN parallel for DRCO Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: feat(machine): Support BN parallel for DRCO Add a device-side parallel window for DRCO devTask execution under BN parallel mode (device_sched_parallelism > 1) on 2201: block0 acts as the single admission/handover/recycle/stop leader while all cores visit slots in try-mode rotation, replacing the legacy SyncAllMix barrier per devTask. Squashed from the window feature, its cross-core visibility fixes, the minimal atomic protocol reduction, and two late hardening changes (per-slot activation now issues the ENTIRE_DATA_CACHE invalidation before loading queue/matrix read sets; ready-queue entries are published via atomic release stores ahead of the tail gateway). BN parallel mode and DRCO L2-affinity scheduling are temporarily made mutually exclusive (BN wins): enabling both together exposes a stale-data window between the L2 affinity dispatch order and the BN window admit/handover protocol. Proper fusion is left for a follow-up. Changes: - Add DrcoParallelWindow slot ring, per-slot activation/visit/exit protocol and leader poll loop - Encode stop as cross-launch epoch with entry barrier clear for non-block0 cores - Guard stale slot activation with posId validation and invalidate freed slots on idle - Reset window cursors and BN link fields deterministically across launches and replays - Publish ready-queue entries (func/root/forId/wsId) with atomic release stores - Move UpdateCacheDevTask entire-cache dcci ahead of activation read-set loads - Force DRCO_FLAG_L2_CLOSE=0 when ENABLE_AICORE_BN_PARALLEL=1 (temporary mutex) Related Issues: #7147 See merge request: cann/pypto!7246 | 1 month 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 | |
Normalized framework for pgo Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !7044 merge pgo-framework into master Normalized framework for pgo Created-by: yinjie27_ Commit-by: Jie Yin;LordOfMysteries Merged-by: cann-robot Description: # feat(machine): 重构 FedProf 为 Holder/Manager 实例化结构,并修复 CTRL 泳道只 dump 一轮的回归 ## 一、背景与问题 fed_prof(device 侧性能数据 dump)原实现是一个单例 FedProf:内部直接持有 perCoreProf_ / aicpuProf_ 两个裸 device 指针,dump 线程、轮次管理、JSON 序列化 全部堆在同一个类里;DeviceArgs 里也以 perCoreProfAddr / aicpuProfAddr 两个散落字段 传地址。新增一类 profile 需要同时改结构体、改分配逻辑、改 dump 分支,扩展成本高。 同时暴露出一个回归:DUMP_DEVICE_PERF=true 时 python/tests/st/test_ctrl_cpu_perf.py 断言 len(metrics) >= 30 失败,实际只解析出 **1 轮** CTRL 数据: AssertionError: expected >= 30 CTRL rounds, got 1 ... assert 1 >= 30 **根因链**: 1. DUMP_DEVICE_PERF=true ⇒ KernelBinary::GetEnableDumpDevPref() 恒为真, 于是**每次** LaunchKernel 都会走到 DeviceLauncher::SetDevPerfAddr()(device_launcher.cpp:658)→ FedProfManager::SetDebugEnable(); 2. SetDebugEnable() 每次都对**所有 core** 全量 memset per-core prof 元数据 (PerCoreProfResetMetadata()),把 device 侧 status.currLaunchRound 清零; 3. 而 currLaunchRound 只在 AICore 退出时 ++(aicore_entry_dfx.h:174), 因此连续 30 次 launch 后它仍然只有 **1**; 4. AicpuProfDumpSwimlaneCheck() 以 currLaunchRound 作为 dump 轮次上界 (fed_prof_manager_aicpu.cpp:101),FedProfLaunchAicpuDumpJson() 只遍历 [lastDumpRound, currLaunchRound)(fed_prof_io_json.cpp:181), 最终 dump 里只剩 round _0。 ## 二、改动总览 共 4 个提交,34 个文件。 ### 1. 数据结构:用 FedProfKind + 地址列表替代散落字段 framework/src/interface/machine/device/tilefwk/aikernel_profile.h - 新增 enum FedProfKind { FED_PROF_PER_CORE_PROF, FED_PROF_AICPU_PROF, FED_PROF_KIND_MAX } 与 struct FedProfDataBase {} 作为类型化基类; - FedProfPerCoreProf / FedProfAicpuProf 改为继承 FedProfDataBase。 framework/src/interface/machine/device/tilefwk/aicpu_common.h - DeviceArgs 中 perCoreProfAddr / aicpuProfAddr 两个字段合并为 uint64_t fedProfAddrList[FED_PROF_KIND_MAX]{},按 FedProfKind 索引。 ### 2. Host 侧:把单例拆成 Holder(数据面)+ Manager(控制面) - fed_prof.h / fed_prof.cpp → **删除**,拆为: - fed_prof_holder.h / fed_prof_holder.cpp:FedProfHolderBase 虚基类 + 模板 FedProfHolder<kind> + FedProfPerCoreProfHolder / FedProfAicpuProfHolder。 device buffer 的分配(DeviceDataAllocate)、清理(DeviceDataClear)、 D2H 搬运(DeviceDataGet<T>)、JSON 序列化(DumpJson<T> / DumpJsonAicpuProf) 全部收敛为按类型实现的虚接口;编排逻辑不再感知具体 profile 类型。 - fed_prof_manager.h / fed_prof_manager.cpp:FedProfManager 单例,负责 dump 线程生命周期、轮次判定(AicpuProfDumpSwimlaneCheck)、dump 编排与落盘。 - fed_prof_aicpu_prof.cpp → fed_prof_manager_aicpu.cpp。 - FedProfManager 内部用 std::unique_ptr<FedProfHolderBase> profList_[FED_PROF_KIND_MAX] 取代原来的两个具名成员,对外统一为 DeviceDataAllocate(FedProfKind), 新增 profile 类型只需在枚举和 profList_ 中登记一处。 - DeviceDfx::Init() 改为按 kind 遍历分配,并在拿到 devDfxArgAddr 后再次 InitDeviceArgs() 刷新 args_(device_dfx.cpp:57-70)。 - 顶层 CMakeLists.txt 的安装头文件清单同步更新(fed_prof.h → fed_prof_manager.h + fed_prof_holder.h)。 ### 3. Device 侧与调用方:地址来源统一切到 fedProfAddrList aicore_entry.h、aicore_entry_drco.h、device_sche.cpp、aicore_hal.h、 aicpu_task_manager.h、aicore_model_launcher.cpp、emulation_launcher.cpp、 kernel_binary.{h,cpp}、device_launcher.{h,cpp}、device_dfx.cpp、 framework/tests/st/utils/include/test_dev_func_runner.h - devArgs->perCoreProfAddr → devArgs->fedProfAddrList[FED_PROF_PER_CORE_PROF]; - devArgs->aicpuProfAddr → devArgs->fedProfAddrList[FED_PROF_AICPU_PROF]; - KernelBinary::InitMetaData() / GetEnableDumpDevPref() 改为按 kind 循环拷贝 / 判空。 ### 4. 关键缺陷修复:per-core 元数据不再被每轮清零 framework/src/machine/runtime/runner/fed_prof_manager.{h,cpp} - void PerCoreProfResetMetadata(const uint32_t coreId); + void PerCoreProfResetMetadata(bool multipleLaunch); - 外层 per-core 循环内移,函数自身负责 reset **全部** core; - 新增成员 bool perCoreProfDataInited_{false},在 multipleLaunch 下每个 core 只 reset 一次(恢复重构前的保护); - SetDebugEnable() 不再自己写循环,改为 PerCoreProfResetMetadata(AicpuProfDevAddr() != 0)——即 aicpu prof 使能 (DUMP_DEVICE_PERF=true)时传 true,否则传 false,保持「每次 launch 全量 reset」的原有语义。 修复后 status.currLaunchRound 随 launch 累加,dump 可覆盖全部 30 轮。 ### 5. 其它 - aikernel_define.h:UNUSED 由单参宏扩展为 1~16 变参宏 (UNUSED_SELECT 参数选择),满足 UNUSED(a, b, ...) 用法; 同时删除 framework/include/tilefwk/data_type.h 中重复的 UNUSED 定义。 - 626560468:析构时显式 AicpuProfReleaseData()(dump 线程 stop 之后), 修正 online 场景的资源释放顺序。 ### 6. UT 适配 test_device_perf.cpp(6 处调用点改 bool 实参,ResetMetadata_IndexOutOfRange 重命名为 ResetMetadata_MultipleLaunch)、test_dynamic_runner.cpp、 test_device_dfx.cpp、test_device_launcher_host/npu.cpp、 test_device_runner.cpp、test_dump_device_perf.cpp 等跟随接口调整。 ## 三、行为对比 | 场景 | 修复前 | 修复后 | |---|---|---| | DUMP_DEVICE_PERF=true(aicpu prof 使能)30 次 launch | 每次 launch 清零 currLaunchRound,dump 只含 1 轮 | 每 core 仅首次 reset,currLaunchRound 累加,dump 覆盖 30 轮 | | 仅 runtime debug / host prof(无 aicpu prof) | 每次 SetDebugEnable 全量 reset | 语义不变(multipleLaunch=false,仍每次全量 reset) | | 新增一类 profile | 需改结构体字段 + FedProf 成员 + dump 分支 | 加 FedProfKind 枚举项 + 一个 Holder 子类即可 | ## 四、验证 - **UT**(tile_fwk_utest,machine 模块,本机设备 0): 受影响的 14 个套件共 **43 例通过**,其中直接覆盖改动的 DevicePerfTest.*(含新增 ResetMetadata_MultipleLaunch)10/10 PASS, TestDeviceRunner.DevicePerf_SetDebugEnable、DeviceLauncherNpuTest.SetDevPerfAddr_*、 DumpDevicePerfTest.*、PerfEvtMgrTest.* / PerfettoMgrTest.* 等均 PASS。 另有 2 例(SetDevPerfAddr_CaptureMode、MiscNoOpFunctions_NoCrash)因本机 UT 运行环境未部署 libtilefwk_backend_server.so / pypto_op_info.json 而失败, 已确认抛错点在 SetDebugEnable 之前的条件求值阶段,与本次改动无关。 - **构建**:tile_fwk_runtime、tile_fwk_interface、tile_fwk_utest 编译通过。 - **待上板回归**:python/tests/st/test_ctrl_cpu_perf.py —— 期望 len(metrics) >= 30(本 PR 修复的目标用例);同时观察 mean/max EXEC_DYN、first DEV_TASK_BUILD 门限是否满足(该用例阈值按 ctrl cpu 效率标定,若仍有回退需单独定位)。 ## 五、影响面与风险 - **接口变更**:DeviceArgs.perCoreProfAddr / aicpuProfAddr → fedProfAddrList[FED_PROF_KIND_MAX],host/device 两侧同步修改, 属不兼容变更;生成侧、模拟器(aicore_model_kernel_meta_hook.h)与 ST 基建已同步。 - **文件结构变更**:fed_prof.h/.cpp 被删除并由 fed_prof_holder.* + fed_prof_manager.* 取代,需注意下游对旧头文件的直接 include(本仓已全部更新)。 - **风险点**:per-core 元数据 reset 时机的语义依赖 multipleLaunch 取值, 已在 UT 中分别覆盖 true / false 两条分支。 - **回滚**:本 PR 为独立重构 + 修复,回滚即回到 FedProf 单例实现。 See merge request: cann/pypto!7044 | 1 month ago | |
fix(machine): Fix in graph bug Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !6417 merge oom into master fix(machine): Fix in graph bug Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3381 ## 1. 停核代码风险 **原因**:同一颗 AICore 上一轮还没完全收干净,下一轮又上来了。原先停核时「清槽」和「发 GOODBYE」搅在一起,甚至 GOODBYE 之后又把握手缓冲清成 0,把下一轮刚写上的 HELLO 抹掉。 **改法**:固定顺序—— 1. 先让 STOP 被对面看见 2. 再清任务槽、清 HELLO 3. 再 barrier 4. 最后只发 GOODBYE 这样下一轮不会读到脏指针,也不会被误清握手标记。 --- ## 2. Ring sync 跨 eager / aclgraph 报错 **背景**:环形缓存槽复用时「ctrl 要等前几轮 aicore」这套 ring sync,**以前已经修好了**。 **现象**:同一算子先走eager,再走 aclgraph(capture / replay),在二者跨越部分插入的notify再底层会被拦截报错,这个硬同步信号不允许跨eager和aclgraph。 **原因**:原先 eager 和图模式共用同一对 ping-pong event、同一套序号。图里已经 record 过的 event,eager 侧再 wait 会碰到图里留下的旧信号;反过来也一样。 **本次改法**: - eager 和 aclgraph **各用一套 event**(两套 ping-pong)。 - 用 epoch 区分:普通模式 epoch=0,图模式用当前 capture model;换 epoch 时 **序号清零**,图模式再分配自己的 event 池(旧图的 event 留给 replay,不和新 capture / eager 混用)。 - wait / record 时带上「是不是 capture」,只碰对应那一套 event。 - 调用收成一次 BeginRingLaunch(切 epoch → 确保 event 建好 → 取本轮序号),语义不变。 **改前(串扰)**: text ── aclgraph capture / replay ── ── eager ── ctrl [c1][c2][c3 wait 共用 E0] ... [c' wait 共用 E0] ← 可能等的是图里的旧 E0 aicore [a1][a2] E0^ E1^ ... [a'] event 同一对 E0/E1 贯穿两种模式 ─────────────────────────────► **改后(隔离)**: text ── aclgraph(epoch=model,graphEvents)── ── eager(epoch=0,eagerEvents)── ctrl [c1][c2][c3 wait gE0] ... [c' wait eE0] ← 只等 eager 自己的 eE0 aicore [a1][a2] gE0^ gE1^ ... [a'] eE0^ sequence 在图内递增;切到 eager 时 sequence 归零,两套 event 互不 wait --- ## 3. 暂时关掉「控核缩核」 **现象**:按实际 maxC/maxV 把核数缩小后,和提前下发、多轮重叠叠在一起,整网执行发现控到极小核的几个核会卡死。 **改法(临时策略)**: - Host:启动前不再按缓存里的 maxC/maxV 改小 blockdim,一律用配置的满核数。 - Device:handshake 之后不再做按任务缩核(CalcAdjAicoreEnd)。 代码里用开关挡住,实现还留着,待定位清楚后再酌情打开。 --- ## 4. Sche 分波撞到同一个 threadIdx **现象**:A5 压测报 Duplicate threadIdx(例如 cpu=3, threadIdx=1, bitmap 已占用)。 **原因**:aicpu的任务调度是NormalMode, 一次 launch 的 AICPU block 数可以大于同时能跑的核。核不够时会分波:第一波跑完退出,第二波又绑到同一批物理核,算出的 threadIdx 和第一波一样。第一波其实已经把活干完了,第二波再跑同一编号是错的,也不该当成致命错误直接失败(还可能清不掉分配状态)。 **改法**:发现 threadIdx 已被占用时,把本 block 标成丢弃(threadIdx=-1),不再进 sche,但仍正常退出凑齐人数,好清状态。顺带给真正的失败路径补了更清楚的 ERROR 日志。 See merge request: cann/pypto!6417 | 2 months ago | |
fix(machine): Fix in graph bug Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !6417 merge oom into master fix(machine): Fix in graph bug Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3381 ## 1. 停核代码风险 **原因**:同一颗 AICore 上一轮还没完全收干净,下一轮又上来了。原先停核时「清槽」和「发 GOODBYE」搅在一起,甚至 GOODBYE 之后又把握手缓冲清成 0,把下一轮刚写上的 HELLO 抹掉。 **改法**:固定顺序—— 1. 先让 STOP 被对面看见 2. 再清任务槽、清 HELLO 3. 再 barrier 4. 最后只发 GOODBYE 这样下一轮不会读到脏指针,也不会被误清握手标记。 --- ## 2. Ring sync 跨 eager / aclgraph 报错 **背景**:环形缓存槽复用时「ctrl 要等前几轮 aicore」这套 ring sync,**以前已经修好了**。 **现象**:同一算子先走eager,再走 aclgraph(capture / replay),在二者跨越部分插入的notify再底层会被拦截报错,这个硬同步信号不允许跨eager和aclgraph。 **原因**:原先 eager 和图模式共用同一对 ping-pong event、同一套序号。图里已经 record 过的 event,eager 侧再 wait 会碰到图里留下的旧信号;反过来也一样。 **本次改法**: - eager 和 aclgraph **各用一套 event**(两套 ping-pong)。 - 用 epoch 区分:普通模式 epoch=0,图模式用当前 capture model;换 epoch 时 **序号清零**,图模式再分配自己的 event 池(旧图的 event 留给 replay,不和新 capture / eager 混用)。 - wait / record 时带上「是不是 capture」,只碰对应那一套 event。 - 调用收成一次 BeginRingLaunch(切 epoch → 确保 event 建好 → 取本轮序号),语义不变。 **改前(串扰)**: text ── aclgraph capture / replay ── ── eager ── ctrl [c1][c2][c3 wait 共用 E0] ... [c' wait 共用 E0] ← 可能等的是图里的旧 E0 aicore [a1][a2] E0^ E1^ ... [a'] event 同一对 E0/E1 贯穿两种模式 ─────────────────────────────► **改后(隔离)**: text ── aclgraph(epoch=model,graphEvents)── ── eager(epoch=0,eagerEvents)── ctrl [c1][c2][c3 wait gE0] ... [c' wait eE0] ← 只等 eager 自己的 eE0 aicore [a1][a2] gE0^ gE1^ ... [a'] eE0^ sequence 在图内递增;切到 eager 时 sequence 归零,两套 event 互不 wait --- ## 3. 暂时关掉「控核缩核」 **现象**:按实际 maxC/maxV 把核数缩小后,和提前下发、多轮重叠叠在一起,整网执行发现控到极小核的几个核会卡死。 **改法(临时策略)**: - Host:启动前不再按缓存里的 maxC/maxV 改小 blockdim,一律用配置的满核数。 - Device:handshake 之后不再做按任务缩核(CalcAdjAicoreEnd)。 代码里用开关挡住,实现还留着,待定位清楚后再酌情打开。 --- ## 4. Sche 分波撞到同一个 threadIdx **现象**:A5 压测报 Duplicate threadIdx(例如 cpu=3, threadIdx=1, bitmap 已占用)。 **原因**:aicpu的任务调度是NormalMode, 一次 launch 的 AICPU block 数可以大于同时能跑的核。核不够时会分波:第一波跑完退出,第二波又绑到同一批物理核,算出的 threadIdx 和第一波一样。第一波其实已经把活干完了,第二波再跑同一编号是错的,也不该当成致命错误直接失败(还可能清不掉分配状态)。 **改法**:发现 threadIdx 已被占用时,把本 block 标成丢弃(threadIdx=-1),不再进 sche,但仍正常退出凑齐人数,好清状态。顺带给真正的失败路径补了更清楚的 ERROR 日志。 See merge request: cann/pypto!6417 | 2 months 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 | |
fix(machine): Fix os throttle bug Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !5847 merge memleak into master fix(machine): Fix os throttle bug Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3203 # Device OS AICPU 节流导致调度误超时 ## 1. 背景 Device OS 对单个 AICPU 线程存在节流策略: - 连续跑约 **950ms** 后强制让出约 **50ms** - **按 AICPU 独立生效**(非整机统一掐断) - 节流期间该 AICPU 上的调度逻辑暂停;AICore 本身不受此策略直接打断 - PyPTO 超时用 cntvct_el0(GetCycles()),节流期间计时器仍前进 典型现象: - A5 启动仲裁失败:#sche.arbitration.failed: scheCpuNum=4, currentCpuNum=2, cpumask=0x88 - A2/A3 单 sche 等 ctrl 启动时偶发 WAIT_CTRL_TIMEOUT - 稳态派发偶见 ProcessTaskLoop / F72001(多为依赖断流放大后的终态,而非 50ms 本身直接打爆 10s 超时) ## 2. 问题根因 ### 2.1 直接根因 调度启动路径上存在一批 **≤50ms 的 spin 等待超时**。当被等待的 AICPU 因 OS 节流晚到时,等待方在 50µs~数 ms 内判超时,触发: - 仲裁失败(ARBIT_FAILED) - 单 sche 等 ctrl 失败(直接报错) - 或依赖解算窗口错位,后续放大成派发超时 ### 2.2 关键失败路径(A5 实测) ComputeArbitrationLevel 三级降级中,**Level 3(等 scheCpuNum 个 CPU 报到)** 原先仍用 GetArbitTimeOutVal()(ERROR 级默认 **50µs**): text AICPU 启动 → fetch_or(cpumask) → CAS 赢者跑 ComputeArbitrationLevel Level1: 等 nrAicpu (短超时,快速探测) Level2: 等 die0 cluster (短超时,快速探测) Level3: 等 scheCpuNum (原 50µs → 节流场景误失败) 现场日志 cpumask=0x88, currentCpuNum=2 含义: - 0x88 = bit3 | bit7 → 仅 CPU3、CPU7 完成登记 - popcount(0x88)=2 与 currentCpuNum=2 一致(cpumask 是位图,不是个数) - scheCpuNum=4,Level3 在 50µs 内等不到另外 2 个 AICPU → ARBIT_FAILED ### 2.3 非根因澄清 | 路径 | 是否会被 50ms 节流直接打爆 | 说明 | |---|---|---| | ProcessTaskLoop / TIMEOUT_DISPATCH | 否 | 超时约 **10s**,单次 50ms 只造成抖动 | | AICore 侧超时(aicore_entry.h) | 否 | 最短失败超时约 **13s** | | A220 降级循环 scheCpuNum→1 | 否(功能上) | 当前线程已登记 cpumask,降到 1 必成功 | | A220 WaitForScheCpuInSameCluster | 否(功能上) | 失败后走降级,不直接报错 | ## 3. 修改方案 原则:**只对“超时即功能失败、且确实在等其他 AICPU”的路径加 55ms 兜底**;可降级/快速探测路径保持短超时,避免无谓拉长启动。 ### 3.1 统一 55ms 常量 文件:framework/src/machine/device/dynamic/device_utils.h | 常量 | Cycle 数 | 平台时钟假设 | |---|---|---| | TIMEOUT_A2A3_55MS | 2750000 | A2/A3 ≈ 50MHz | | TIMEOUT_A5_55MS | 55000000 | A5 ≈ 1GHz(约为 A2/A3 的 20×) | Helper: cpp inline uint64_t GetOsThrottleSafeWaitTimeout(ArchInfo archInfo) { return (archInfo == ArchInfo::DAV_3510) ? TIMEOUT_A5_55MS : TIMEOUT_A2A3_55MS; } 55ms 略大于 OS 强制让出窗口(~50ms),用于覆盖节流误超时。 ### 3.2 A5 仲裁:仅兜底级改 55ms 文件:device_sche_alloc_thread.h WaitForCpuMaskReadyForArbitration 增加参数 osThrottleFallback: - false:继续 GetArbitTimeOutVal()(50µs~数 ms),用于 Level1/2 快速探测 - true:GetOsThrottleSafeWaitTimeout()(55ms),用于最终兜底 | 级别 | 等待目标 | 超时 | 失败后果 | |---|---|---|---| | Level1 | nrAicpu | 短 | 降级 | | Level2 | die0 cluster + 2 | 短 | 降级 | | **Level3** | **scheCpuNum** | **55ms** | **ARBIT_FAILED(功能失败)** | ### 3.3 Follower 等仲裁结果:55ms WaitForArbitrationLevel:CAS 失败者等待赢家 store(level)。 - A5 Level3 最长可阻塞约 55ms,follower 超时必须 ≥ 该时间,否则会在赢家尚未发布结果时误报失败 - 正常路径赢家很快 publish,不会固定多等 55ms ### 3.4 A220 等 ctrl:仅单 sche 用 55ms 文件:device_sche_wait_ctrl.h → CalcWaitTimeout | 场景 | 超时 | 理由 | |---|---|---| | 单 sche 等 ctrl 起来 | **55ms** | 超时 → CTRL_WAIT_FAILED,直接报错 | | 多 sche 等 ctrl 起来 | 100µs~3ms | 超时 → CTRL_WAIT_DROPPED,丢一个线程继续跑 | | 等决策终态 | 1s | 原本已足够 | ### 3.5 明确不改的路径 | 路径 | 保持短超时的原因 | |---|---| | A5 Level1/2 | 拓扑优化探测,失败即降级 | | A220 WaitForCpuMaskReadyForArbitration 降级循环 | 可降到 1,当前 CPU 已在 mask,必成功 | | A220 WaitForScheCpuInSameCluster | 失败后降级,非硬失败 | | ProcessTaskLoop / AICore 超时 | 已远大于 50ms | See merge request: cann/pypto!5847 | 2 months 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 | |
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 | |
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 | |
fix(machine): Add compile options Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !4938 merge cmake into master fix(machine): Add compile options Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 添加安全编译选项 See merge request: cann/pypto!4938 | 4 months 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 | |
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 | |
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 | |
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 |
| Files | Last commit | Last update |
|---|---|---|
| 24 days ago | ||
| 3 months ago | ||
| 5 months ago | ||
| 1 month ago | ||
| 2 months ago | ||
| 29 days ago | ||
| 1 month ago | ||
| 1 month ago | ||
| 7 months ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 7 months ago | ||
| 2 months ago | ||
| 7 months ago | ||
| 1 month ago | ||
| 1 month ago | ||
| 1 month ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 4 months ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago |