Skip to content

Legalize A5 PIPE_V barriers before VPTO emission#916

Merged
zhangstevenunity merged 1 commit into
hw-native-sys:mainfrom
KurrinQu:qkl/fix-a5-pipe-v-barrier
Jul 9, 2026
Merged

Legalize A5 PIPE_V barriers before VPTO emission#916
zhangstevenunity merged 1 commit into
hw-native-sys:mainfrom
KurrinQu:qkl/fix-a5-pipe-v-barrier

Conversation

@KurrinQu

@KurrinQu KurrinQu commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@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 adds checks to prevent unsupported A5 PIPE_V barriers from reaching the VPTO LLVM lowering stage, and schedules the LoweringSyncToPipe pass in the emission pipeline to legalize sync constructs. The reviewer suggested using assert or llvm_unreachable instead of op.emitError if the condition represents an invariant violation, or removing the "internal error" prefix if it is a user-facing error.

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 on lines +8644 to +8649
if (isTargetArchA5(op.getOperation()) &&
op.getPipe().getPipe() == PIPE::PIPE_V) {
op.emitError("internal error: A5 PIPE_V barrier should be erased before "
"VPTO LLVM lowering");
return failure();
}

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

In LLVM/MLIR, if a condition represents an invariant violation (i.e., an internal compiler error that should never be reached in a correct pipeline), it is more idiomatic to use assert or llvm_unreachable rather than op.emitError and returning failure(). This ensures that debug builds fail fast with a stack trace, making it much easier to debug.\n\nIf this condition can actually be triggered by invalid user input (e.g., if a user-provided program contains an unsupported barrier that cannot be legalized/erased), then op.emitError is appropriate, but the error message should be user-friendly and not prefixed with "internal error:".\n\nCould you clarify if this is a compiler invariant or a user-facing error, and update the handling accordingly?

    assert(!(isTargetArchA5(op.getOperation()) &&\n             op.getPipe().getPipe() == PIPE::PIPE_V) &&\n           "A5 PIPE_V barrier should be erased before VPTO LLVM lowering");

Comment on lines +8588 to +8593
if (isTargetArchA5(op.getOperation()) &&
op.getPipe().getPipe() == PIPE::PIPE_V) {
op.emitError("internal error: A5 PIPE_V barrier should be erased before "
"VPTO LLVM lowering");
return failure();
}

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

In LLVM/MLIR, if a condition represents an invariant violation (i.e., an internal compiler error that should never be reached in a correct pipeline), it is more idiomatic to use assert or llvm_unreachable rather than op.emitError and returning failure(). This ensures that debug builds fail fast with a stack trace, making it much easier to debug.\n\nIf this condition can actually be triggered by invalid user input (e.g., if a user-provided program contains an unsupported barrier that cannot be legalized/erased), then op.emitError is appropriate, but the error message should be user-friendly and not prefixed with "internal error:".\n\nCould you clarify if this is a compiler invariant or a user-facing error, and update the handling accordingly?

    assert(!(isTargetArchA5(op.getOperation()) &&\n             op.getPipe().getPipe() == PIPE::PIPE_V) &&\n           "A5 PIPE_V barrier should be erased before VPTO LLVM lowering");

@reedhecre

reedhecre commented Jul 8, 2026

Copy link
Copy Markdown

Codex Review

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

  • PR: Legalize A5 PIPE_V barriers before VPTO emission #916 Legalize A5 PIPE_V barriers before VPTO emission
  • Author: KurrinQu
  • Base/Head: main / qkl/fix-a5-pipe-v-barrier
  • Head SHA: 4e5d055db9f3
  • Trigger: 检测到新的 open PR
  • Generated At: 2026-07-08T12:40:51Z
  • Status: failed at codex-review (exit=1)

Summary

Review failed at stage codex-review: exit=1

Findings

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

Log Tail

===== STAGE clone @ 2026-07-08 20:40:37 =====
set -euo pipefail
rm -rf '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/repo'
git clone --branch 'main' --depth 50 'https://github.com/hw-native-sys/PTOAS.git' '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/repo'
cd '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/repo'
git fetch origin 'refs/pull/916/head:pr-916' --depth 50
git fetch origin 'main' --depth 50 || true
git checkout -f 'pr-916'
git rev-parse HEAD
git diff --stat 'origin/main...HEAD' || true
Cloning into '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/repo'...
From https://github.com/hw-native-sys/PTOAS
 * [new ref]           refs/pull/916/head -> pr-916
From https://github.com/hw-native-sys/PTOAS
 * branch              main       -> FETCH_HEAD
Switched to branch 'pr-916'
4e5d055db9f315fe45512245d2a008a8435c2d14
 lib/PTO/Transforms/VPTOCANN900LLVMEmitter.cpp | 7 +++++++
 lib/PTO/Transforms/VPTOLLVMEmitter.cpp        | 7 +++++++
 tools/ptoas/ptoas.cpp                         | 8 ++++++++
 3 files changed, 22 insertions(+)
===== END STAGE clone rc=0 @ 2026-07-08 20:40:43 =====

===== STAGE codex-review @ 2026-07-08 20:40:43 =====
set -euo pipefail
cd '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/repo'
'codex' exec -C '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/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/20260708_204036_pr916/review_schema.json' -o '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/codex_last_message.json' --color never - < '/tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/review_prompt.txt'
[monitor] stage timeout: 1800s
OpenAI Codex v0.115.0 (research preview)
--------
workdir: /tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/repo
model: gpt-5.4
provider: codereview
approval: never
sandbox: read-only
reasoning effort: xhigh
reasoning summaries: none
session id: 019f41be-b0af-7b03-aad2-83a42c6bd922
--------
user
你现在在审查 GitHub PR。

仓库:hw-native-sys/PTOAS
PR:#916 Legalize A5 PIPE_V barriers before VPTO emission
作者:KurrinQu
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 #916 存在问题,并返回 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: a17f28bbc891539e-LAX, request id: 6797c0bc-687c-47de-9c06-116a98ee7fc7)
Reconnecting... 2/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a17f28be8a4d9994-LAS, request id: 01b06a0f-1b4d-4818-8e1e-474dd3c6bfeb)
Reconnecting... 3/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a17f28c259f4964b-LAX, request id: 0af2e9d6-ccbf-43bd-8ca1-e15b48132c4f)
Reconnecting... 4/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a17f28c87fdf2b5c-LAX, request id: 05002dd2-730a-4850-92d0-751538f9cad6)
Reconnecting... 5/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a17f28d39e941400-LAX, request id: 57ec8cc9-a5b7-4fbf-beed-37194fe5a33d)
ERROR: unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a17f28e8ea882abc-LAX, request id: 41b5401c-cfec-4af7-adbb-eaec50734411
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260708_204036_pr916/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-07-08 20:40:51 =====

@zhangstevenunity zhangstevenunity merged commit ae27d94 into hw-native-sys:main Jul 9, 2026
26 of 34 checks passed
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.

4 participants