Skip to content

pre_quant doc & verify#922

Merged
Zhendong404 merged 1 commit into
hw-native-sys:mainfrom
and0d0:489-pre_quant-public-mode
Jul 18, 2026
Merged

pre_quant doc & verify#922
Zhendong404 merged 1 commit into
hw-native-sys:mainfrom
and0d0:489-pre_quant-public-mode

Conversation

@and0d0

@and0d0 and0d0 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

需求:
GEMM 第3个 mouliangyu#489

  • 修改前仓内代码已支持pre_quant=(..., "f32_bf16")此类表达
  • 新增文档,表明支pre_quant支持的类型
  • 新增了各类 mode & source dtype & destination dtype 的 verifier 约束/校验(不确定是否有必要)
  • 新增了相关正向测例与负向测例

@reedhecre

reedhecre commented Jul 9, 2026

Copy link
Copy Markdown

Codex Review

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

  • PR: pre_quant doc & verify #922 pre_quant doc & verify
  • Author: and0d0
  • Base/Head: main / 489-pre_quant-public-mode
  • Head SHA: 6e433af507b1
  • Trigger: 检测到新的 open PR
  • Generated At: 2026-07-09T03:50:41Z
  • Status: failed at codex-review (exit=1)

Summary

Review failed at stage codex-review: exit=1

Findings

未生成结构化 findings,因为 review 过程提前失败。

Log Tail

cd '/tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/repo'
git fetch origin 'refs/pull/922/head:pr-922' --depth 50
git fetch origin 'main' --depth 50 || true
git checkout -f 'pr-922'
git rev-parse HEAD
git diff --stat 'origin/main...HEAD' || true
Cloning into '/tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/repo'...
From https://github.com/hw-native-sys/PTOAS
 * [new ref]           refs/pull/922/head -> pr-922
From https://github.com/hw-native-sys/PTOAS
 * branch              main       -> FETCH_HEAD
Switched to branch 'pr-922'
6e433af507b10e382d58b523a9c2a79e29d535d0
 lib/PTO/IR/VPTO.cpp                                | 105 ++++++++++++++++++++
 ptodsl/docs/user_guide/07-data-movement-ops.md     |  63 ++++++++++++
 ptodsl/ptodsl/_ops.py                              |  84 +++++++++++++++-
 ptodsl/tests/test_jit_compile.py                   | 106 +++++++++++++++++++++
 test/lit/vpto/acc_store_gm_f32_bf16.pto            |  36 +++++++
 .../vpto/acc_store_verify_invalid_f32_bf16_dst.pto |  30 ++++++
 ...c_store_verify_invalid_f32_bf16_vec_payload.pto |  30 ++++++
 7 files changed, 453 insertions(+), 1 deletion(-)
===== END STAGE clone rc=0 @ 2026-07-09 11:50:33 =====

===== STAGE codex-review @ 2026-07-09 11:50:33 =====
set -euo pipefail
cd '/tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/repo'
'codex' exec -C '/tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/repo' -s read-only -c 'model_provider="codereview"' -c 'model="gpt-5.4"' -c 'model_reasoning_effort="xhigh"' --output-schema '/tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/review_schema.json' -o '/tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/codex_last_message.json' --color never - < '/tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/review_prompt.txt'
[monitor] stage timeout: 1800s
OpenAI Codex v0.115.0 (research preview)
--------
workdir: /tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/repo
model: gpt-5.4
provider: codereview
approval: never
sandbox: read-only
reasoning effort: xhigh
reasoning summaries: none
session id: 019f44ff-a9fa-75b2-ac1e-f0a71374ba51
--------
user
你现在在审查 GitHub PR。

仓库:hw-native-sys/PTOAS
PR:#922 pre_quant doc & verify
作者:and0d0
base branch:origin/main
head branch:HEAD(当前已 checkout 到 PR head)

要求:
1. 只审查这个 PR 相对 origin/main 的改动,必要时可以看上下文文件。
2. 重点找真实的 correctness / regression / contract mismatch / CI / runtime / compatibility 问题。
3. 不要提纯风格建议,不要提低价值猜测。
4. 严格按优先级输出:
   - P1:高概率会导致错误结果、编译/运行失败、严重回归、发布阻断
   - P2:重要缺陷、行为回归、遗漏校验/测试、较大兼容性问题
   - P3:次要但明确可改的问题
5. 如果没有问题,summary 直接写:未检查到 PR #922 存在问题,并返回 findings=[]。
6. 如果有问题,summary 简洁概括,findings 里每条都要给出:
   - severity
   - title
   - body(说明为什么是问题,尽量具体)
   - file(尽量给相对路径)
   - line(能确定就填整数,否则 null)

建议先查看:
- git status --short
- git diff --stat origin/main...HEAD
- git diff --unified=80 origin/main...HEAD

最终输出必须严格匹配 JSON schema。

