Skip to content

pre_quant doc & verify#922

Open
and0d0 wants to merge 1 commit into
hw-native-sys:mainfrom
and0d0:489-pre_quant-public-mode
Open

pre_quant doc & verify#922
and0d0 wants to merge 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

TODO:
ci已过,人工再审查一下文档

  • 新增了_ops前置的 mode -> 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
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"
            )

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