| Files | Last commit | Last update |
|---|---|---|
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 | |
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 | |
fix(machine): Add ring event sync for early launch slot reuse Co-authored-by: LordOfMysteries<duhongxiang@huawei.com> # message auto-generated for no-merge-commit merge: !5516 merge fix-ctrl-wait-sche-num into master fix(machine): Add ring event sync for early launch slot reuse Created-by: LordOfMysteries Commit-by: LordOfMysteries Merged-by: cann-robot Description: https://gitcode.com/cann/pypto/issues/3133 目前整网遇到个问题,mla这个算子(非值依赖,会走host cache完成stitch,每次上板只做restore和task下发)本地单跑ok,但是接入整网跑推理有问题,首先是pypto的aicore部分报scalar访问地址超过48bit。接入整网的模型大概是:图中mla算子每一次decode会穿插跑很多次(多层),每一次decode开头会有一些并发stream上的其它aicpu算子抢核,与这个并列的pypto sche cpu可能抢占不到同一个cluster的核,从开日志看确实有ArbitrationLevel从几次5后面全变成4的情况。然后整网hccl是通过aiv展开的,不存在抢aicpu核 现在实验了多种场景:(1)launch_sched_aicpu_num默认值或者设为2,整网都有上述问题,只有设为1才好(2)开了info日志就不复现了(3)launch_early_mode设为2,关闭提前发射后也不复现(4)怀疑ctrl下一轮的restore过程可能与sche上一轮的执行重叠,导致公用元数据被篡改。 [ERROR] RUNTIME(3043280,python3):2026-08-26-17:52:27.047.381 [stars_engine.cc:1619]3045153 ProcLogicCqReport:Task run failed, device_id=12, stream_id=47, task_id=13487, sqe_type=7(notify wait), errType=0x20(sq sw status error), sqSwStatus=0x102d0559 [ERROR] RUNTIME(3043280,python3):2026-08-26-17:52:27.051.967 [device_error_core_proc.cc:1108]3045153 AddExceptionRegInfo:add error register: core_id=11, stream_id=9, task_id=1369 [ERROR] RUNTIME(3043280,python3):2026-08-26-17:52:27.051.980 [device_error_core_proc.cc:1198]3045153 PrintCoreInfo:An error occurs on the device(chipId:6, dieId:0), the serial number is 14, the error is fftsplus aivector error, core id is 11, error code = 0x800000, dump info: pc start: 0x125801dcbf14, current: 0x125801dbce18, vec error info: 0xd31d5eefbd, mte error info: 0xf306000080, ifu error info: 0x79c5ef6198880, ccu error info: 0x241cd0879800080, cube error info: 0, biu error info: 0, aic error mask: 0x6500020bd00028c, para base: 0x12c1415a6080, aic cond: 0. The extend info: errcode:(0x800000, 0x4000, 0) errorStr: MTE accesses an invalid GM address or the cross-device memory access times out.The GM address accessed by scalar exceeds 48 bits. fixp_error0 info: 0x6000080, fixp_error1 info: 0xf3, fsmId:0, tslot:1, thread:0, ctxid:0, blk:6, sublk:1, subErrType:4. For details, see the troubleshooting document on the Ascend official website. Search for the keyword "AI Core Error". 4 ## 1. 现象 **首错(PyPTO AICore)** text kernel_name=PyPTO_mla_prolog_v4_0 MTE error: The GM address accessed by scalar exceeds 48 bits AICore 已执行 kernel,MTE 读到非法 GM 地址;不是算子精度问题,也不是 sche under-enqueue hang 的直接后果。 **复现条件**:capture replay / early launch、ctrl-flow cache hit、**多轮 pipeline 深度 ≥ ring 容量(4)** 后复用同一 slot。 --- ## 2. 根因 ### 2.1 RuntimeDataRingBuffer 与 cache 按 slot 隔离 DEFAULT_RUNTIME_DATA_RING_BUFFER_COUNT = 4。每轮 InitDyn: - AllocatePrepare / AllocateSubmit 占用 ring 中一个 **DevStartArgs slot**(index % 4)。 - ctrl-flow cache 按 **同一 slot 下标** 分片,而非全局共享一份: cpp // device_ctrl.h InitDyn ctrlFlowCache = base + usedCacheSize * ringBufferHead->GetIndexPendingIndex(); // GetIndexPendingIndex() == indexPending % 4 因此 **前 4 轮**(sequence 1–4)各用 slot 0/1/2/3,各自 IncastOutcastAddrRestore 写各自 cache 里的 rawTensorAddr,**相邻轮次之间不因 restore 互相覆盖**。 ### 2.2 重叠只发生在 ring 绕回同 slot 第 **5** 轮起复用 slot 0(与第 1 轮同槽),第 6 轮复用 slot 1(与第 2 轮同槽),以此类推。 early launch 跳过 RunPreSync,允许最多 **4 路** ctrl/sche/aicore pipeline 同时进行。若第 1 轮对应 slot 0 的 **AICore 仍在跑**(读该 slot cache 里的 rawTensorAddr),第 5 轮 ctrl 已对 **同一 slot 0** 执行 IncastOutcastAddrRestore → **同 slot 读写竞态** → 48bit MTE。 slot 释放(Deallocate)发生在 **sche 全部退出** 时,**不保证** AICore 已结束,故「sche 已释放 slot、AICore 仍存活」是竞态窗口。 ### 2.3 restore 改写内容与 AICore 读点 cache hit 时 InitCtrlFlowCache 对该 **slot** 的 cache 执行: text IncastOutcastAddrRestore() → DevMemcpyS 覆盖该 slot 的 live rawTensorAddr TaskAddrRestoreWorkspace() → 恢复 workspace 描述 RuntimeAddrRelocWorkspace() → reloc 该 slot freelist BlockHeader.ptr AICore kernel 通过 GM 读 func->rawTensorAddr[...](incast/outcast 地址表)。 ### 2.4 freelist reloc 缺失(master 已修) 同 slot restore 路径上,若 live BlockHeader.ptr 未 reloc 成 workspace 绝对地址,会返回 offset 当 GM(MR !5579)。与 slot 绕回复用时的并发 restore 同属 cache restore 类 GM 错误。 ### 2.5 因果链 text early launch → 最多 4 路 pipeline,跳过 RunPreSync → 第 5 轮复用 ring slot 0(与第 1 轮同槽) → 第 1 轮 AICore 仍读 slot 0 的 rawTensorAddr → 第 5 轮 ctrl InitDyn 对该 slot restore/reloc → MTE: "address exceeds 48 bits" 与 ctrl/sche under-enqueue hang **无关**。 ### 2.6 故障时序(slot 绕回) mermaid sequenceDiagram participant R1 as Round 1 (slot 0) participant R5 as Round 5 (slot 0) participant AIC as AICore (R1) Note over R1: sequence=1,cache slot 0 R1->>AIC: dispatch,读 slot0 rawTensorAddr Note over R5: sequence=5,复用 slot 0<br/>early,无 RunPreSync R5->>R5: InitDyn → IncastOutcastAddrRestore(slot0) Note over AIC: 仍读 slot0 旧表 AIC->>AIC: MTE 48bit GM error --- ### 3.1 本 PR:按算子隔离的 ping-pong event sync Device ring 仍是每算子 4 slot;host 侧**不**用 4 个全局 event 对齐 slot 下标,改为: - **每个 KernelBinary 独立** 2 个 ACL event(ping / pong)+ 独立 ringSequence_ - 同一算子最多 **2 路** early-launch 重叠;第 N 次 ctrl 启动前等第 N-2 次 aicore 结束 - 比 4-slot 绕回更保守,因此 slot 复用时上一轮 aicore 一定已退出 - globalRound 仍用进程级计数,只打日志,**不参与**同步 | 时机 | 行为 | |------|------| | 该算子 ringSequence ≤ 2 | 不 wait | | ringSequence > 2,ctrl 启动前 | wait 该算子 event [(N-3)%2],即上一拍 ping/pong 在 **本算子** aicore stream 上的完成 | | aicore launch 后 | record 该算子 event [(N-1)%2] | 启用条件(同时满足): - launch_early_mode != 2 - host ctrl-flow cache 已生效(FindOrBuildDevCache 得到非空 cache,含首次 Build) - 未设 PYPTO_LAUNCH_RING_EVENT_SYNC=false - 非 aicore-resolve 多算子整网:MLA / 其它 PyPTO 算子各自一份 ping-pong,互不踩 event、互不混计数。 ### 3.2 算子流时序(profiling 视图) 横向为时间。sche AICPU 负责 dispatch,与 aicore stream 上 PyPTO_mla_prolog_v4 **同段重叠**。ctrl stream 单独一行,early launch 下可 **领先** sche/aicore。 **修复前(early launch,无 ring event)— seq5 绕回 slot0 与 seq1 算子尾段重叠** text 时间 ──────────────────────────────────────────────────────────────────────────────► ctrl stream │[R1 Init │[R2 Init │[R3 Init │[R4 Init │[R5 Init restore slot0] (AICPU ctrl) │ restore s0]│ restore s1]│ restore s2]│ restore s3]│ ▲ 改写 s0 rawTensorAddr │ │ │ │ │ │ │ │ │ │ ┌─ 重叠 ─┐ stream 9 │[ sche ──── PyPTO_mla_prolog_v4 (seq1 · slot0) ────────────────►│ (sche≈aicore) │ dispatch ═══════════════════════════════════════════════════ │ │ │ │[sche──PyPTO (s1)──]│ │ │ │ │ │ │ │[sche─PyPTO(s2)─]│ │ │ │ │ │ │ │[sche PyPTO(s3)]│ │ │ │ │ │ │ │ └─┘ │ ring slot │ slot0 │ slot1 │ slot2 │ slot3 │ slot0 reuse 要点:seq1–4 **错开 slot**,restore 互不踩;seq5 ctrl restore 落在 seq1 算子流 **尚未结束** 的 tail 上。 **修复后(每算子 ping-pong)— 第 3 次 ctrl 先等第 1 次 aicore 结束** text 时间 ──────────────────────────────────────────────────────────────────────────────► ctrl stream │[R1 Init s0]│[R2 Init s1]│ wait evt0 │[R3 Init s2]│ wait evt1 │[R4 …] │ │ │ ◄─sync──►│ │ stream 9 │[ PyPTO seq1/slot0 ────]│ rec evt0 │ │ (本算子 aicore)│ │[seq2/s1 ──]│ rec evt1 │[seq3/s2──► │ ping-pong │ seq≤2:不 wait │ evt0=seq1 │ │ evt1=seq2 第 5 次复用 slot0 时,已经过「seq3 wait seq1」「seq5 wait seq3」,seq1 aicore 必已结束。  See merge request: cann/pypto!5516 | 3 months ago | |
fix(machine): fix log level mismatch, magic number and grammar errors Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5720 merge pyptolog_fix2 into master fix(machine): fix log level mismatch, magic number and grammar errors Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: 日志规范性整改 See merge request: cann/pypto!5720 | 3 months ago | |
fix(docs): Standardize aicore-exception FAQ format and translate Chinese comments to English Co-authored-by: chai-hw<chaizhengtong@huawei.com> # message auto-generated for no-merge-commit merge: !5757 merge delete_printf into master fix(docs): Standardize aicore-exception FAQ format and translate Chinese comments to English Created-by: chai-hw Commit-by: chai-hw Merged-by: cann-robot Description: 部分日志含有中文日志输出,现修改为英文,为了保持统一性,将注释也修改为英文 删除不被允许的printf内容,并且将文档中aicore error报错时的信息与实际修改为一致 See merge request: cann/pypto!5757 | 3 months ago | |
fix(Interpreter):Add interface to tile_fwk_adapter Co-authored-by: dingbo929<dingbo24@h-partners.com> # message auto-generated for no-merge-commit merge: !5390 merge master into master fix(Interpreter):Add interface to tile_fwk_adapter Created-by: dingbo929 Commit-by: dingbo929 Merged-by: cann-robot Description: 1. 上板dump用到的接口封装到adapter层 See merge request: cann/pypto!5390 | 3 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 3 months ago | ||
| 4 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 3 months ago | ||
| 3 months ago |