| Files | Last commit | Last update |
|---|---|---|
perf(machine): split LOCAL_READY_MATRIX slab type and trim aicpu-resolve stitch pool budget Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !6575 merge master into master perf(machine): split LOCAL_READY_MATRIX slab type and trim aicpu-resolve stitch pool budget Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: perf(machine): split LOCAL_READY_MATRIX slab type and trim aicpu-resolve stitch pool budget See merge request: cann/pypto!6575 | 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 | |
fix(machine): fix log quality issues in machine module. Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5679 merge pyptolog_fix into master fix(machine): fix log quality issues in machine module. Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: PyPTO machine 模块日志整改 See merge request: cann/pypto!5679 | 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 | |
perf(machine): Device CF hot path, tagSeq, and partial-stitch flags Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !5008 merge perf/device-cf-hotpath-bundle into master perf(machine): Device CF hot path, tagSeq, and partial-stitch flags Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2597 perf(machine): Device CF hot path, tagSeq, and partial-stitch flags Bundle device-side control-flow hot-path optimizations that share stitch/slot/ctrl surfaces. Commits: - perf(machine): Use cellMatchTagSeq and AICORE_TASK_INIT pool reset - perf(machine): Tighten device stitch, task build, and ctrl hot path Changes: - Monotonic cellMatchTagSeq instead of embedding taskId in tags - Word-wise AICORE_TASK_INIT pool reset / overflow clear - Device stitch / task / ctrl hot-path tightening See merge request: cann/pypto!5008 | 4 months ago | |
fix(machine): Update cell match validation error logs Co-authored-by: songyangyang18<songyangyang18@huawei.com> # message auto-generated for no-merge-commit merge: !6637 merge err into master fix(machine): Update cell match validation error logs Created-by: songyangyang18 Commit-by: songyangyang18 Merged-by: cann-robot Description: Cell match错误日志修改,增加Debug日志记录详细信息,Error日志描述简化,指引用户增大tile_shape。 原始日志: ErrCode: F7600C! Enum: ProgEncodeErr::ASSEMBLE_STITCH_MEMORY_EXCESS. Assemble out-cast 6 raw 4 stitch results in excessive memory consumption Please appropriately configure the view shape and tile shape, and ensure aligned with the input shape, cellMatchStride[0]=50331648, MAX_CELLMATCHSSTRIDE=20000000 当前日志: ErrCode: F7600C! Enum: ProgEncodeErr::ASSEMBLE_STITCH_MEMORY_EXCESS. Excessive memory consumption due to insufficient tile shapes. Consider increasing tile shapes (e.g. set_vec_tile_shapes). See merge request: cann/pypto!6637 | 2 months 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): Align outcast ioIndex with per-entry runtime address table Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !6502 merge fix-outcast-ioindex into master fix(machine): Align outcast ioIndex with per-entry runtime address table Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: fix(machine): Align outcast ioIndex with per-entry runtime address table Since pr !6322 keeps every assemble version of one slot as an outcast, several outcast entries share one RawTensor, so outcastRawList (deduped by raw) no longer lines up with the runtime outcast address table, which holds one entry per outcast. ioIndex taken from the deduped raw list therefore resolves later outcasts onto a wrong address entry: in cell_match_dep case 50 the second output's raw resolves to the shared buf outcast buffer and the host output is never written, while all graph/pass level data stays correct (silent precision failure). Changes: - Resolve outcast ioIndex through the owning outcast entry (first occurrence of the raw in devRoot's outcast list) in InitRawTensorAndMemoryRequirement and HandleActualRaw - Use the incast entry count (devRoot->GetIncast().size()) as the outcast offsetOrIndex base so the COA location encode matches the per-entry address table layout - Fix the sym dump double indexing in DumpIncast/DumpOutcast: offsetAttrIdx is already a global sym offset, read it via GetSymoffset directly Verified: cell_match_dep case 50 restores PASS with metrics identical to the pre-!6322 baseline; 39-case sample regression 79/79 PASS. Related Issues: #3384 See merge request: cann/pypto!6502 | 2 months ago | |
perf(machine): Pair DRCO static successor decrements into one u64 atomicAdd Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !6448 merge perf-drco-succ-pair-u64-v2 into master perf(machine): Pair DRCO static successor decrements into one u64 atomicAdd Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: perf(machine): Pair DRCO static successor decrements into one u64 atomicAdd The DRCO static resolve decrements one predCount per successor edge, so a predecessor with N successors pays N serialized L2 atomic round trips on the scheduler hot path (schelcpu was ~59% of e2e on the profiling case). This PR pairs successors whose opIdx share one predCount u64 slot and pays one atomic for two edges, plus a load-and-test fast path that skips the atomic whenever the resolver's edge is provably the last unresolved one. Changes: - Encode (dev_encode.cpp): sort each drco succ segment by opIdx and mark even-aligned (2k, 2k+1) pairs with DRCO_SUCC_PAIR_BIT (bits 16-28 are free in drco-encoded entries). depGraphSuccList keeps its original order, so the AICPU/DRCU path and the dyn_topo dump are unaffected. A one-line pair-rate log is emitted per function. The even alignment is mandatory: a pair starting at an odd opIdx is an unaligned u64 atomic and raises an aicore exception (retcode 507015, verified on device). - Device (aicore_entry_drco.h): a pair entry resolves with one u64 atomicAdd that subtracts 1 from both packed halves and fires each half whose old count was 1. Unpaired entries keep the original 32-bit path, so old/new tables and headers stay interoperable. - Load-and-test (aicore_entry_drco.h): DrcoAtomicResolveDependOnce becomes a template <T, SENTINEL, DEC>. A plain load of the sentinel proves our edge is the only unresolved one, so fire without the atomic; the stale slot is harmless because the table is re-initialized every round and nobody reads it after the fire. This also makes the resolve safe for runtime-stitched extra predecessors without any encode-side analysis. - Drop the 0xffff claim dance from the resolve: exactly-once edge resolution keeps every counter >= 1 until its final decrement, so the packed subtract can never borrow across halves. - Alignment guard (device_task_context_drco.cpp): assert the predCount slab base is 8B aligned so the u64 pair atomic contract cannot regress silently. Validation (Ascend950PR, mla_prolog_v3_l0_id0002_high_throughput_eager, 3 configurations measured back-to-back in one load window, 15 rounds each, first 5 discarded as warmup, e2e_core_time in us): - OFF (upstream base): mean 366.45, min 351.37 - pair only: mean 305.52, min 296.67 (-16.6%) - pair + load-and-test (final): mean 288.86, min 277.21 (-21.2%) All rounds PASS including precision checks; pair rate on this case is 49.6% (839 static edges, 416 paired). Offline ccec (dav-c310, -Wall -Werror) clean for both AIC and AIV. Re-submitted from PR #6361: the 3 commits (u64 pair decrement, load-and-test sentinel fast path, slab alignment assert) are squashed into one commit and rebased onto latest master. Related Issues: #3366 See merge request: cann/pypto!6448 | 2 months ago | |
fix(machine): Split runtime headers and use secure bundle functions Co-authored-by: W4termy<wangmingyang21@huawei.com> # message auto-generated for no-merge-commit merge: !6428 merge fix/master_cleancode into master fix(machine): Split runtime headers and use secure bundle functions Created-by: W4termy Commit-by: W4termy Merged-by: cann-robot Description: cleancode 超大头文件、不安全函数修改 See merge request: cann/pypto!6428 | 2 months ago | |
perf(machine): Encode DRCO coreType into taskId and prebuild encoded succStaticList at encode time Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !6253 merge perf-6137-v2 into master perf(machine): Encode DRCO coreType into taskId and prebuild encoded succStaticList at encode time Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: The DRCO runtime resolved each successor task's coreType by dereferencing cceBinary GM memory (cceBinaryIndexList -> cceBinary[i].coreType) on every dependency resolution, which costs extra GM loads on the hot scheduling path. This change moves coreType resolution to encode time: the CoreType enum is encoded directly into the DRCO taskId bits, and succStaticList entries are prebuilt as coreType-encoded values, so the device decodes coreType from the taskId locally without touching cceBinary GM memory. Changes: - Encode CoreType enum into DRCO taskId at encode time and decode it via DrcoTaskCoreTypeOf - Prebuild the DRCO encoded succStaticList once at encode time - Resolve succ coreType from the encoded taskId in DrcoResolveDependOnce/ResolveHubMixTask - Assert DRCO-inconsumable succ coreType at encode time Related Issues: #3312 See merge request: cann/pypto!6253 | 2 months ago | |
fix(machine): Improve ctrl cache replay performance Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !6302 merge dev-restore-pingpong into master fix(machine): Improve ctrl cache replay performance Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 1、将 PredCount 以及 readyque 改为 A B 两份,通过pingpong 结构,当前轮次 ctrl push task 之后,对 B 做 restore ,利用 ctrl 结尾空闲时间掩盖 restore 开销 See merge request: cann/pypto!6302 | 2 months 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 | |
add tree push producer Co-authored-by: wan_jianfen<wanjianfen@hisilicon.com> # message auto-generated for no-merge-commit merge: !6349 merge br_ctu into master add tree push producer 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) Related Issue: #3373 See merge request: cann/pypto!6349 | 2 months ago | |
feat(Machine): Local Matrix for scheduling Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !6222 merge aicore-resolve-in-one into master feat(Machine): Local Matrix for scheduling Created-by: yinjie27_ Commit-by: Jie Yin Merged-by: cann-robot Description: feat(Machine): Local Matrix for scheduling See merge request: cann/pypto!6222 | 2 months ago | |
feat(docs): Add describe of stitch function num per pool Co-authored-by: duanhaotian<duanhaotian@huawei.com> # message auto-generated for no-merge-commit merge: !5830 merge duanhaotian_doc into master feat(docs): Add describe of stitch function num per pool Created-by: duanhaotian Commit-by: duanhaotian Merged-by: cann-robot Description: 内存精细化控制配置项文档介绍 See merge request: cann/pypto!5830 | 2 months ago | |
feat(machine): Add option to control memory reuse of workspace Co-authored-by: duanhaotian<duanhaotian@huawei.com> # message auto-generated for no-merge-commit merge: !5427 merge duanhaotian13 into master feat(machine): Add option to control memory reuse of workspace Created-by: duanhaotian Commit-by: duanhaotian Merged-by: cann-robot Description: ## 改造后:精细 Workspace 总体流程 改造后保留 max_workspace_kb 粗调模式,同时新增 actual_stitch_function_num=[d0,d1,d2] 精细模式。两个模式共用需求收集、memBudget、序列化、Host 申请和 Device allocator,只在容量决策方式上分流。 mermaid flowchart TD Config["配置<br/>max_workspace_kb<br/>actual_stitch_function_num=[d0,d1,d2]"]:::added Load["LoadRuntimeWorkspaceConfig<br/>长度/范围校验并映射三个 depth"]:::added Collect["复用原有需求收集<br/>WorkspaceDesc"]:::legacy Mode{"数组是否为 [0,0,0]"}:::decision Coarse["保留原有 max_workspace_kb / 统一 k_eff 路径"]:::legacy Validate{"每个非空池是否至少支持一个 RootFunction"}:::decision Precise["独立计算三个池容量<br/>CalculatePreciseWorkspaceLayout"]:::added Apply["ResolveStitchDepthConfig<br/>ApplyStitchDepthConfig"]:::added Budget["memBudget.tensor 最终容量<br/>+ workspaceControl 单位需求与深度"]:::added Encode["DevProg 两遍编码并序列化"]:::legacy Dynamic["动态 Shape 求值更新 MaxOutcastMem<br/>深度和池 Slot 数不重算"]:::added HostAlloc["Host 按 memBudget.Total() 申请 Workspace"]:::legacy Init["DeviceWorkspaceAllocator::InitTensorAllocators"]:::legacy Pools["注册原有四池<br/>容量来自精细预算结果"]:::legacy Preflight{"当前 Root 追加前精确预检"}:::decision Alloc["真实申请并绑定地址"]:::legacy Observe["采集三个精细池 current/peak"]:::added Submit["内存不足或原有边界触发 Submit"]:::added Tuning["窗口日志、Launch 汇总和推荐 depth"]:::added Recycle["回收当前窗口并重置窗口峰值"]:::added Config -.-> Load Collect --> Mode Load -.三个 depth.-> Mode Mode -->|是| Coarse Mode -->|否| Validate Validate -->|通过| Precise Validate -->|失败| Error["编码期报错"]:::decision Coarse --> Apply Precise -.-> Apply Collect --> Apply Apply -.-> Budget Budget --> Encode --> Dynamic --> HostAlloc --> Init --> Pools --> Preflight Preflight -->|通过| Alloc --> Observe --> Preflight Preflight -->|失败且窗口非空| Submit Preflight -->|失败且窗口为空| RuntimeError["单个 Root 无法容纳,运行时报错"]:::decision Alloc -->|控制流/硬阈值| Submit Submit --> Tuning --> Recycle --> Preflight classDef legacy fill:#f5f5f5,stroke:#666,stroke-width:1px,color:#222 classDef added fill:#e6f4ff,stroke:#1677ff,stroke-width:3px,color:#102a43 classDef decision fill:#fff7e6,stroke:#d46b08,stroke-width:2px,color:#5c2b00 ### 总体前后差异 | 维度 | 改造前 | 改造后 | |---|---|---| | 外部控制 | max_workspace_kb 总量粗调 | 保留粗调;新增三池 depth 数组 | | 模式启用 | 根据总预算和 Stitch 上限求统一深度 | [0,0,0] 走粗调;任一非零走精细模式 | | 三池容量 | 同一个 k_eff 同步放大 | 三个 depth 独立计算 | | max_workspace_kb | 作为粗调总量依据 | 精细模式下不再截断用户指定的三池容量 | | Boundary Outcast | 拓扑固定 | 仍拓扑固定,不对外精细控制 | | Runtime allocator | 原有四池 | 复用原有四池,无新池 | | 运行时观测 | 无三池闭环推荐 | Window/Launch 峰值、推荐 depth、depth 内存影响 | | 热路径成本 | 无新增采样 | 由 ENABLE_PROFILE_GUIDED 编译期开关隔离 | | 追加前预检 | 聚合 Slot 粗估,失败原因不明确 | 按 Exclusive、InnerTemporal 和 RuntimeItem 分项预检 | | 内存不足处理 | 已有失败后 Submit/重试框架 | 保留框架,增加原因、空窗口保护和更准确预测 | --- See merge request: cann/pypto!5427 | 2 months ago | |
fix(machine): Add control flow encode Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> Co-authored-by: wan_jianfen<wanjianfen@hisilicon.com> # message auto-generated for no-merge-commit merge: !6666 merge br_test into master fix(machine): Add control flow encode Created-by: wan_jianfen Commit-by: wan_jianfen;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!6666 | 2 months ago | |
perf(machine): Precount per-core pending tasks at dispatch to drop device-side notify Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !6604 merge master into master perf(machine): Precount per-core pending tasks at dispatch to drop device-side notify Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: perf(machine): Precount per-core pending tasks at dispatch to drop device-side notify See merge request: cann/pypto!6604 | 2 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 | |
fix(machine): Improve ctrl cache replay performance Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !6316 merge dev-inoutreloc-performance into master fix(machine): Improve ctrl cache replay performance Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 1、删除 funcdata backup 拷贝到 funcdata 的 memcpys,RelocIncastOutCast 流程中直接从 backup 读取信息 2、原 RelocIncastOutCast 流程为遍历所有 device task 和 dupFuncData,逐 input outpu 还原。新流程将 RelocIncastOutCast 放入 push task 之前,per-task reloc 并 push;并将在 host cache 之后记录并构建需要 Reloc 的信息,每个 Kind 记录下有哪些 input oout,在 reloc 时,不遍历所有 input out,而是按照 kind 类别做 reloc; See merge request: cann/pypto!6316 | 2 months ago | |
perf(machine): Add hub Matrix Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !6632 merge master into master perf(machine): Add hub Matrix Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: perf(machine): Add hub Matrix See merge request: cann/pypto!6632 | 2 months ago | |
perf(machine): split LOCAL_READY_MATRIX slab type and trim aicpu-resolve stitch pool budget Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !6575 merge master into master perf(machine): split LOCAL_READY_MATRIX slab type and trim aicpu-resolve stitch pool budget Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: perf(machine): split LOCAL_READY_MATRIX slab type and trim aicpu-resolve stitch pool budget See merge request: cann/pypto!6575 | 2 months ago | |
fix(machine): Fix control core bug Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !6157 merge expr into master fix(machine): Fix control core bug Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/2597 # 控核 nrValidAic 竞态问题:根因与修复方案 ## 1. 背景 压测场景: - 同一 JIT kernel(DYNAMIC shape)在一张 aclgraph 里穿插多种 token 规格(如 T=1/4/8/16/32) - Host 控核(TryResetBlockDimForPreLaunch)按 tiling 的 maxC/maxV 收缩 ctrlBlockDim(常见为 1~4) - 未开启 AICore 解依赖(ENABLE_AICORE_RESOLVE);经典路径为 Sche handshake + 派 leaf - Early-launch / 多 stream 下,相邻 round 的 CTRL/SCHE/AICORE 可能时间重叠 长压后可出现 AICore 软件 Trap(等待 leaf / handshake 超时)或 Sche handshake 超时。 --- ## 2. 根因 ### 2.1 Host 双字段分叉(诱因) | 字段 | 角色 | 控核后行为 | |------|------|------------| | ctrlBlockDim | Host launch 的 AICore blockDim,并写入本轮 ctrlBlockNum | TryReset **只改这个** | | devArgs.nrValidAic | DeviceArgs「有效 AIC 数」:分核、ready 队列、handshake | 仍按满核 config.blockdim(capacity) | | devArgs.scheCpuNum | Sche 线程数 | 按满核算死,不随控核收缩 | 即:真正起核用的是收缩后的 k,共享 DevProg 上仍挂着满核口径的 capacity。 ### 2.2 致命点:原地改写共享 DevProg.devArgs.nrValidAic 旧逻辑在 CTRL/SCHE 入口: text ReCalcDevArgsAicoreNum: if ctrlBlockNum != 0 && ctrlBlockNum != nrValidAic: devProg->devArgs.nrValidAic = ctrlBlockNum; // 写共享 GM 同时: - **同一 Function** 的 device cfgdata(DevAscendProgram)只 CopyToDev 一次并缓存复用 - 多 shape / 多 round **共用同一份** cfgdata - Sche RunSche 曾通过 kargs->cfgdata **指针**读共享 DeviceArgs,Init 时取 aicValidNum_ = nrValidAic 在 early-launch 等跨流重叠下: text Round N: SCHE 已 ReCalc(kN),可能尚未 Init / 仍在跑 Round N+1: CTRL/SCHE ReCalc(kN+1) 改写同一 nrValidAic → Round N Sche 分核/handshake 按错误核数 → 与 Host launch 的 blockDim=kN 不一致 → handshake 等不到核 / AICore 等不到 leaf → 超时 Trap 未开 resolve 时,Trap 本质是 **Sche 断粮 / handshake 错位**,而不是 DRCO 按满核等 peer。 ### 2.3 次要问题:scheCpuNum 过配 控核到 blockDim=1~4 时,若仲裁/分核仍按满核 scheCpuNum=3~4,有效活压在少数 sche 上,放大仲裁与单 sche 脆弱性。 做法是:**共享保持 capacity,本轮仲裁用收缩后的 sche 数**(见 §3.2 / §3.4)。 --- ## 3. 修改方案 核心原则: > **共享 DevProg.devArgs 只表示 capacity;本轮拓扑放进 ring slot(DevStartArgs)和 Sche 本地 DeviceArgs 副本,禁止再原地改写共享 nrValidAic。** ### 3.1 Per-round 拓扑字段 DevStartArgs(每个 runtime ring slot 一份)增加: - nrValidAic:本轮有效 AIC 数 - scheCpuNum:本轮目标 sche 数(已按控核收缩) ### 3.2 解析辅助(device_common.h)——含 scheCpuNum 过配修复 - ResolveRoundNrValidAic(ctrlBlockNum, capacityNrValidAic) - ctrlBlockNum != 0 → 用控核结果,否则用 capacity - ResolveRoundScheCpuNum(nrValidAic, capacityScheCpuNum, arch) - CalcSchAicpuNumByBlockDim(本轮 nrValidAic),再 **clamp 到 capacity** - 例如 nrValidAic∈{1..4} → 本轮 scheCpuNum 一般为 **1**,不再用满核的 3~4 去仲裁 ### 3.3 CTRL(InitDyn) Allocate 本轮 DevStartArgs 后写入上述字段;devCtrlState.schAicpuNum 跟本轮 scheCpuNum。 **不再**调用 ReCalcDevArgsAicoreNum 写共享 GM。 ### 3.4 Sche(EntrySplittedStreamSche)——本轮用收缩后的 sche 数 - 从共享 DevProg 拷一份本地 roundArgs,用本轮 ctrlBlockNum 覆盖 nrValidAic / scheCpuNum(经 ResolveRound*) - RunSchInit(capacityScheCpuNum):机器只按 **capacity** 初始化一次(队列规模仍按满配) - AllocThreadIdx / 仲裁起点 / handshake / RunThread:用本轮 **已收缩** 的 roundArgs.scheCpuNum - 清多余 task queue:按 **capacity** 区间(arbitrated .. capacity) - 拓扑与 CTRL 同源(同一 launch 的 ctrlBlockNum),不再 Wait 后从 slot 二次覆盖 效果对照(典型 3510): | 本轮 ctrlBlockDim | 旧:仲裁用共享 sche | 新:本轮 ResolveRoundScheCpuNum | |---------------------|---------------------|----------------------------------| | 1~4 | 仍可能 3~4 | 一般为 **1** | | 满核 | capacity | capacity | ### 3.5 CTRL 消费路径 - Ready 队列 restore、CalcControlMaxAicore:只用 DevStartArgs::nrValidAic - **DRCO(aicore 解依赖)不改**:当前不支持控核,仍读共享 devProg->devArgs.nrValidAic ### 3.6 Host 控核(TryResetBlockDimForPreLaunch) - 只更新 ctrlBlockDim(进而进入本轮 ctrlBlockNum) - **不**收缩共享 devArgs.scheCpuNum / nrValidAic(避免毒化 capacity / 首次 CopyToDev) - 过配在 **device 本轮 Resolve** 解决,而不是改 host 共享字段 --- See merge request: cann/pypto!6157 | 2 months ago | |
perf(machine): Optimize stitch code Co-authored-by: gaoxingwang<camuel.gao@huawei.com> # message auto-generated for no-merge-commit merge: !5531 merge perf/stitch-attr-optimize into master perf(machine): Optimize stitch code Created-by: gaoxingwang Commit-by: gaoxingwang Merged-by: cann-robot Description: # PR 5531 优化点 > perf(machine): Optimize stitch attr access with cachedAttrBase and if constexpr ## 优化点清单 | # | 优化点 | 改动文件 | 改前 | 改后 | 优化类型 | |---|--------|---------|------|------|---------| | 1 | 属性基址缓存 | dev_callop_attribute.h | 每次调用 3 次 GetOperationAttr 查表获取 offset/rawShape/validShape 指针 | cachedAttrBase 懒加载 1 次 GetSymoffset,后续指针偏移直接算 | 热路径查表消除 | | 2 | 结构体字段瘦身 | dev_encode_operation.h | shapeAttrIdx + wrapTaskHubOpIdx 两个字段 | 删除 shapeAttrIdx(改为 offsetAttrIdx+dim 按需算),wrapTaskHubOpIdx → stitchOpIdx(encode 期预赋值) | 结构体缩小 + runtime 查表消除 | | 3 | offsetAttrIdx 预累加 | dev_encode.cpp | runtime 每次查 opAttrOffsetList_ 获取 opAttrBase | encode 期 offsetAttrIdx += opAttrBase,runtime 直接读 | 以存代算 | | 4 | stitchOpIdx 预赋值 | dev_encode.cpp | runtime if (wrapTaskHubOpIdx != INVALID) 判断 + 赋值 | encode 期 stitchOpIdx = (hub存在) ? hubIdx : operationIdx | 以存代算 + 分支消除 | | 5 | 构造函数参数减少 | dev_encode.cpp | emplace_back(opIdx, coaIndex, coaIndex+dimSize, ...) 传 3 个 index | emplace_back(opIdx, coaIndex, ...) 传 2 个,shape 索引按需算 | 调用开销减少 | | 6 | skipExpression 模板消除 | dev_callop_attribute.h | template <bool skipExpression> 循环内 3×dim 次 if (skipExpression) 运行时分支 | 去掉模板参数和运行时分支 | 编译期分支消除 | | 7 | 循环合并 | dev_callop_attribute.h | CheckOffsetAndValidShapeInRawShape 两个独立 for 循环 | 合并为一个循环 | 循环开销减半 | | 8 | IsCellMatchDescFillReady 删除 | dev_callop_attribute.h | runtime 每次遍历所有维度检查 cellShape/stride > 0 | 删除函数,host encode 期保证 desc 已填充 | device 侧检查消除 | | 9 | Dump 隔离 | device_slot_context.cpp / device_stitch_context.cpp / dump_device_topo.cpp | DumpProducerCellAccess/DumpConsumerCellAccess 裸调用 | DEV_IF_NONDEVICE 包裹,device 编译期排除 | device 侧零开销 | | 10 | unlikely 标注 | dev_callop_attribute.h | if (clamped) 无分支预测提示 | if (unlikely(clamped)) | 分支预测优化 | | 11 | CellMatchProcessByDim 局部变量 | dev_encode_function_stitch.h | switch (cellMatchTableDesc.cellShape.dimSize) 每次读结构体字段 | switch (dims) 用局部变量 | 循环不变量外提 | | 12 | CellMatchHandle dims 外提 | dev_encode_function_stitch.h | 循环内 cellMatchTableDesc.GetDimensionSize() 重复调用 | 提到循环外存 dims | 循环不变量外提 | | 13 | Process 签名加 desc | dev_encode_function_stitch.h | 每个 Handler 内部重复读 cellMatchTableDesc | 通过参数传入 const DevCellMatchTableDesc& desc | 参数传递优化 | | 14 | runtime wrapTaskHubOpIdx 查表消除 | device_stitch_context.cpp | runtime if (consumer.wrapTaskHubOpIdx != INVALID) 判断 + 赋值 consumerOpIdx | 直接用 consumer.stitchOpIdx | runtime 分支消除 | | 15 | GetTensorOffsetAndValidShape 调用优化 | device_stitch_context.cpp | 传 operationIndex + offsetAttrIdx,函数内部查 GetOperationAttr | 传 offsetAttrIdx + cachedAttrBase,函数内部用缓存指针 | 热路径查表消除 | See merge request: cann/pypto!5531 | 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 | |
perf(machine): Add hub Matrix Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !6632 merge master into master perf(machine): Add hub Matrix Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: perf(machine): Add hub Matrix See merge request: cann/pypto!6632 | 2 months ago | |
perf(machine): Add hub Matrix Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !6632 merge master into master perf(machine): Add hub Matrix Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: perf(machine): Add hub Matrix See merge request: cann/pypto!6632 | 2 months ago | |
fix(machine): Add aicore-resolve macro Co-authored-by: huanglu<huanglu22@hisilicon.com> # message auto-generated for no-merge-commit merge: !5549 merge master into master fix(machine): Add aicore-resolve macro Created-by: lululu40888 Commit-by: huanglu Merged-by: cann-robot Description: fix(machine): Add aicore-resolve macro See merge request: cann/pypto!5549 | 3 months 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 | |
feat(ir): Support dump function attribute Co-authored-by: tsungl4<lidongsheng4@huawei.com> # message auto-generated for no-merge-commit merge: !6675 merge attr into master feat(ir): Support dump function attribute Created-by: tsungl4 Commit-by: tsungl4 Merged-by: cann-robot Description: Related Issue: #2559 See merge request: cann/pypto!6675 | 2 months ago | |
fix(machine): Fix dynamic partial-update cell match lifecycle Co-authored-by: Songyangyang18<songyangyang18@huawei.com> # message auto-generated for no-merge-commit merge: !2723 merge lp4 into master fix(machine): Fix dynamic partial-update cell match lifecycle Created-by: songyangyang18 Commit-by: Songyangyang18 Merged-by: cann-robot Description: # 一、需求背景 相关issue: https://gitcode.com/cann/pypto/issues/489,//有规避方法,未解决根本问题 https://gitcode.com/cann/pypto/issues/748,//方案说明 https://gitcode.com/cann/pypto/issues/608,//疑似相同问题,本地稳定可以复现 例如在以下用例中,z 的高维大小由 x 的 shape 确定。当 x 是动态 shape 时,z 的大小是动态的。导致 LOOP_1 和 LOOP_2 在 stitch 到一起时,LOOP_1 中对 z 的 assemble 操作无法正确建立指向 LOOP_2 中对 z view 的z_view 等 tensor 的依赖,进而导致在缺少这些依赖时,存在精度问题。 def matmul_kernel(x, y, bias, out): pypto.set_debug_options(runtime_debug_mode=1) bsz, h = x.shape d = y.shape[1] z = pypto.Tensor([bsz, d], dtype=pypto.DT_FP32) b = 128 b_loop = (bsz + b - 1) // b for b_idx in pypto.loop(b_loop, name="LOOP_1", idx_name="b_idx"): b_valid = (bsz-b_idx*b).min(b) x_view = pypto.view(x, [b, h], [b_idx*b, 0], valid_shape=[b_valid, h]) ## Matmul pypto.set_cube_tile_shapes([128, 128], [128, 128], [128, 128]) c = pypto.matmul(x_view, y, pypto.DT_FP32) pypto.assemble(c, [b_idx*b, 0], z) c = 128 c_loop = (bsz + c - 1) // c for c_idx in pypto.loop(c_loop, name="LOOP_2", idx_name="c_idx"): c_valid = (bsz-c_idx*c).min(c) z_view = pypto.view(z, [c, d], [c_idx*c, 0], valid_shape=[c_valid, d]) bias_view = pypto.view(bias, [c, d], [c_idx*c, 0], valid_shape=[c_valid, d]) pypto.set_vec_tile_shapes(128, 128) pypto.assemble(z_view + bias_view, [c_idx*c, 0], out) 由于当前采用 cell match 来动态计算依赖关系,但是 cell match 在匹配时,需要事先分配相应大小的 cell match table,并且由 prod 更新 cell match table,由 con 读取 cell match table 中的值来建立依赖关系。 # 原因分析 根本原因是目前对于局部动态tensor的处理存在不足。 1. cell match 的问题 目前对于patial update slot,局部tensor需要cell match table,这是用于构建dev_task内依赖关系的重要机制。  目前的cell match table需要在编译期确定完整的大小,以准备完整的DevAscendProgram数据,但是动态局部tensor在编译期只能得到符号表达式,而非实际的大小,所以目前的 cell match table 缺乏处理动态大小tensor的能力,目前的做法是忽视动态大小的-1轴,当作正常数值计算,导致计算得到的cell table大小恒为1,这在动态轴大小为更大的数值(如128)时明显计算错误,这个错误会带到运行时,从而导致依赖建立的丢失或错误。  # 方案设计 考虑单独构建局部动态tensor的cell match分配器,用于运行时分配cell match table,尽量将所有需要的数值在launch阶段得到,运行时直接取,减少计算; ## 编译期(Encode) 1. 支持动态 cell-match 延后决策:编译期允许部分 cell-match 描述先不完整(动态维度场景),不再强行一次性定死。 2. 新增动态元数据输出:产物里补充 dynamic cell-match 的预算上限、slot 数量、以及 launch 期补丁所需 meta(offset/cell shape/候选维度表达式)。 3. workspace 预算模型扩展:把 dynamic cell-match 内存纳入 memBudget.metadata,总预算从“两段式”扩为“三段式”(general + dynamicCellMatch + stitchPool)。 ## Launch 阶段 1. 启动前按真实输入 patch 描述符:基于本次输入 shape 计算 stride,并写回 cfgdata(host 或 H2D)。 2. 动态预算随 kArgs 下发并回填设备侧:新增 dynamic assemble / dynamic cell-match 两类预算字段,设备初始化时回填并重算 runtime offset。 3. 地址布局升级:runtime offset 新增 dynamicCellMatchOffset,形成独立内存区,避免与 general/stitchPool 混用。 ## 运行时(Workspace/Slot 生命周期) 1. partial-update slot 标记更准确:按真实 slotIndex + 描述状态 标记,不再依赖旧的隐式假设。 2. 动态 cell-match 表按需分配/初始化:在 slot 更新和 assemble 分配路径中补齐“分配-初始化-绑定”闭环。 3. 回收路径补全:boundary outcast 释放时联动释放 dynamic cell-match 分配,避免残留和泄漏。 ## Cost Model 模块 1. 与真实 launch 对齐:cost model 启动时同步接收 dynamic 预算参数。 2. 同样执行动态 patch 逻辑:仿真前也按输入求值并 patch cell-match desc,避免“仿真和实跑不一致”。 3. 测试链路同步:ST runner 加入同类 budget refill + desc patch,保证测试口径一致。 See merge request: cann/pypto!2723 | 6 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 | |
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 | |
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): Reserve Assemble slots with ×2 for DeviceTask handoff Co-authored-by: songyangyang18<songyangyang18@huawei.com> # message auto-generated for no-merge-commit merge: !5946 merge mem-fix into master fix(machine): Reserve Assemble slots with ×2 for DeviceTask handoff Created-by: songyangyang18 Commit-by: songyangyang18 Merged-by: cann-robot Description: Assemble slot 原预算为 A×k,未覆盖 DeviceTask 交窗:上一 Task 的 delayed-recycle 槽仍占用时,下一 root 预检仍要求整档 assembleSlotsPerDepth 可用。 Assemble slot 槽乘以 SLOTS_NEED_ALLOC_SIZE(×2),与 Boundary 一致:A×k×2(precise:A×depth×2)。 同步修正 MD 线性系数与相关 UT。 See merge request: cann/pypto!5946 | 2 months ago | |
feat(machine): Add option to control memory reuse of workspace Co-authored-by: duanhaotian<duanhaotian@huawei.com> # message auto-generated for no-merge-commit merge: !5427 merge duanhaotian13 into master feat(machine): Add option to control memory reuse of workspace Created-by: duanhaotian Commit-by: duanhaotian Merged-by: cann-robot Description: ## 改造后:精细 Workspace 总体流程 改造后保留 max_workspace_kb 粗调模式,同时新增 actual_stitch_function_num=[d0,d1,d2] 精细模式。两个模式共用需求收集、memBudget、序列化、Host 申请和 Device allocator,只在容量决策方式上分流。 mermaid flowchart TD Config["配置<br/>max_workspace_kb<br/>actual_stitch_function_num=[d0,d1,d2]"]:::added Load["LoadRuntimeWorkspaceConfig<br/>长度/范围校验并映射三个 depth"]:::added Collect["复用原有需求收集<br/>WorkspaceDesc"]:::legacy Mode{"数组是否为 [0,0,0]"}:::decision Coarse["保留原有 max_workspace_kb / 统一 k_eff 路径"]:::legacy Validate{"每个非空池是否至少支持一个 RootFunction"}:::decision Precise["独立计算三个池容量<br/>CalculatePreciseWorkspaceLayout"]:::added Apply["ResolveStitchDepthConfig<br/>ApplyStitchDepthConfig"]:::added Budget["memBudget.tensor 最终容量<br/>+ workspaceControl 单位需求与深度"]:::added Encode["DevProg 两遍编码并序列化"]:::legacy Dynamic["动态 Shape 求值更新 MaxOutcastMem<br/>深度和池 Slot 数不重算"]:::added HostAlloc["Host 按 memBudget.Total() 申请 Workspace"]:::legacy Init["DeviceWorkspaceAllocator::InitTensorAllocators"]:::legacy Pools["注册原有四池<br/>容量来自精细预算结果"]:::legacy Preflight{"当前 Root 追加前精确预检"}:::decision Alloc["真实申请并绑定地址"]:::legacy Observe["采集三个精细池 current/peak"]:::added Submit["内存不足或原有边界触发 Submit"]:::added Tuning["窗口日志、Launch 汇总和推荐 depth"]:::added Recycle["回收当前窗口并重置窗口峰值"]:::added Config -.-> Load Collect --> Mode Load -.三个 depth.-> Mode Mode -->|是| Coarse Mode -->|否| Validate Validate -->|通过| Precise Validate -->|失败| Error["编码期报错"]:::decision Coarse --> Apply Precise -.-> Apply Collect --> Apply Apply -.-> Budget Budget --> Encode --> Dynamic --> HostAlloc --> Init --> Pools --> Preflight Preflight -->|通过| Alloc --> Observe --> Preflight Preflight -->|失败且窗口非空| Submit Preflight -->|失败且窗口为空| RuntimeError["单个 Root 无法容纳,运行时报错"]:::decision Alloc -->|控制流/硬阈值| Submit Submit --> Tuning --> Recycle --> Preflight classDef legacy fill:#f5f5f5,stroke:#666,stroke-width:1px,color:#222 classDef added fill:#e6f4ff,stroke:#1677ff,stroke-width:3px,color:#102a43 classDef decision fill:#fff7e6,stroke:#d46b08,stroke-width:2px,color:#5c2b00 ### 总体前后差异 | 维度 | 改造前 | 改造后 | |---|---|---| | 外部控制 | max_workspace_kb 总量粗调 | 保留粗调;新增三池 depth 数组 | | 模式启用 | 根据总预算和 Stitch 上限求统一深度 | [0,0,0] 走粗调;任一非零走精细模式 | | 三池容量 | 同一个 k_eff 同步放大 | 三个 depth 独立计算 | | max_workspace_kb | 作为粗调总量依据 | 精细模式下不再截断用户指定的三池容量 | | Boundary Outcast | 拓扑固定 | 仍拓扑固定,不对外精细控制 | | Runtime allocator | 原有四池 | 复用原有四池,无新池 | | 运行时观测 | 无三池闭环推荐 | Window/Launch 峰值、推荐 depth、depth 内存影响 | | 热路径成本 | 无新增采样 | 由 ENABLE_PROFILE_GUIDED 编译期开关隔离 | | 追加前预检 | 聚合 Slot 粗估,失败原因不明确 | 按 Exclusive、InnerTemporal 和 RuntimeItem 分项预检 | | 内存不足处理 | 已有失败后 Submit/重试框架 | 保留框架,增加原因、空窗口保护和更准确预测 | --- See merge request: cann/pypto!5427 | 2 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 2 months ago | ||
| 7 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 6 months ago | ||
| 7 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 4 months ago | ||
| 2 months ago | ||
| 2 months ago |