Skip to content

feat(vpto): add AICore ld_dev and st_dev ops - #1125

Merged
mouliangyu merged 1 commit into
mainfrom
codex/aicore-ld-dev-st-dev
Aug 5, 2026
Merged

feat(vpto): add AICore ld_dev and st_dev ops#1125
mouliangyu merged 1 commit into
mainfrom
codex/aicore-ld-dev-st-dev

Conversation

@mouliangyu

@mouliangyu mouliangyu commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

背景

普通 AICore 的 scalar GM data-cache bypass 与 SIMT pto.ldg / pto.stg 属于不同执行域和 intrinsic 家族。此前普通 pto.aicore 函数中的误用会通过 PTO verifier,随后使 Bisheng 在 device LLVM 编译阶段崩溃。

Closes #1032

主要变更

  • 先补齐现有 pto.ldg / pto.stg 的 placement verifier,只允许其位于 pto.simt_entrypto.section.simt
  • 新增独立的普通 AICore micro-op:pto.ld_devpto.st_dev,不继承 SIMT op。
  • 首版接口仅支持 !pto.ptr<T, gm>T = i8/i16/i32/i64;offset 为元素步长,load result/store value 必须与指针元素类型一致。
  • 固定绕过本地 L1 data cache,不接受 l1cache / l2cache policy 属性,也不隐含 atomic、同步、内存序、invalidate 或 writeback 语义。
  • 将 element offset 先 lower 为 typed GEP,再调用 offset 为 0 的 llvm.hivm.LD.DEV.u*.GM / llvm.hivm.ST.DEV.u*
  • 仅在 A5 且 CANN output version 9.0.0 official 或更新版本开放;A2/A3 与 9.0.0-beta.1 在进入 Bisheng 前给出明确诊断。
  • 保持 Group 14 为纯 shared arith、Group 17 为 SIMT;新增 Group 18 Special Scalar Operations,收录 10 个 PTO scalar kernel query、pointer/address 与 scalar-memory op。
  • 将 Group 18 从操作目录扩展为可独立阅读的手册:逐项说明 purpose、完整 syntax、operand/result/attribute、类型与地址空间约束、offset 单位、语义伪代码、execution scope、target gating 和示例。
  • docs/vpto-spec.md 保留总体说明和索引,同一批 scalar op 的重复逐项定义改为链接到 Group 18,避免两处规范成为不同真源。

测试

  • cmake --build build --target PTOASPythonPackage -j16
  • 5 个聚焦 VPTO lit 全部通过,覆盖 verifier、SIMT placement、i8/i16/i32/i64 LLVM emission、动态/静态 element offset 及 target/version gating;这些 compiler regression tests 不依赖 CANN 工具链。
  • test/vpto/scripts/run_host_vpto_validation.shmicro-op/scalar-load-store/ld-st-dev A5 simulator case 通过 fatobj/device-object emission、host build、runtime 与 golden compare。
  • 文档改动通过 git diff --check,并检查 Group 18 恰好包含 10 个 PTO scalar op 的独立手册小节,docs/vpto-spec.md 不再重复定义这些 op。

Runtime 与 object compilation 当前覆盖 i32 非零 offset roundtrip;i8/i16/i32/i64 四种宽度均由 LLVM emission 用例覆盖。

@mouliangyu
mouliangyu force-pushed the codex/aicore-ld-dev-st-dev branch 7 times, most recently from 30a55f6 to e205ea1 Compare August 4, 2026 11:28
@mouliangyu
mouliangyu marked this pull request as ready for review August 4, 2026 12:14
@mouliangyu
mouliangyu force-pushed the codex/aicore-ld-dev-st-dev branch 2 times, most recently from d14a316 to 70e413f Compare August 5, 2026 01:56
@mouliangyu
mouliangyu force-pushed the codex/aicore-ld-dev-st-dev branch from 70e413f to 4b8c3c4 Compare August 5, 2026 02:02
@mouliangyu
mouliangyu merged commit d5072e7 into main Aug 5, 2026
10 checks passed
@reedhecre

Copy link
Copy Markdown

A5 板测成功

  • 触发方式:merged
  • 源码提交:d5072e79a07d
  • 结果汇总:OK 21 / FAIL 0 / SKIP 0
  • 日志:/root/ptoas-board-monitor-a5/logs/20260805_111104_merged_pr1125.log
  • 结果 TSV:/root/ptoas-board-monitor-a5/logs/20260805_111104_merged_pr1125.tsv

@reedhecre

Copy link
Copy Markdown

A3 板测失败

  • 触发方式:merged
  • 源码提交:d5072e79a07d
  • 结果汇总:OK 218 / FAIL 2 / SKIP 3
  • 日志:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260804_201006_merged_pr1125.log
  • 失败阶段:board-validation / exit=1

失败用例

  • comm_p2p_binding_variants (run, exit=1)
  • comm_p2p (run, exit=1)

@reedhecre

Copy link
Copy Markdown

A3 板测失败详情:PR #1125

comm_p2p_binding_variants

stage=run info=exit=1

