| Files | Last commit | Last update |
|---|---|---|
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 | |
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 days ago | |
test(machine): Supplement machine UT test cases_2. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !4987 merge ut_2 into master test(machine): Supplement machine UT test cases_2. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut 补充 See merge request: cann/pypto!4987 | 4 months ago | |
fix(machine): Align bundle host control-flow cache Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !7265 merge fix/bundletestbug into master fix(machine): Align bundle host control-flow cache Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: bundle加载cache时,将其复制到vector<uint_8>,未保证64字节对齐,导致偶现未对齐段错误情况,现改为使用已有的CtrlFlowCacheBlob确保对齐 源码:using CtrlFlowCacheBlob = std::vector<uint8_t, npu::tile_fwk::AlignedAllocator<uint8_t, 0x40>>; See merge request: cann/pypto!7265 | 27 days ago | |
test(machine): Supplement machine UT test cases_2. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !4987 merge ut_2 into master test(machine): Supplement machine UT test cases_2. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut 补充 See merge request: cann/pypto!4987 | 4 months 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 | |
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): Change aicpu kernel launch method Co-authored-by: wan_jianfen<wanjianfen@hisilicon.com> # message auto-generated for no-merge-commit merge: !5045 merge br_aicpuKernelLaunch into master feat(machine): Change aicpu kernel launch method Created-by: wan_jianfen Commit-by: wan_jianfen Merged-by: cann-robot Description: 改变kernel_launch 接口,更换成acl 接口 See merge request: cann/pypto!5045 | 3 months ago | |
fix(machine): Fetch remove atomic Co-authored-by: wan_jianfen<wanjianfen@hisilicon.com> # message auto-generated for no-merge-commit merge: !6997 merge br_ctu into master fix(machine): Fetch remove atomic Created-by: wan_jianfen Commit-by: wan_jianfen 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!6997 | 1 month ago | |
fix(codegen): Avoid ASC CACHE_LINE_SIZE and g_tilingKey link conflicts Co-authored-by: anyangle<anyangle@huawei.com> # message auto-generated for no-merge-commit merge: !6246 merge bugfix into master fix(codegen): Avoid ASC CACHE_LINE_SIZE and g_tilingKey link conflicts Created-by: quadrate Commit-by: anyangle Merged-by: cann-robot Description: **根因:** 使能 ASC print/dump后,检测到 $ASCEND_HOME_PATH/asc/include 就默认注入 -D__ENABLE_ASC_PRINTF__,entry/leaf/mid 都会拉 ASC 调试头。新 ASC 头依赖变了,旧包碰不到的符号被编进 PyPTO 多 TU 链接路径,于是炸了两层:CCE上报 CACHE_LINE_SIZE 宏与 ASC const 冲突(F70002);ld -r 时报 g_tilingKey 强符号重复(F70003)。**本质是 CANN ASC 版本问题** **修复:** 1. CACHE_LINE_SIZE 改为 AicorePrintConst::CACHE_LINE_SIZE,避免与 ASC 常量冲突。 2. 用 -DTILING_KEY_VAR=0(头文件内再兜底)抑制 g_tilingKey 多 TU 重复定义。 3. PYPTO_ENABLE_AICORE_PRINT=true 才注入 __ENABLE_ASC_PRINTF__,默认关闭,不再拉 ASC dump/printf 头;打开后 1/2 仍作兼容。 See merge request: cann/pypto!6246 | 2 months ago | |
feat(machine): Add log level control and timestamp to aicore print Co-authored-by: wan_jianfen<wanjianfen@hisilicon.com> # message auto-generated for no-merge-commit merge: !5352 merge feat/aicore-log-level-control into master feat(machine): Add log level control and timestamp to aicore print Created-by: wan_jianfen Commit-by: wan_jianfen Merged-by: cann-robot Description: ## 关联 Issue Closes #2915 ## 改动说明 为 AICore Print 系统添加日志级别控制、时间戳记录和专用 host 输出宏。 ### 改动内容 1. **日志级别控制** - 新增 AicoreLogLevel 枚举(DEBUG/INFO/WARN/ERROR/NONE) - LogContext 新增 logLevel 字段,由 DevDfxArgs.logLevel(host 侧 dlog_getlevel)传递到 device - AicoreLogger::Init() 接收 level 参数并写入 ctx_.logLevel - 新增 AICORE_LOGD/LOGI/LOGW/LOGE 宏,参照 DEV_INFO/DEV_DEBUG 模式按级别过滤 2. **时间戳记录** - 新增 TimestampMarker TLV 记录类型 - AiCoreLogFWithLevel 中通过 get_sys_cnt() 编码 device 侧周期计数器值 - Host 侧 Read() 解码时间戳并通过 outTimestamp 参数返回 3. **Host 侧专用日志宏** - LogModule 枚举新增 AICORE - 新增 AICORE_HOST_LOGD/LOGI/LOGW/LOGE 宏,不带 host file:line 前缀,使用 device cycle 作为时间戳 - DumpAicoreLog 按级别 switch 调用对应宏 4. **MAX_DIMS 重定义修复** - core_func_data.h 的 MAX_DIMS=8 重命名为 MAX_TENSOR_INFO_DIMS,避免与 layout.h 的 MAX_DIMS=5 冲突 ### 输出格式示例 [core-0][cycle=1234567890][INFO] === After TLoad === [core-0][cycle=1234567895][DEBUG] gmTensor_1 addr=0x... [core-0][cycle=1234567900][INFO] === After TAdd === ### 文件变更 | 文件 | 改动 | |------|------| | aicore_print_base.h | AicoreLogLevel 枚举、LogContext.logLevel、LogLevelMarker/TimestampMarker DataType | | aicore_print_logger.h | Init() 接收 level、EncodeLogLevel/EncodeTimestamp、Read() 返回 level+timestamp | | aicore_print.h | AiCoreLogFWithLevel、AICORE_LOGD/LOGI/LOGW/LOGE 宏 | | aicore_print_host_decode.h | DecodeLogLevelMarker | | aicore_entry.h | KernelEntry 读取 DevDfxArgs.logLevel 传入 InitCtx | | tilefwk_log.h | LogModule 新增 AICORE | | pypto_fwk_log.h | AICORE_HOST_LOGD/LOGI/LOGW/LOGE 宏 | | aicore_print_host_manager.cpp | DumpAicoreLog 按级别+时间戳输出 | | core_func_data.h | MAX_DIMS → MAX_TENSOR_INFO_DIMS | ## 验证方式 1. 设置 ASCEND_GLOBAL_LOG_LEVEL=1(INFO),运行用例,grep "AICORE" ./wk 验证仅 INFO 及以上级别输出 2. 设置 ASCEND_GLOBAL_LOG_LEVEL=0(DEBUG),验证 DEBUG 日志出现 3. 验证每条日志带 [cycle=N] 时间戳 See merge request: cann/pypto!5352 | 3 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 | |
test(machine): Supplement machine UT test cases_9. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5285 merge ut_10 into master test(machine): Supplement machine UT test cases_9. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut覆盖率补充 See merge request: cann/pypto!5285 | 3 months ago | |
fix(dfx): Fix machine err without interrupting the process Co-authored-by: meiqing2<meiqing2@hisilicon.com> # message auto-generated for no-merge-commit merge: !4122 merge assert into master fix(dfx): Fix machine err without interrupting the process Created-by: meiqing2 Commit-by: meiqing2 Merged-by: cann-robot Description: 部分machine error没有中断流程,先加assert规避,Q3统一整改 部分machine error无需中断,改为machine warning See merge request: cann/pypto!4122 | 5 months ago | |
feat(machine): Add basic data structure header for cord. Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !5349 merge cord-data into master feat(machine): Add basic data structure header for cord. Created-by: yinjie27_ Commit-by: Jie Yin Merged-by: cann-robot Description: feat(machine): Add basic data structure header for cord. See merge request: cann/pypto!5349 | 3 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 | |
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): report AICPU exceptions through the error queue Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !6099 merge fix/aicpu-exception-report into master fix(machine): report AICPU exceptions through the error queue Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 异常回调函数中异常信息入队后,直调outputerrormessage,将首条报错打屏 See merge request: cann/pypto!6099 | 2 months ago | |
fix(runtime): dump tensors for extended AICore launch arguments Co-authored-by: hubowen<hubowen17@huawei.com> # message auto-generated for no-merge-commit merge: !7311 merge fix/aicerr_noinput into master fix(runtime): dump tensors for extended AICore launch arguments Created-by: W4termy Commit-by: hubowen Merged-by: cann-robot Description: kernel启动参数扩展,argsize将会大于56,而异常dump严格校验argsize=56导致dump流程被跳过 See merge request: cann/pypto!7311 | 24 days 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 | |
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 days ago | |
style(all): Remove trailing whitespace and add missing EOF newlines Co-authored-by: junjieHuang<huangjunjie38@h-partners.com> # message auto-generated for no-merge-commit merge: !4916 merge style-cpp into master style(all): Remove trailing whitespace and add missing EOF newlines Created-by: junjieHuang Commit-by: junjieHuang Merged-by: cann-robot Description: Remove trailing whitespace and add missing EOF newlines See merge request: cann/pypto!4916 | 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 | |
fix(machine): Optimize Assemble outcast workspace Co-authored-by: songyangyang18<songyangyang18@huawei.com> # message auto-generated for no-merge-commit merge: !6682 merge bound into master fix(machine): Optimize Assemble outcast workspace Created-by: songyangyang18 Commit-by: songyangyang18 Merged-by: cann-robot Description: ## 背景 原先 Assemble 工作区预算按整图 NeedAlloc Assemble 总数来算,再乘上 stitch 深度。多 loop、多 root 时 Assemble 往往分布不均:有的 root 写多个 Assemble,有的只写一个,有的只读。用全局总数去乘深度,容易把 InnerTemporal 池估大。 实际运行里 Submit 会对 Assemble 做回收,同一深度上真正同时占用的,更接近「单个 root 上 NeedAlloc Assemble 的峰值」,而不是整图加总。 ## 方法 Collect 每个 encode root 时,用该 root 已有的 Assemble slot 列表(encode 阶段写入的 redaccAssembleSlotList)与全局 NeedAlloc 集合求交,得到这个 root 上真正需要分配的 Assemble 个数,再取所有 root 的最大值,记为 maxRootAssembleOutcastSlot。 公式变化(E 为 Exclusive 槽位数,A 为整图 NeedAlloc Assemble 数,A_max 为各 root 峰值,k 为 stitch 深度): 改前: - Boundary = (E_total + A_total) × 2 - InnerTemporal = A_rootmax × k × 2 改后: - Boundary = E_total × 2 - InnerTemporal = A_rootmax × k + A_total ## 结果 当 A_max 小于 A 时,InnerTemporal 相对旧公式会减小,减轻工作区高估。 单测覆盖典型场景:第一个 loop 写两个 Assemble,第二个写一个,第三个只读。此时 A = 3,A_max = 2,k = 8,改后 InnerTemporal = 2×8+3 = 19。 See merge request: cann/pypto!6682 | 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 | |
feat(machine): Support host ctrlflow cache by jit Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !5741 merge dev-host-ctrl-jit into master feat(machine): Support host ctrlflow cache by jit Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 1、支持通过 jit ready_on_host_tensors 配置 npu_name: cpu_name 传入配对关系,算子 kernel 传入值依赖 tensor 对应的 cpu tensor 2、支持传入值依赖 tensor 场景下在 host 侧做 controlflow cache See merge request: cann/pypto!5741 | 2 months ago | |
perf(machine): Move task-level fields to DynFuncHeader and isolate debug-only code Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !5588 merge perf/move-task-fields-to-dynfuncheader into master perf(machine): Move task-level fields to DynFuncHeader and isolate debug-only code Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: perf(machine): Move task-level fields to DynFuncHeader and isolate debug-only code ## 优化概述 将 task 级字段从 DynFuncData 移至 DynFuncHeader(每 task 一次赋值,而非每 func),缩小 per-func 结构体大小;隔离 debug-only 和 host-only 代码路径。 ## 优化点 ### 1. Task 级字段上移 - startArgs / stackWorkSpaceAddr / stackWorkSpaceSize 从 DynFuncData 移至 DynFuncHeader - FillOneDynFuncData 移除 startArgs / workspace 参数,在 BuildDynFuncData 中一次性赋值到 header - Reloc/backup/restore 在 header 层执行(每 task 一次,非每 func) ### 2. Debug-only 代码隔离 - CheckAddrAligned 和 leafFunc 统计包裹在 DEV_IF_DEBUG 中 - host-only 字段(exprNum / opAttrSize / rawTensorAddrSize / rawTensorDescSize)包裹在 DEV_IF_NONDEVICE 中 ### 3. 局部变量提取 - dupFunc.GetSource() 提取为局部变量 source(13 次调用 → 1 次) ### 4. CoreFuncParam 扩展 - funcHeader 指针加入 CoreFuncParam,供 AICORE kernel 直接访问 ### 5. 仿真器适配 - DynPvModelImpl::RunModel 构造 DynFuncHeader + DynFuncData 连续内存写入 GM,适配新的 kernel entry 签名 Changes: - Move startArgs/stackWorkSpaceAddr/stackWorkSpaceSize from DynFuncData to DynFuncHeader - Add funcHeader pointer to CoreFuncParam for AICORE kernel access - Update all consumers (aicore_entry, aicore_runtime, ctrlflow_cache, device_execute_context, PvModelImpl) to read from header - Wrap CheckAddrAligned and leafFunc stats in DEV_IF_DEBUG - Wrap host-only fields in DEV_IF_NONDEVICE - Extract dupFunc.GetSource() into local variable - Adapt DynPvModelImpl RunModel to construct DynFuncHeader for simulation Extracted from PR #5382 as independent commit, rebased onto latest master. Related Issues: #5382 See merge request: cann/pypto!5588 | 3 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 | |
fix(machine): Add value depend check for ifstmt Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !7361 merge dev-fix-host-ctrl into master fix(machine): Add value depend check for ifstmt Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 检测值依赖和 insert wait_aicore_start 的时候,增加 ifstmt 的检测 See merge request: cann/pypto!7361 | 25 days ago | |
fix(machine): Add mainblock leaf conds Co-authored-by: yanggen<yanggen4@hisilicon.com> # message auto-generated for no-merge-commit merge: !4807 merge master into master fix(machine): Add mainblock leaf conds Created-by: yanggen Commit-by: yanggen Merged-by: cann-robot Description: 问题背景: 当前主尾块判断条件是遍历所有的coalist,从中读取shape与validshape值;但是OP_RESHAPE_COPY_OUT/IN,OP_VEC_DUP / OP_RANGE / OP_TRIUL / OP_UNIFORM等算子,会在coalist后面增加一些额外信息,导致现有直接从coalist中取shape等会校验失败; 整改方案: 修改validshape读取逻辑,不直接遍历所有的coalist,遍历所有io的iop以及oop,然后通过GetIOpAttrOffset与GetOOpAttrOffset获取coaindex,然后根据index值读取对应的validshape值 See merge request: cann/pypto!4807 | 4 months ago | |
fix(tensor): Calculate data size from data type bits Co-authored-by: zhaojunhan<zhaojunhan1@huawei.com> # message auto-generated for no-merge-commit merge: !5044 merge fix-tensor-data-size-bits into master fix(tensor): Calculate data size from data type bits Created-by: zhaojunhan Commit-by: zhaojunhan Merged-by: cann-robot Description: fix(tensor): Calculate packed tensor data size by bits 新增 DataSizeOf,统一根据元素数量和数据类型的 bit 位宽计算实际存储大小: 将 LogicalTensor、RawTensor、DeviceTensor 及 workspace 相关计算统一切换到 DataSizeOf,避免使用 BytesOf 时将 4-bit 元素按 1 byte 计算。 See merge request: cann/pypto!5044 | 4 months ago | |
test(machine): Supplement machine UT test cases_9. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5285 merge ut_10 into master test(machine): Supplement machine UT test cases_9. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut覆盖率补充 See merge request: cann/pypto!5285 | 3 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 | |
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 AICPU PMU profiling Co-authored-by: anyangle<anyangle@huawei.com> # message auto-generated for no-merge-commit merge: !3023 merge aicpu_pmu_ioctl_2 into master feat(machine): Support AICPU PMU profiling Created-by: quadrate Commit-by: anyangle Merged-by: cann-robot Description: 支持调用perf_event_open接口采集AICPU PMU性能 See merge request: cann/pypto!3023 | 6 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): Support host ctrlflow cache by jit Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !5741 merge dev-host-ctrl-jit into master feat(machine): Support host ctrlflow cache by jit Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 1、支持通过 jit ready_on_host_tensors 配置 npu_name: cpu_name 传入配对关系,算子 kernel 传入值依赖 tensor 对应的 cpu tensor 2、支持传入值依赖 tensor 场景下在 host 侧做 controlflow cache See merge request: cann/pypto!5741 | 2 months ago | |
fix(machine): Fix dump perf data under multi-round by another way Co-authored-by: arthur_morgan_hw<lipeijie@huawei.com> # message auto-generated for no-merge-commit merge: !3917 merge br_runtime into master fix(machine): Fix dump perf data under multi-round by another way Created-by: arthur_morgan_hw Commit-by: arthur_morgan_hw Merged-by: cann-robot Description: 1. 原本这个问题,在跑多轮情况下,只有第一轮dump的原因是只有第一轮从C侧获取的runtime_debug_mode是1,后续多轮获取的都是0,导致只有第一轮会同步数据,后续不会同步数据。 2. 之前修复方式是还原之前的代码逻辑,即从py侧触发的kernel launch每次都强制去同步数据。 3. 现在进一步定位发现,py侧的options同步给C侧只有在触发编译的时候才会做,多轮的情况下,只有第一轮才会触发编译,后续多轮复用第一次的编译结果。因此修复方案即为同步options给C侧的调用,每次都会调用,而不是只在编译的时候才调用。 See merge request: cann/pypto!3917 | 5 months ago | |
test(machine): Supplement machine UT test cases_9. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5285 merge ut_10 into master test(machine): Supplement machine UT test cases_9. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut覆盖率补充 See merge request: cann/pypto!5285 | 3 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 | |
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 | |
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 |
| Files | Last commit | Last update |
|---|---|---|
| 2 months ago | ||
| 26 days ago | ||
| 4 months ago | ||
| 27 days ago | ||
| 4 months ago | ||
| 24 days ago | ||
| 7 months ago | ||
| 3 months ago | ||
| 1 month ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 1 month ago | ||
| 3 months ago | ||
| 5 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 24 days ago | ||
| 4 months ago | ||
| 1 month ago | ||
| 26 days ago | ||
| 4 months ago | ||
| 1 month ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 25 days ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 7 months ago | ||
| 6 months ago | ||
| 1 month ago | ||
| 2 months ago | ||
| 5 months ago | ||
| 3 months ago | ||
| 1 month ago | ||
| 24 days ago | ||
| 4 months ago |