| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
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 个月前 | |
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 个月前 | |
fix(machine): Fix machine shedule perf Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !6712 merge fix/aicpu-sync-mode-if-branch into master fix(machine): Fix machine shedule perf Created-by: wan_jianfen Commit-by: LordOfMysteries Merged-by: cann-robot Description: PR 应该避免没有描述信息,描述信息的最重要的作用是描述修改意图,应该清晰明了。例如:标题中包含了 fix 标签,如果没有描述信息,就需要Review人员猜测PR具体修复了哪些内容,或者怀疑修改的必要性。如果PR和特定的Issue相关,可以单独包含一行 Related Issue: 放到描述信息最后。 下面是一个典型的PR描述信息: The origin issue template brings too many noise, it's not suitable for git message. eg: comments are not removed, labels are redundant as the PR tile already contains the tag. The guide gives a clear suggestion on how to write the PR body. Related Issue: #1234,#5678 更多描述信息见:[Commit Message 规范](../docs/zh/contribute/pull-request.md#commit-message) See merge request: cann/pypto!6712 | 2 个月前 | |
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 个月前 | |
test(machine): Supplement machine UT test cases_6. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5244 merge ut_7 into master test(machine): Supplement machine UT test cases_6. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut补充 See merge request: cann/pypto!5244 | 3 个月前 | |
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 个月前 | |
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 个月前 | |
perf(machine): Balance static wrap remainder against dynamic fetch Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !7318 merge master into master perf(machine): Balance static wrap remainder against dynamic fetch Created-by: lululu40888 Commit-by: LordOfMysteries Merged-by: cann-robot Description: PR 应该避免没有描述信息,描述信息的最重要的作用是描述修改意图,应该清晰明了。例如:标题中包含了 fix 标签,如果没有描述信息,就需要Review人员猜测PR具体修复了哪些内容,或者怀疑修改的必要性。如果PR和特定的Issue相关,可以单独包含一行 Related Issue: 放到描述信息最后。 下面是一个典型的PR描述信息: The origin issue template brings too many noise, it's not suitable for git message. eg: comments are not removed, labels are redundant as the PR tile already contains the tag. The guide gives a clear suggestion on how to write the PR body. Related Issue: #1234,#5678 更多描述信息见:[Commit Message 规范](../docs/zh/contribute/pull-request.md#commit-message) See merge request: cann/pypto!7318 | 26 天前 | |
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 个月前 | |
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 个月前 | |
test(machine): Supplement machine UT test cases_12. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5361 merge ut_12 into master test(machine): Supplement machine UT test cases_12. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut补充 See merge request: cann/pypto!5361 | 3 个月前 | |
feat(machine): Enable launch early start Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !5968 merge dev-launch-early into master feat(machine): Enable launch early start Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 1、A5 最大调度线程改为 4 2、在 launch_early_start 未设置的时候,如果没有值依赖或者配置了 ready on host tensor 则改为 capture 模式下开启提前发射 See merge request: cann/pypto!5968 | 2 个月前 | |
tests(machine): Migrate ST cases to UT and Python ST. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5649 merge ST into master tests(machine): Migrate ST cases to UT and Python ST. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: CPP ST 整改;部分删除;部分改成ut;部分重写成python st See merge request: cann/pypto!5649 | 3 个月前 | |
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 个月前 | |
perf(machine): Lazy-init ItemPool free-list in chunks Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !5004 merge perf/item-pool-lazy-init into master perf(machine): Lazy-init ItemPool free-list in chunks Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2597 perf(machine): Bump-allocate virgin ItemPool slots without freelist Defer ItemPool slot activation until first use. Virgin slots are taken by bumping initReadyCount (no freelist link/pop). Freelist is only used for slots returned by Destroy. Changes: - Remove chunked LinkFreeListChunk / EnsureFreeSlotAvailable expansion - Create: freelist hit for recycled slots, else bump high-water mark - Rename count_ / ItemPoolMeta.count to size_ - UT covers bump + recycle reuse Related Issues: N/A See merge request: cann/pypto!5004 | 4 个月前 | |
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 个月前 | |
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 个月前 | |
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 个月前 | |
feat(pypto_pro):unified error codes Co-authored-by: huanyongben<huanyongben1@hisilicon.com> # message auto-generated for no-merge-commit merge: !6453 merge master into master feat(pypto_pro):unified error codes Created-by: huanyongben Commit-by: huanyongben Merged-by: cann-robot Description: pypto pro整改错误码以及日志规范 See merge request: cann/pypto!6453 | 2 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 4 个月前 | ||
| 3 个月前 | ||
| 4 个月前 | ||
| 3 个月前 | ||
| 26 天前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 1 个月前 | ||
| 4 个月前 | ||
| 4 个月前 | ||
| 1 个月前 | ||
| 7 个月前 | ||
| 2 个月前 |