Skip to content

feat: preserve debug name hints in ptoas emitc#658

Open
HecreReed wants to merge 7 commits into
hw-native-sys:mainfrom
HecreReed:issue337-debug-name-hints
Open

feat: preserve debug name hints in ptoas emitc#658
HecreReed wants to merge 7 commits into
hw-native-sys:mainfrom
HecreReed:issue337-debug-name-hints

Conversation

@HecreReed
Copy link
Copy Markdown
Collaborator

实现 issue #337 的调试命名提示链路:

  • 前端通过 Location 承载名字提示
  • ptoas 在 emitc lowering 后重写局部变量名,尽量保留原始语义名字
  • 补充设计文档与回归用例

本地验证:

  • cmake --build build-issue337-nowerror --target ptoas -j8
  • llvm-lit -sv build-issue337-nowerror/test/lit/pto/debug_name_hints_emitc.pto build-issue337-nowerror/test/lit/pto/debug_name_hints_cfg_emitc.pto

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements variable name preservation from PTO IR to the generated C++ code to improve debuggability. It introduces a design document, test cases, and logic in ptoas to extract name hints from Location metadata, annotate the IR, and post-process the C++ output to replace generic variable names with hinted ones. Feedback includes addressing potential name collisions by populating the used names set, optimizing keyword lookups using llvm::StringSwitch, improving the performance of marker stripping from O(N^2) to O(N), and replacing magic numbers with named constants.

