| 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 | |
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 months 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 | |
refactor(machine): Remove unused DevicePerf::RunPrepare Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !6924 merge pgo-framework into master refactor(machine): Remove unused DevicePerf::RunPrepare Created-by: yinjie27_ Commit-by: Jie Yin Merged-by: cann-robot Description: DevicePerf::RunPrepare has no production caller: its only call site was removed together with the legacy DeviceRunner launch path in 34770d5bd ("Unify C++ launch path to use KernelBinary and LaunchKernel"). The per-launch refresh of the perf data pointers is already handled by DeviceLauncher::SetDevPerfAddr -> DevicePerf::SetDebugEnable, which runs on every launch (device_launcher.cpp), so RunPrepare is dead code. Changes: - Remove the unused DevicePerf::RunPrepare definition and declaration - Remove the DevicePerfTest.RunPrepare_DebugMode unit test - Remove the include that became unused after the deletion Verification: - device_perf.cpp syntax-checked with the project's own compile flags (build/compile_commands.json), UT file checked with the same flags + gtest - pre-commit checks passed on commit See merge request: cann/pypto!6924 | 1 month 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 | |
test(dfx): validate log calendar conversion against libc across 101 years Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !6701 merge fix/log_localtime into master test(dfx): validate log calendar conversion against libc across 101 years Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 日期算法补充前后50年与libc接口结果对比ut See merge request: cann/pypto!6701 | 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): 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 | |
feat(indexing): Support A5 SIMT gather and index put Co-authored-by: bynshard<zhangbingshuai@huawei.com> # message auto-generated for no-merge-commit merge: !5404 merge feat/a5-simt-mixed into master feat(indexing): Support A5 SIMT gather and index put Created-by: bynshard Commit-by: bynshard Merged-by: cann-robot Description: gather indexput 支持的simt 实现,在离散场景下提升性能 当 Gather 的 source 位于 GM、indices 位于 UB 时,A5 Codegen 会选择 SIMT MGATHER 实现: 1. 使用 SIMD 批量计算 Gather 的元素偏移。 2. 使用 SIMT MGATHER 根据偏移直接从 GM source 读取数据。 3. source 位于 UB 时继续使用原有实现。 4. int64 indices 暂不使用 SIMT,回退到原有 Scalar 实现。 同时补充了 SIMT Kernel 的端到端识别与下发机制: 1. Pass 识别需要 SIMT 的 Gather,并设置 requiresSimt 属性。 2. 将 requiresSimt 信息传递到 Device Program 和编译流程。 3. 为包含 SIMT 的 A5 Kernel 生成相应的 ELF metadata。 4. Runtime 根据 Kernel 是否包含 SIMT,选择对应的 UB 配置。 5. SIMT Kernel 配置 216 KB 动态 UB,并为 DCache 预留 32 KB。 6. 纯 SIMD Kernel 保持原有 Runtime 下发方式和 UB 配置。 此外,完善了 GM GatherElement 在内存类型推导、动态参数注册、动态 valid shape 处理和 OoO 调度中的支持。 Related Issue: #3162 ``` 更多描述信息见:[Commit Message 规范](../docs/zh/contribute/pull-request.md#commit-message) See merge request: cann/pypto!5404 | 2 months 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 | |
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 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 | |
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(machine): prevent offline exception dump segfault on bundle launch Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !5936 merge fix/exception-dump-offline into master fix(machine): prevent offline exception dump segfault on bundle launch Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: 修复单算子复现出现段错误的问题 当前bundle启动时会将kername写到opname中,在进行异常复现时先读取opname中的名称,避免由于bundle不走前端而导致的lastfunc为空指针的情况 See merge request: cann/pypto!5936 | 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 | |
fix(machine): Validate SetDebugEnable return value across call chain Co-authored-by: wan_jianfen<wanjianfen@hisilicon.com> # message auto-generated for no-merge-commit merge: !5788 merge fix-validate-perf-retval into master fix(machine): Validate SetDebugEnable return value across call chain Created-by: wan_jianfen Commit-by: wan_jianfen Merged-by: cann-robot Description: fix(machine): Validate SetDebugEnable return value across call chain DevicePerf::SetDebugEnable invokes RuntimeMemcpyDirect three times (H2D perf data, D2H devDfxArg, H2D devDfxArg) without checking the return value. When a copy fails, execution continues with stale data, e.g. setting profLevel and writing it back to the device based on a failed D2H read. This patch propagates the return code through the whole call chain (SetDebugEnable -> SetDevPerfAddr -> LaunchKernel / LaunchBundleKernelOnce) so that any copy failure aborts the subsequent logic immediately. Changes: - Change DevicePerf::SetDebugEnable / InitPerfData / SetDevPerfAddr return type from void to int and capture RuntimeMemcpyDirect results - Log RtErr::RT_MEMCPY_FAILED with context (core id, kind, size, ptrs) and return early on copy failure - Move perf data lazy-init (g_isInitPerfData) into SetDebugEnable and drop the redundant InitPerfData() call from InitAndStartDumpThread - Guard LaunchKernel with MACHINE_ASSERT on SetDevPerfAddr result and early-return in LaunchBundleKernelOnce on non-RT_SUCCESS - Guard InitAicorePrint and aicore-print path behind ENABLE_AICORE_PRINT Verification: 3 production TUs and 3 affected test TUs compiled incrementally. (A full cmake build fails due to a stale build cache referencing the removed tile_fwk_operator target since commit 1dab31e13; re-running cmake configuration fixes it and is unrelated to this change.) Related Issues: #3168 See merge request: cann/pypto!5788 | 3 months ago | |
perf(machine): Rework DRCO local matrix to merged u64 pair-word per core type Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !6835 merge master into master perf(machine): Rework DRCO local matrix to merged u64 pair-word per core type Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: perf(machine): Rework DRCO local matrix to merged u64 pair-word per core type See merge request: cann/pypto!6835 | 1 month 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 | |
test(machine): Supplement machine UT test cases_10. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5300 merge ut_11 into master test(machine): Supplement machine UT test cases_10. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: machine ut补充 See merge request: cann/pypto!5300 | 3 months 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 | |
feat(Pass): Assume_divisible for dual_dst Co-authored-by: gggxinmeng<guoxinmeng@huawei.com> # message auto-generated for no-merge-commit merge: !5527 merge dualdst_dynvalidshape_2 into master feat(Pass): Assume_divisible for dual_dst Created-by: gggxinmeng Commit-by: gggxinmeng Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2858 # OoO阶段无法对动态validshape进行比较,导致dualdst使能失败 动态切分轴的逐 tile validShape 通常由编译器推导为: text min(max(rawShape - offset, 0), tileShape) 例如两个相邻半块可能分别得到: text min(max(vm, 0), TILE_M) min(max(vm - TILE_M, 0), TILE_M) InferDynShape::RecordStaticValidShapeOnL0CCopyUB 会在后续 InferShape 把 shape 归一化为动态表达式之前,将全 concrete 的 valid shape保存到 staticValidShape。但只要任意一维仍含动态成分,快照就整体跳过,DualDst 只能回退到动态表达式比较。 上述两个相邻半块的表达式 dump 不同,而且都没有 concrete 值,DynShapeEq 无法证明它们相等,因此 pair 识别失败。即使业务实际保证 vm 总是 TILE_M 的整数倍、两个半块运行时一定都是完整 tile,编译器仍然缺少这一事实。 根因不是 DualDst 搬运或 codegen 不支持,而是前端没有 Interface 表达“运行时标量可被 tile 整除”,编译期也就无法把逐 tile valid shape证明为静态满块。 # 方案目标 1. 允许用户显式声明某个运行时表达式一定能被指定 tile 整除; 2. 编译器依据该声明证明相关 validShape 恒等于完整 tile,并把它静态化; 3. 在 InferShape 归一化之前让 staticValidShape 快照命中,使现有 DualDst 识别和融合逻辑直接受益; 4. 融合后仅静态化切分轴,保留非切分轴原有 valid shape; 5. 在调试模式下生成运行时取模断言,帮助发现错误的用户声明; 6. 没有假设或证明条件不足时保留原动态表达式,不强行融合。 本方案解决的是“编译器缺少业务整除信息”的问题,而不是自动识别主块和尾块。它是一份由用户提供、编译器信任的语义契约。 # 总体设计 完整链路如下: text Python 用户代码 │ assume_divisible(expr, 128) ▼ Function 保存整除假设 │ expression -> {divisors} ▼ InferDynShape 证明 validShape 恒为 tile │ min/max/add/sub/mul + offset/cap 对齐证明 ▼ 动态 validShape -> 静态 tileShape │ 同步 Tensor 与需要保持一致的 Op attribute ▼ RecordStaticValidShapeOnL0CCopyUB │ 写入 staticValidShape ▼ 现有 DualDst 匹配与融合 │ 保留非切分轴的动态 validShape ▼ 现有 leaf / codegen / dev_encode / runtime 流程 调试模式 runtime_debug_mode=4: Function 中的显式假设 -> 生成 expr % divisor == 0 运行时断言 See merge request: cann/pypto!5527 | 2 months 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(distributed): Optimize performance of shmem wait until operation. Co-authored-by: liuyibin<liuyibin5@huawei.com> # message auto-generated for no-merge-commit merge: !3413 merge aicpu_pr into master feat(distributed): Optimize performance of shmem wait until operation. Created-by: liuyibin Commit-by: liuyibin Merged-by: cann-robot Description: 优化shmem_wait_until性能: 1.将shmem_wait_until的prepare任务提前至control flow阶段 2.支持多aicpu调度shmem_wait_until 3.shmem_wait_until支持多device task并行 See merge request: cann/pypto!3413 | 6 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 | |
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 | |
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 | |
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 | ||
| 2 months ago | ||
| 4 months ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 7 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 5 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 7 months ago | ||
| 6 months ago | ||
| 6 months ago | ||
| 2 months ago | ||
| 5 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 4 months ago |