| Files | Last commit | Last update |
|---|---|---|
fix(machine): guard AOT runtime callbacks to catch host DEV_ASSERT before terminate Co-authored-by: anyangle<anyangle@huawei.com> # message auto-generated for no-merge-commit merge: !6933 merge error_log into master fix(machine): guard AOT runtime callbacks to catch host DEV_ASSERT before terminate Created-by: quadrate Commit-by: anyangle Merged-by: cann-robot Description: 背景:仿真(host Machine + AOT control flow)跑用例时,业务侧出现 workspace / stitch 类失败并进入ASSERT流程后,进程不是抛出 Python 异常,而是终端裸打屏:ErrCode: F7…! Enum: … + Caught exception: '…';并且测试框架进程被kill,无法继续处理后续流程  根因:C++ 异常throw要穿过 AOT 那些栈帧才能回到 pybind、变成 Python 异常;AOT 裸代码没有可用的异常展开信息(无 EH unwind)→ 穿不过 → std::terminate。 解决方案:在 RunControlFlow 组装 runtimeCallList 时(仅 host / #if !defined(__DEVICE__)),不直接挂裸的 DeviceExecuteRuntimeCall*,而是挂统一 Guard。Device侧保持不变,因为device侧的assert行为是直接abort 期望报错:  Related issue:https://gitcode.com/cann/pypto/issues/3580 ## 补充:与现有异常机制的区别 & AOT ErrorState 传递 ## 与现有异常机制的区别 | 维度 | AOT Guard(本 PR) | 现有非 AOT 机制 | |---|---|---| | 为何存在 | AOT CF **无 EH unwind**,异常不能穿回 CF 帧 | Host 有完整 EH,可正常 throw/catch | | 拦截位置 | 每个 runtime call trampoline(CF↔host 边界) | HostMachine 线程、pybind translator、TerminateHandler 等上层边界 | | catch 之后 | SetErrorState(DEVICE_MACHINE_ERROR) + 日志 + **返回哨兵**,不再上抛 | 继续当异常传播,或 task->SetError(e.what()),或转成 Python 异常 | | 保存内容 | 只存 errorState_(int);what() 仅打日志 | 常存错误字符串(MachineTask / ErrorManager);Python 侧为解释器异常 | | Device 侧 | 模板直通,无 Guard | DEV_ASSERT → abort(),无异常对象 | ## AOT 中异常 → ErrorState 传递过程 Host 路径:DEV_ASSERT → MACHINE_ASSERT → throw npu::tile_fwk::Error(Error 继承 std::exception)。 RunControlFlow: originalErrorState = GetErrorState() // 通常为 OK CallControlFlow(...) └─ CF 调 runtimeCallList[stage] └─ RuntimeCallEntry catch(std::exception) ├─ SetErrorState(DEVICE_MACHINE_ERROR) // OK → ERROR ├─ DEV_ERROR(..., e.what()) └─ return AotRuntimeCallFailureSentinel(stage) · ROOT_ALLOC/STITCH → RUNTIME_FUNCKEY_ERROR · GET_DIE_ID → &ctx->loopDieId_(避免空指针解引用) · 其余 → nullptr (CF 后续 PushTask 见 errorState_!=OK 则不再真正推任务) finalErrorState = GetErrorState() // ERROR final != original 且 final != OK → return DEVICE_MACHINE_ERROR 上层 device_ctrl 等仍可通过 GetErrorState() 感知失败。异常对象在 trampoline catch 结束后销毁,**不会**再以 C++ 异常形式二次抛出。 See merge request: cann/pypto!6933 | 24 days ago | |
feat(machine): Add new memory pool for dupped_stitch Co-authored-by: duanhaotian<duanhaotian@huawei.com> # message auto-generated for no-merge-commit merge: !6534 merge duanhaotian18 into master feat(machine): Add new memory pool for dupped_stitch Created-by: duanhaotian Commit-by: duanhaotian Merged-by: cann-robot Description: text Host 编码 CalcStitchWorkspace 共享 stitch 池,不再含 << 4 CalcDuppedStitchWorkspace 独立池 = 页大小 << 2 memBudget.metadata.duppedStitchPool / duppedStitchSlabSize | Launch FillDeviceRuntimeOffset 在 stitch 池之后铺 duppedStitchPoolOffset DevStartArgs 填 duppedStitchPoolAddr = runtime 基址 + offset | Device 初始化 InitMetadataAllocators InitAicpuDuppedStitchSlabAllocator 只注册 WsAicpuSlabMemType::DUPPED_STITCH | 运行中 AllocateStitch -> SlabAlloc(DUPPED_STITCH) -> duppedStitchSlab.Alloc Alloc 成功:allocatedObjCount++,unPopAllocatedObjCount++,挂上 stage 链表 | 切窗 活节点达到 80% SubmitToAicoreAndRecycleMemory SlabGetStageAllocMem -> PopStageAllocMem objCnt = 本窗 unPopAllocatedObjCount 记入 DynDeviceTask.taskStageAllocMem.duppedStitchStageMem | 回收 DeviceTaskMemTryRecycle FreeStageAllocMem:allocatedObjCount -= objCnt,节点回到 freeList 针对 slab metadata 共享内存池中的 type 间资源侵占问题,当前已有的问题中主要导致侵占的元数据是不可评估的DUPPED_STITCH,另外,当前因为DUPPED_STITCH不易评估因此预留了较大的内存池,针对这类不可评估的元数据问题考虑的方案是独立内存池并在即将使用完时直接submit | 算子 |pre ringbuffer | after ring buffer| 减少 | 降幅 | pre metadatasize | after metadatasize | metadata减少 | |---|---:|---:|---:|---:|---:|---:|---:| | glm_attention low_latency | 126,395,688 (120.54 MiB) | 76,168,744 (72.64 MiB) | 50,226,944 (47.90 MiB) | 39.7% | 31,598,904 | 19,042,168 | 12,556,736 | | glm_attention high_throughput | 138,460,904 (132.04 MiB) | 88,270,824 (84.18 MiB) | 50,190,080 (47.87 MiB) | 36.2% | 34,615,216 | 22,067,696 | 12,547,520 | | flash_attention_mha pre_training | 123,784,616 (118.05 MiB) | 73,551,528 (70.14 MiB) | 50,233,088 (47.91 MiB) | 40.6% | 30,946,136 | 18,387,864 | 12,558,272 | | interleave_rope low_latency | 103,559,208 (98.76 MiB) | 53,270,824 (50.80 MiB) | 50,288,384 (47.96 MiB) | 48.6% | 25,889,784 | 13,317,688 | 12,572,096 | See merge request: cann/pypto!6534 | 1 month ago | |
refactor(machine): Simplify mix send path and drop dead WrapManager APIs Co-authored-by: anyangle<anyangle@huawei.com> # message auto-generated for no-merge-commit merge: !5070 merge mix_combine into master refactor(machine): Simplify mix send path and drop dead WrapManager APIs Created-by: quadrate Commit-by: anyangle Merged-by: cann-robot Description: Mix调度逻辑优化 Related Issue:[2847](https://gitcode.com/cann/pypto/issues/2847) See merge request: cann/pypto!5070 | 3 months ago | |
perf(machine): Speed up host ctrl-flow cache build Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !7190 merge optimize/ctrlflow-cache-skip-unused-memset into master perf(machine): Speed up host ctrl-flow cache build Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3681 ## Summary Host 侧构建 ctrl-flow cache 时,去掉默认路径上不必要的开销: 1. **跳过未使用 payload 的整块 memset** - CreateHostCtrlFlowCache 原先对约 100MB 容量上限做 AllocZero;录制实际只用约 1MB,usedCacheSize 拷 device 也不带走未用尾部。 - 改为只清 cacheData 之前的元数据前缀;payload 在 AllocateCache 按块(含 64B 对齐 padding)清零,保留 ready-queue / mix-task「洞必须为 null」语义。 - Engram ST 上 create_cache 约 5.7ms → 约 64µs。 2. **默认跳过 host stitch 校验 / topo dump** - 新增 HostTopoVerifyEnabled(),与 runtime_debug_mode == VERIFY 对齐。 - 默认关闭 CheckStitch、边校验以及 consumer/producer cell-access dump;VERIFY 时再开启。 - 不改 ENABLE_COMPILE_VERBOSE_LOG;无需为性能重编 verbose 开关。 ## UT - AllocateCache_ZerosPoisonedSlabAndPadding:poison 后分配,校验 slab + 64B padding 清零 - CreateHostCtrlFlowCache_AllocateCacheZerosPoisonedPayload:只清 header 后 poison payload,再经 AllocateCache 清零 - HostTopoVerifyEnabled_TrueWhenRuntimeDebugVerify:VERIFY 模式下门闩为 true - 原有 CreateHostCtrlFlowCache / BuildControlFlowCache 路径无需改断言 See merge request: cann/pypto!7190 | 28 days ago | |
feat(machine): Optimize perf Co-authored-by: dty_30041779<daitianyi1@h-partners.com> # message auto-generated for no-merge-commit merge: !5431 merge oom into master feat(machine): Optimize perf Created-by: LordOfMysteries Commit-by: dty_30041779 Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2597 # AICPU Ctrl / Sche 代码优化摘要 面向动态图 EXEC_DYN 热路径的微优化(不改变语义;DEV_INFO 日志级别保持原样)。 ## 主要改动 1. **Fill I/O / ItemPool** - 新增 ItemPool::AllocateBump / MakeRuntimeOutcastTensorBump:在 RunInit 后首次填充 root I/O 时跳过 freelist 分支与逐元素 ItemAt 检查。 2. **Stitch 挂边** - DevAscendFunctionDuppedStitchList::PushBack 由 std::function 改为模板 AllocFn,避免类型擦除与间接调用。 - Partial-update 表基址由 &table[0] 改为 Data(),空表安全且去掉无意义的下标检查。 3. **Workspace / Dupped 尺寸** - DevFunctionDuppedSlabMemObjSize 对同一 DevAscendProgram 缓存最大 Dupped 尺寸,避免每轮 launch 重复全表扫描。 4. **Ctrl / Sche 其它热路径** - Slot / Stitch / Task / AICore 管理路径的小幅去冗余、指针/数据预取与分支收敛(见对应 device_*_context 与 aicore_manager 改动)。 See merge request: cann/pypto!5431 | 3 months ago | |
perf(machine): Speed up host ctrl-flow cache build Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !7190 merge optimize/ctrlflow-cache-skip-unused-memset into master perf(machine): Speed up host ctrl-flow cache build Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3681 ## Summary Host 侧构建 ctrl-flow cache 时,去掉默认路径上不必要的开销: 1. **跳过未使用 payload 的整块 memset** - CreateHostCtrlFlowCache 原先对约 100MB 容量上限做 AllocZero;录制实际只用约 1MB,usedCacheSize 拷 device 也不带走未用尾部。 - 改为只清 cacheData 之前的元数据前缀;payload 在 AllocateCache 按块(含 64B 对齐 padding)清零,保留 ready-queue / mix-task「洞必须为 null」语义。 - Engram ST 上 create_cache 约 5.7ms → 约 64µs。 2. **默认跳过 host stitch 校验 / topo dump** - 新增 HostTopoVerifyEnabled(),与 runtime_debug_mode == VERIFY 对齐。 - 默认关闭 CheckStitch、边校验以及 consumer/producer cell-access dump;VERIFY 时再开启。 - 不改 ENABLE_COMPILE_VERBOSE_LOG;无需为性能重编 verbose 开关。 ## UT - AllocateCache_ZerosPoisonedSlabAndPadding:poison 后分配,校验 slab + 64B padding 清零 - CreateHostCtrlFlowCache_AllocateCacheZerosPoisonedPayload:只清 header 后 poison payload,再经 AllocateCache 清零 - HostTopoVerifyEnabled_TrueWhenRuntimeDebugVerify:VERIFY 模式下门闩为 true - 原有 CreateHostCtrlFlowCache / BuildControlFlowCache 路径无需改断言 See merge request: cann/pypto!7190 | 28 days ago | |
perf(machine): Prefilter stitch slot lists and isolate device-side checks Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !5584 merge perf/prefilter-stitch-slot-lists into master perf(machine): Prefilter stitch slot lists and isolate device-side checks Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: perf(machine): Prefilter stitch slot lists and isolate device-side checks ## 优化概述 将 stitch slot 预过滤逻辑从编译期前置到 encode 阶段,消除 device 侧热路径的冗余遍历与分支判断。 ## 优化点 ### 1. Stitch Slot 预过滤 - 新增 SlotMaskEntry + stitchUpdateSlotMaskMap,在 RunEncodeStage 中一次性计算所有 slot 的 stitch mask - device 侧 UpdateSlotsImpl / FastStitchConsumer / FastStitchProducer 直接遍历预计算列表,不再逐 slot 判断 ### 2. 统一 Update 数据结构 - DevAscendProgramPartialUpdate → DevAscendProgramUpdate + isPartial 标志 - InitPartialUpdateSlot → InitUpdateSlot,合并 partial/fullcover 遍历为单次循环 - DumpPartialUpdate → DumpUpdate,输出 isPartial + stitchCtrlBitMask ### 3. Mask 计算提取与复用 - 新增静态函数 CalculateStitchCtrlBitMaskForSlot,从 InitSinglePartialUpdateSlot 中抽离 mask 计算 - InitSingleFullCoverSlot / InitSinglePartialUpdateSlot 共用 stitchUpdateSlotMaskMap,避免重复计算 ### 4. Device 侧 Slot 预过滤列表 - 新增 4 个 DevLocalVector slot 列表(stitchIncastSlotList / updateIncastSlotList / stitchOutCastSlotList / updateOutCastSlotList) - InitStitchUpdateSlotPrefilterLists 在 encode 阶段填充,RefilterStitchUpdateSlotLists 二次过滤 ### 5. CellMatch 隔离与防护 - CellMatchHandle 中 DEV_IF_NONDEVICE 隔离 dim-zero 检查 - PrepareRuntimeDynamicPartialUpdateTable 增加 null data 守卫 Related Issues: #5382 See merge request: cann/pypto!5584 | 3 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 | |
feat(machine): Add DRCO percore eager consume gated by graph features Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !7272 merge master into master feat(machine): Add DRCO percore eager consume gated by graph features 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!7272 | 29 days 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 | |
perf(machine): Speed up host ctrl-flow cache build Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !7190 merge optimize/ctrlflow-cache-skip-unused-memset into master perf(machine): Speed up host ctrl-flow cache build Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3681 ## Summary Host 侧构建 ctrl-flow cache 时,去掉默认路径上不必要的开销: 1. **跳过未使用 payload 的整块 memset** - CreateHostCtrlFlowCache 原先对约 100MB 容量上限做 AllocZero;录制实际只用约 1MB,usedCacheSize 拷 device 也不带走未用尾部。 - 改为只清 cacheData 之前的元数据前缀;payload 在 AllocateCache 按块(含 64B 对齐 padding)清零,保留 ready-queue / mix-task「洞必须为 null」语义。 - Engram ST 上 create_cache 约 5.7ms → 约 64µs。 2. **默认跳过 host stitch 校验 / topo dump** - 新增 HostTopoVerifyEnabled(),与 runtime_debug_mode == VERIFY 对齐。 - 默认关闭 CheckStitch、边校验以及 consumer/producer cell-access dump;VERIFY 时再开启。 - 不改 ENABLE_COMPILE_VERBOSE_LOG;无需为性能重编 verbose 开关。 ## UT - AllocateCache_ZerosPoisonedSlabAndPadding:poison 后分配,校验 slab + 64B padding 清零 - CreateHostCtrlFlowCache_AllocateCacheZerosPoisonedPayload:只清 header 后 poison payload,再经 AllocateCache 清零 - HostTopoVerifyEnabled_TrueWhenRuntimeDebugVerify:VERIFY 模式下门闩为 true - 原有 CreateHostCtrlFlowCache / BuildControlFlowCache 路径无需改断言 See merge request: cann/pypto!7190 | 28 days ago | |
perf(machine): Speed up host ctrl-flow cache build Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !7190 merge optimize/ctrlflow-cache-skip-unused-memset into master perf(machine): Speed up host ctrl-flow cache build Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3681 ## Summary Host 侧构建 ctrl-flow cache 时,去掉默认路径上不必要的开销: 1. **跳过未使用 payload 的整块 memset** - CreateHostCtrlFlowCache 原先对约 100MB 容量上限做 AllocZero;录制实际只用约 1MB,usedCacheSize 拷 device 也不带走未用尾部。 - 改为只清 cacheData 之前的元数据前缀;payload 在 AllocateCache 按块(含 64B 对齐 padding)清零,保留 ready-queue / mix-task「洞必须为 null」语义。 - Engram ST 上 create_cache 约 5.7ms → 约 64µs。 2. **默认跳过 host stitch 校验 / topo dump** - 新增 HostTopoVerifyEnabled(),与 runtime_debug_mode == VERIFY 对齐。 - 默认关闭 CheckStitch、边校验以及 consumer/producer cell-access dump;VERIFY 时再开启。 - 不改 ENABLE_COMPILE_VERBOSE_LOG;无需为性能重编 verbose 开关。 ## UT - AllocateCache_ZerosPoisonedSlabAndPadding:poison 后分配,校验 slab + 64B padding 清零 - CreateHostCtrlFlowCache_AllocateCacheZerosPoisonedPayload:只清 header 后 poison payload,再经 AllocateCache 清零 - HostTopoVerifyEnabled_TrueWhenRuntimeDebugVerify:VERIFY 模式下门闩为 true - 原有 CreateHostCtrlFlowCache / BuildControlFlowCache 路径无需改断言 See merge request: cann/pypto!7190 | 28 days ago |
| Files | Last commit | Last update |
|---|---|---|
| 24 days ago | ||
| 1 month ago | ||
| 3 months ago | ||
| 28 days ago | ||
| 3 months ago | ||
| 28 days ago | ||
| 3 months ago | ||
| 24 days ago | ||
| 29 days ago | ||
| 26 days ago | ||
| 28 days ago | ||
| 28 days ago |