Comment thread tools/ptoas/ptoas.cpp Outdated
static void rewriteNameHintMarkers(std::string &cpp) {
constexpr llvm::StringLiteral kMarkerPrefix = "/* PTOAS_NAME_HINTS:";
llvm::StringMap<std::string> replacements;
std::set<std::string> usedNames;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The usedNames set is currently empty when renaming starts. This means that if a name hint conflicts with an existing identifier in the C++ code (such as a function parameter, a global variable, or a local variable that didn't have a hint), makeUniqueCppIdentifier will not detect the collision. You should populate usedNames with all existing identifiers in the cpp string before starting the renaming process.

Comment thread tools/ptoas/ptoas.cpp
Comment on lines +324 to +344
static bool isReservedCppIdentifier(llvm::StringRef name) {
static const std::set<std::string> kReserved = {
"alignas", "alignof", "asm", "auto", "bool",
"break", "case", "catch", "char", "char8_t",
"char16_t", "char32_t", "class", "const", "consteval",
"constexpr", "constinit", "const_cast","continue", "co_await",
"co_return", "co_yield", "decltype", "default", "delete",
"do", "double", "dynamic_cast", "else", "enum",
"explicit", "export", "extern", "false", "float",
"for", "friend", "goto", "if", "inline",
"int", "long", "mutable", "namespace", "new",
"noexcept", "nullptr", "operator", "private", "protected",
"public", "register", "reinterpret_cast", "requires",
"return", "short", "signed", "sizeof", "static",
"static_assert", "static_cast", "struct", "switch", "template",
"this", "thread_local", "throw", "true", "try",
"typedef", "typeid", "typename", "union", "unsigned",
"using", "virtual", "void", "volatile", "wchar_t",
"while"};
return kReserved.count(name.str()) != 0;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using std::set<std::string> for keyword lookup is functional but less efficient than using llvm::StringSwitch. In LLVM-based tools, StringSwitch is more idiomatic and provides better performance for small sets of strings.

static bool isReservedCppIdentifier(llvm::StringRef name) {
  return llvm::StringSwitch<bool>(name)
      .Cases("alignas", "alignof", "asm", "auto", "bool", true)
      .Cases("break", "case", "catch", "char", "char8_t", true)
      .Cases("char16_t", "char32_t", "class", "const", "consteval", true)
      .Cases("constexpr", "constinit", "const_cast", "continue", "co_await", true)
      .Cases("co_return", "co_yield", "decltype", "default", "delete", true)
      .Cases("do", "double", "dynamic_cast", "else", "enum", true)
      .Cases("explicit", "export", "extern", "false", "float", true)
      .Cases("for", "friend", "goto", "if", "inline", true)
      .Cases("int", "long", "mutable", "namespace", "new", true)
      .Cases("noexcept", "nullptr", "operator", "private", "protected", true)
      .Cases("public", "register", "reinterpret_cast", "requires", true)
      .Cases("return", "short", "signed", "sizeof", "static", true)
      .Cases("static_assert", "static_cast", "struct", "switch", "template", true)
      .Cases("this", "thread_local", "throw", "true", "try", true)
      .Cases("typedef", "typeid", "typename", "union", "unsigned", true)
      .Cases("using", "virtual", "void", "volatile", "wchar_t", true)
      .Case("while", true)
      .Default(false);
}

Comment thread tools/ptoas/ptoas.cpp Outdated
Comment on lines +937 to +956
static void stripNameHintMarkers(std::string &cpp) {
constexpr llvm::StringLiteral kMarkerPrefix = "/* PTOAS_NAME_HINTS:";
size_t searchPos = 0;
while (true) {
size_t markerPos = cpp.find(kMarkerPrefix.str(), searchPos);
if (markerPos == std::string::npos)
break;

size_t markerEnd = cpp.find("*/", markerPos + kMarkerPrefix.size());
if (markerEnd == std::string::npos)
break;
markerEnd += 2;
while (markerEnd < cpp.size() &&
(cpp[markerEnd] == '\r' || cpp[markerEnd] == '\n'))
++markerEnd;

cpp.erase(markerPos, markerEnd - markerPos);
searchPos = markerPos;
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation of stripNameHintMarkers has $O(N^2)$ time complexity in the worst case because std::string::erase shifts all subsequent characters on every call. For large generated C++ files, this can become a performance bottleneck. It is better to perform the stripping in a single $O(N)$ pass, possibly integrated into the main replacement loop.

Comment thread tools/ptoas/ptoas.cpp Outdated
if (!hints)
continue;

size_t windowEnd = std::min(searchPos + static_cast<size_t>(2048),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The search window size 2048 is a magic number. While likely sufficient for most cases, it should be defined as a named constant (e.g., kSearchWindowSize) to improve maintainability and clarify the intent.

Suggested change
size_t windowEnd = std::min(searchPos + static_cast<size_t>(2048),
constexpr size_t kSearchWindowSize = 2048;
size_t windowEnd = std::min(searchPos + kSearchWindowSize, cpp.size());

@reedhecre
Copy link
Copy Markdown

reedhecre commented May 12, 2026

Codex Review

该评论由 review 机器人自动更新。

  • PR: feat: preserve debug name hints in ptoas emitc #658 feat: preserve debug name hints in ptoas emitc
  • Author: HecreReed
  • Base/Head: main / issue337-debug-name-hints
  • Head SHA: 1a1738c8f472
  • Trigger: PR 有新提交
  • Generated At: 2026-05-13T10:35:13Z
  • Previous Head SHA: 7d36959e0338
  • Status: completed

Summary

检查到 2 个 P2 问题:多结果 textual SSA 名称不会被保留,且 Qwen validation 的 scalar 默认值兼容层不完整。

Findings

  1. P2 多结果 op 的 textual SSA 名称提示会被整条跳过 tools/ptoas/ptoas.cpp:354

parseLeadingOpResultNames() 没有处理 MLIR 多结果语法里的 :N 后缀。像 test/lit/pto/kernel_kind_vector_scf_while_emitc.pto 里的 %final:2 = scf.while ... / %yield:2 = scf.if ...parseMlirValueName() 只会读到 %final/%yield,随后这里立刻要求下一个非空白字符必须是 =,因此直接返回 false,整条 op 的 result hint 都不会写回 Location。结果是这个 PR 宣称的“从 textual .pto 保留 SSA debug name”在 scf.whilescf.if 这类常见多结果 op 上会静默失效。

  1. P2 Qwen 样例的 scalar 默认值仍然绑定旧的 `vN` 参数名 test/npu_validation/scripts/generate_testcase.py:867

这个 PR 现在会把 textual 函数参数名保留下来,所以 Qwen case 的参数名会从旧的 vN 变成 argN(例如 qwen3_decode_incore_4 的 scalars 是 %arg10/%arg11/%arg12qwen3_decode_incore_9%arg3/%arg4)。但 _integer_scalar_default_value() 仍然按 CASE_INT_SCALAR_DEFAULTS 里的旧名 v11/v12/v13v4/v5 等查表,查不到就回退到 1。PR 里给 Qwen golden lib 新增的 legacy-name shim 只覆盖了 buffer 名,不覆盖 scalar,因此这里会把关键默认值喂错:例如 case 4 的中间 scalar 原本要求 0,case 9/10 的第二个 scalar 原本要求 64,现在都会退化成 1,从而生成错误的 board/NPU validation 输入和 golden。

@HecreReed HecreReed marked this pull request as ready for review May 13, 2026 07:52
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca1265fd6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/ptoas/ptoas.cpp
Comment on lines +397 to +398
if (size_t commentPos = line.find("//"); commentPos != llvm::StringRef::npos)
body = line.take_front(commentPos);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse MLIR comments without truncating string literals

stripMlirLineComments removes everything after the first // on each line, even when // appears inside a quoted MLIR string (e.g. location metadata like loc("a//b")). Because extractTextualNameHints depends on this preprocessed text for function/SSA hint alignment, valid textual IR containing // in string literals can produce misaligned or missing hints and incorrect downstream renaming. This is a regression in the new textual-hint pipeline and should use a comment scanner that ignores // within string literals.

Useful? React with 👍 / 👎.

Comment thread tools/ptoas/ptoas.cpp
Comment on lines +1753 to +1754
if (trimmed.starts_with("using "))
break;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Continue scanning declarations after top-level using aliases

findTopLevelGeneratedDeclarations stops at the first using ... line, so functions that begin with a type alias never collect later hoisted generated declarations. collectPendingIdentifierRenames relies on this list to map CFG/block-arg hints back onto hoisted vN temporaries, so in any function with both a leading using and block-arg hints, the block-arg rename path is silently disabled. This breaks the stated name-preservation behavior for a common EmitC function prologue pattern.

Useful? React with 👍 / 👎.

@HecreReed
Copy link
Copy Markdown
Collaborator Author

/run a3

@reedhecre
Copy link
Copy Markdown

已接收 /run a3,A3 板测器会处理这条请求。

页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。

@reedhecre
Copy link
Copy Markdown

A3 板测失败

  • 触发方式:manual
  • 源码提交:93d260e811e4
  • 结果汇总:OK 196 / FAIL 17 / SKIP 1
  • 日志:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260513_160705_manual_pr658.log
  • 手动指令:/run a3
  • 触发人:HecreReed
  • 触发评论:feat: preserve debug name hints in ptoas emitc #658 (comment)
  • 失败阶段:board-validation / exit=1

失败用例

  • qwen3_decode_incore_4 (run, exit=1)
  • qwen3_decode_incore_3 (run, exit=1)
  • qwen3_decode_incore_8 (run, exit=1)
  • qwen3_decode_incore_0 (run, exit=1)
  • qwen3_decode_incore_1 (run, exit=1)
  • qwen3_decode_incore_10 (run, exit=1)
  • qwen3_decode_incore_14 (run, exit=1)
  • qwen3_decode_incore_11 (run, exit=1)
  • qwen3_decode_incore_9 (run, exit=1)
  • qwen3_decode_incore_6 (run, exit=1)
  • qwen3_decode_incore_2 (run, exit=1)
  • qwen3_decode_incore_13 (run, exit=1)
  • qwen3_decode_incore_16 (run, exit=1)
  • qwen3_decode_incore_7 (run, exit=1)
  • qwen3_decode_incore_5 (run, exit=1)
  • qwen3_decode_incore_15 (run, exit=1)
  • qwen3_decode_incore_12 (run, exit=1)

@reedhecre
Copy link
Copy Markdown

A3 板测失败详情:PR #658

qwen3_decode_incore_4

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_4/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_4')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_4/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_4/qwen3_decode_golden_lib.py", line 188, in build_case_4
    'v1': make_padded_rows_bf16(generator, meta.elem_counts['v1'], cols=HEAD_DIM, rows_per_group=Q_HEAD_PAD, active_rows=Q_HEAD_BATCH, scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:02] ERROR: testcase failed (exit 1): qwen3_decode_incore_4
qwen3_decode_incore_3

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_3/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_3')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_3/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_3/qwen3_decode_golden_lib.py", line 174, in build_case_3
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:04] ERROR: testcase failed (exit 1): qwen3_decode_incore_3
qwen3_decode_incore_8

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_8/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_8')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_8/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_8/qwen3_decode_golden_lib.py", line 310, in build_case_8
    'v1': make_fp32(generator, meta.elem_counts['v1'], scale=0.05, positive=True),
KeyError: 'v1'
[2026-05-13 16:28:07] ERROR: testcase failed (exit 1): qwen3_decode_incore_8
qwen3_decode_incore_0

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_0/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_0')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_0/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_0/qwen3_decode_golden_lib.py", line 88, in build_case_0
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:09] ERROR: testcase failed (exit 1): qwen3_decode_incore_0
qwen3_decode_incore_1

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_1/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_1')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_1/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_1/qwen3_decode_golden_lib.py", line 115, in build_case_1
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:12] ERROR: testcase failed (exit 1): qwen3_decode_incore_1
qwen3_decode_incore_10

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_10/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_10')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_10/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_10/qwen3_decode_golden_lib.py", line 355, in build_case_10
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:14] ERROR: testcase failed (exit 1): qwen3_decode_incore_10
qwen3_decode_incore_14

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_14/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_14')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_14/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_14/qwen3_decode_golden_lib.py", line 414, in build_case_14
    'v1': make_fp32(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:17] ERROR: testcase failed (exit 1): qwen3_decode_incore_14
qwen3_decode_incore_11

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_11/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_11')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_11/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_11/qwen3_decode_golden_lib.py", line 369, in build_case_11
    'v1': np.zeros(meta.elem_counts['v1'], dtype=meta.np_types['v1']),
KeyError: 'v1'
[2026-05-13 16:28:20] ERROR: testcase failed (exit 1): qwen3_decode_incore_11
qwen3_decode_incore_9

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_9/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_9')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_9/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_9/qwen3_decode_golden_lib.py", line 337, in build_case_9
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:22] ERROR: testcase failed (exit 1): qwen3_decode_incore_9
qwen3_decode_incore_6

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_6/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_6')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_6/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_6/qwen3_decode_golden_lib.py", line 259, in build_case_6
    'v1': np.zeros(meta.elem_counts['v1'], dtype=meta.np_types['v1']),
KeyError: 'v1'
[2026-05-13 16:28:25] ERROR: testcase failed (exit 1): qwen3_decode_incore_6
qwen3_decode_incore_2

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_2/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_2')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_2/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_2/qwen3_decode_golden_lib.py", line 140, in build_case_2
    'v1': np.zeros(meta.elem_counts['v1'], dtype=meta.np_types['v1']),
KeyError: 'v1'
[2026-05-13 16:28:29] ERROR: testcase failed (exit 1): qwen3_decode_incore_2
qwen3_decode_incore_13

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_13/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_13')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_13/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_13/qwen3_decode_golden_lib.py", line 408, in build_case_13
    return build_case_12(meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_13/qwen3_decode_golden_lib.py", line 392, in build_case_12
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:32] ERROR: testcase failed (exit 1): qwen3_decode_incore_13
qwen3_decode_incore_16

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_16/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_16')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_16/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_16/qwen3_decode_golden_lib.py", line 448, in build_case_16
    'v1': make_fp32(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:35] ERROR: testcase failed (exit 1): qwen3_decode_incore_16
qwen3_decode_incore_7

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_7/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_7')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_7/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_7/qwen3_decode_golden_lib.py", line 290, in build_case_7
    'v1': make_padded_rows_bf16(generator, meta.elem_counts['v1'], cols=SEQ_TILE, rows_per_group=Q_HEAD_PAD, active_rows=Q_HEAD_BATCH, scale=0.05, positive=True),
KeyError: 'v1'
[2026-05-13 16:28:38] ERROR: testcase failed (exit 1): qwen3_decode_incore_7
qwen3_decode_incore_5

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_5/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_5')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_5/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_5/qwen3_decode_golden_lib.py", line 239, in build_case_5
    'v1': np.zeros(meta.elem_counts['v1'], dtype=meta.np_types['v1']),
KeyError: 'v1'
[2026-05-13 16:28:41] ERROR: testcase failed (exit 1): qwen3_decode_incore_5
qwen3_decode_incore_15

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_15/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_15')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_15/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_15/qwen3_decode_golden_lib.py", line 430, in build_case_15
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:43] ERROR: testcase failed (exit 1): qwen3_decode_incore_15
qwen3_decode_incore_12

stage=run info=exit=1

Traceback (most recent call last):
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_12/./golden.py", line 14, in <module>
    run_case('qwen3_decode_incore_12')
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_12/qwen3_decode_golden_lib.py", line 484, in run_case
    buffers, golden = BUILDERS[case_name](meta, generator, ints)
  File "/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260513_160705_manual_pr658/npu_validation/Qwen3DecodeA3/qwen3_decode_incore_12/qwen3_decode_golden_lib.py", line 392, in build_case_12
    'v1': make_bf16(generator, meta.elem_counts['v1'], scale=0.05),
KeyError: 'v1'
[2026-05-13 16:28:45] ERROR: testcase failed (exit 1): qwen3_decode_incore_12

@HecreReed
Copy link
Copy Markdown
Collaborator Author

/run a3

@reedhecre
Copy link
Copy Markdown

已接收 /run a3,A3 板测器会处理这条请求。

页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。

@reedhecre
Copy link
Copy Markdown

A3 板测完成(有跳过)

  • 触发方式:manual
  • 源码提交:78c8e7b8061e
  • 结果汇总:OK 213 / FAIL 0 / SKIP 1
  • 日志:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260513_165606_manual_pr658.log
  • 结果 TSV:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260513_165606_manual_pr658.tsv
  • 手动指令:/run a3
  • 触发人:HecreReed
  • 触发评论:feat: preserve debug name hints in ptoas emitc #658 (comment)

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.

2 participants