[ERROR] aclrtSynchronizeStream(stream) failed: 507035 (/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260804_201006_merged_pr1125/npu_validation/CommSync/comm_p2p_binding_variants/main.cpp:122)
[ERROR] RecentErrMsg: EZ9999: Inner Error!
EZ9999[PID: 1818261] 2026-08-04-20:52:16.645.950 (EZ9999):  The error from device(chipId:0, dieId:1), serial number is 2630, there is an exception of aivec error, core id is 10, error code = 0x10, dump info: pc start: 0x124200000000, current: 0x124200000164, vec error info: 0x4000000b7, mte error info: 0xa5030000e9, ifu error info: 0x2000100584480, ccu error info: 0x40e008000000004f, cube error info: 0, biu error info: 0, aic error mask: 0x6500020bd00028c, para base: 0x12c100000000.[FUNC:PrintCoreInfo][FILE:device_error_core_proc.cc][LINE:645]
        TraceBack (most recent call last):
       The extend info: errcode:(0x10, 0, 0) errorStr: Illegal instruction, which is usually caused by unaligned UUB addresses. fixp_error0 info: 0x30000e9, fixp_error1 info: 0xa5, fsmId:0, tslot:6, thread:0, ctxid:0, blk:0, sublk:0, subErrType:4.[FUNC:PrintCoreInfo][FILE:device_error_core_proc.cc][LINE:658]
       Kernel task happen error, retCode=0x31, [vector core exception].[FUNC:PreCheckTaskErr][FILE:davinci_kernel_task.cc][LINE:1729]
       AIV Kernel happen error, retCode=0x31.[FUNC:GetError][FILE:stream.cc][LINE:1475]
       [AIC_INFO] after execute:args print end[FUNC:GetError][FILE:stream.cc][LINE:1475]
       [DFX_INFO]Aicore kernel execute failed, device_id=1, stream_id=46, report_stream_id=46, task_id=0, flip_num=0, fault kernel_name=comm_p2p_binding_variants_kernel, fault kernel info ext=comm_p2p_binding_variants_kernel, program id=0, hash=3889294368825709812.[FUNC:GetError][FILE:stream.cc][LINE:1475]
       rtStreamSynchronize execution failed, reason=vector core exception[FUNC:FuncErrorReason][FILE:error_message_manage.cc][LINE:65]
       synchronize stream failed, runtime result = 507035[FUNC:ReportCallError][FILE:log_inner.cpp][LINE:148]
[2026-08-04 20:52:19] ERROR: testcase failed (exit 1): comm_p2p_binding_variants
comm_p2p

stage=run info=exit=1

[ERROR] aclrtSynchronizeStream(stream) failed: 507035 (/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260804_201006_merged_pr1125/npu_validation/CommSync/comm_p2p/main.cpp:122)
[ERROR] RecentErrMsg: EZ9999: Inner Error!
EZ9999[PID: 1836986] 2026-08-04-20:52:37.388.906 (EZ9999):  The error from device(chipId:0, dieId:1), serial number is 2631, there is an exception of aivec error, core id is 15, error code = 0x10, dump info: pc start: 0x124200000000, current: 0x124200000168, vec error info: 0x4000000b7, mte error info: 0xec06000023, ifu error info: 0x212c0d6200800, ccu error info: 0x40e028000000004f, cube error info: 0, biu error info: 0, aic error mask: 0x6500020bd00028c, para base: 0x12c100000000.[FUNC:PrintCoreInfo][FILE:device_error_core_proc.cc][LINE:645]
        TraceBack (most recent call last):
       The extend info: errcode:(0x10, 0, 0) errorStr: Illegal instruction, which is usually caused by unaligned UUB addresses. fixp_error0 info: 0x6000023, fixp_error1 info: 0xec, fsmId:1, tslot:6, thread:0, ctxid:0, blk:0, sublk:0, subErrType:4.[FUNC:PrintCoreInfo][FILE:device_error_core_proc.cc][LINE:658]
       Kernel task happen error, retCode=0x31, [vector core exception].[FUNC:PreCheckTaskErr][FILE:davinci_kernel_task.cc][LINE:1729]
       AIV Kernel happen error, retCode=0x31.[FUNC:GetError][FILE:stream.cc][LINE:1475]
       [AIC_INFO] after execute:args print end[FUNC:GetError][FILE:stream.cc][LINE:1475]
       [DFX_INFO]Aicore kernel execute failed, device_id=1, stream_id=46, report_stream_id=46, task_id=0, flip_num=0, fault kernel_name=comm_p2p_kernel, fault kernel info ext=comm_p2p_kernel, program id=0, hash=15664819858989799263.[FUNC:GetError][FILE:stream.cc][LINE:1475]
       rtStreamSynchronize execution failed, reason=vector core exception[FUNC:FuncErrorReason][FILE:error_message_manage.cc][LINE:65]
       synchronize stream failed, runtime result = 507035[FUNC:ReportCallError][FILE:log_inner.cpp][LINE:148]
[2026-08-04 20:52:38] ERROR: testcase failed (exit 1): comm_p2p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [阻塞] pto.ldg/pto.stg outside pto.simt_entry pass verification but crash Bisheng

3 participants