mcp startup: no servers
Reconnecting... 1/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a1845d7e396f34a9-LAS, request id: 3a4fa472-6085-4f22-8b34-db82fe4b71a3)
Reconnecting... 2/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a1845d81391969af-LAX, request id: f4914eb0-d988-4b8e-91a9-5d9203bf17b0)
Reconnecting... 3/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a1845d854f47e9e5-LAX, request id: 2510759c-7c7b-4232-b958-a0f99fad405e)
Reconnecting... 4/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a1845d8b5c2c996a-LAX, request id: acb823ca-eb30-4206-9762-564a0aaadab0)
Reconnecting... 5/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a1845d95ea1508d3-LAX, request id: 42461fba-7680-43e2-9212-a300fd1475a1)
ERROR: unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a1845daa483b3f0c-LAX, request id: 6682be65-9167-44d6-a457-ccae68549280
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260709_115026_pr922/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-07-09 11:50:41 =====

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

Copy link
Copy Markdown
Contributor

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 introduces validation and verification for pre_quant modes and destination types in the PTO compiler. It adds destination family mapping and verification in C++ (VPTO.cpp), payload and mode validation in Python (_ops.py), updates user documentation, and adds corresponding JIT and LIT tests. The feedback points out that the no_convert mode incorrectly triggers a TypeError in the Python validation logic because it is subjected to the scalar payload check, and suggests skipping validation for this mode.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread ptodsl/ptodsl/_ops.py Outdated
Comment on lines +3797 to +3807
if normalized_mode.endswith("_vec"):
if not _is_acc_store_scaling_pointer_payload(payload):
raise TypeError(
"acc store vector pre_quant payload must be a scaling pointer "
"with f16, bf16, or f32 elements"
)
else:
if not _is_acc_store_float_scalar_payload(payload):
raise TypeError(
"acc store scalar pre_quant payload must be an f16, bf16, or f32 scalar"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

对于 no_convert 模式,由于不需要进行量化或转换,因此不应该强制要求 payload 必须是 float 标量。在当前的逻辑中,如果 normalized_modeno_convert,它会进入 else 分支并触发 TypeError

建议对 no_convert 模式进行特殊处理,跳过 payload 的类型校验。

    if normalized_mode == "no_convert":
        pass
    elif normalized_mode.endswith("_vec"):
        if not _is_acc_store_scaling_pointer_payload(payload):
            raise TypeError(
                "acc store vector pre_quant payload must be a scaling pointer "
                "with f16, bf16, or f32 elements"
            )
    else:
        if not _is_acc_store_float_scalar_payload(payload):
            raise TypeError(
                "acc store scalar pre_quant payload must be an f16, bf16, or f32 scalar"
            )

Comment on lines +1083 to +1090
acc_f32,
dst_bf16,
16,
16,
16,
16,
0,
0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这几个参数能不能写一行,稍微有点丑

@and0d0
and0d0 force-pushed the 489-pre_quant-public-mode branch from 6e433af to 52e9686 Compare July 15, 2026 07:20
@and0d0
and0d0 force-pushed the 489-pre_quant-public-mode branch from 52e9686 to 4059fa2 Compare July 17, 2026 03:31
@Zhendong404
Zhendong404 merged commit 349b603 into hw-native-sys:main Jul 18, 2026
12 of 13 checks passed
@reedhecre

Copy link
Copy Markdown

A5 板测成功

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

@reedhecre

Copy link
Copy Markdown

A3 板测失败

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

失败用例

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

@reedhecre

Copy link
Copy Markdown

A3 板测失败详情:PR #922

comm_p2p_binding_variants

stage=run info=exit=1

[ERROR] aclrtSynchronizeStream(stream) failed: 507035 (/home/zhongxuan/ptoas-board-monitor/runtime/runs/20260718_073505_merged_pr922/npu_validation/CommSync/comm_p2p_binding_variants/main.cpp:122)
[ERROR] RecentErrMsg: EZ9999: Inner Error!
EZ9999[PID: 3733648] 2026-07-18-08:14:07.872.096 (EZ9999):  The error from device(chipId:0, dieId:1), serial number is 1639, there is an exception of aivec error, core id is 47, error code = 0x10, dump info: pc start: 0x124200000000, current: 0x124200000164, vec error info: 0x4000000b7, mte error info: 0x3c0300404d, ifu error info: 0x2ffffff080d40, 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: 0x300404d, fixp_error1 info: 0x3c, fsmId:0, tslot:2, 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=16541545288638093324.[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-07-18 08:14:10] 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/20260718_073505_merged_pr922/npu_validation/CommSync/comm_p2p/main.cpp:122)
[ERROR] RecentErrMsg: EZ9999: Inner Error!
EZ9999[PID: 3740102] 2026-07-18-08:14:30.398.930 (EZ9999):  The error from device(chipId:0, dieId:1), serial number is 1640, there is an exception of aivec error, core id is 2, error code = 0x10, dump info: pc start: 0x124200000000, current: 0x124200000168, vec error info: 0xdf00005f59, mte error info: 0x3c0300404d, ifu error info: 0x212c0ac104080, ccu error info: 0x21b59000000004f, 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: 0x300404d, fixp_error1 info: 0x3c, fsmId:0, tslot:2, 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=6260346515940177617.[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-07-18 08:14:31] 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.

3 participants