Skip to content

Align tmp contracts for tile ops#824

Open
FangRui0 wants to merge 2 commits into
hw-native-sys:mainfrom
FangRui0:refactor_tmp
Open

Align tmp contracts for tile ops#824
FangRui0 wants to merge 2 commits into
hw-native-sys:mainfrom
FangRui0:refactor_tmp

Conversation

@FangRui0

Copy link
Copy Markdown
Contributor

No description provided.

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

Copy link
Copy Markdown

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 updates several PTO IR operations to relax constraints on the tmp (temporary workspace) operand, particularly on the A5 architecture where it is treated as a placeholder that does not need to match the shape or layout of the source/destination tiles. This prevents false vector overflow diagnostics and updates memory effects. The review feedback points out a mismatch in the expected error message in a new test file and recommends completely removing the unused verifyTRowReductionNoTmpCommon helper function in PTO.cpp to avoid dead code.

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.

}
}

// CHECK: error: 'pto.trowmax' op expects tmp to use the row_major blayout

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 expected error message in the CHECK directive does not match the actual error message emitted by the verifier in lib/PTO/IR/PTO.cpp. The verifier emits "expects tmp to use row-major layout", but the test expects "expects tmp to use the row_major blayout". This mismatch will cause the lit test to fail.

// CHECK: error: 'pto.trowmax' op expects tmp to use row-major layout

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread lib/PTO/IR/PTO.cpp
Comment on lines +1875 to +1877
[[maybe_unused]] static LogicalResult
verifyTRowReductionNoTmpCommon(Operation *op, Type srcTy, Type dstTy,
StringRef elemTypeError) {

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 helper function verifyTRowReductionNoTmpCommon is now marked [[maybe_unused]] because all of its callers (TRowMaxOp and TRowSumOp) have been migrated to use verifyTRowReductionWithTmpCommon. Since this is a static helper function in this translation unit and is no longer used anywhere, it should be completely removed from the codebase to avoid dead code.

@reedhecre

reedhecre commented Jun 16, 2026

Copy link
Copy Markdown

Codex Review

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

  • PR: Align tmp contracts for tile ops #824 Align tmp contracts for tile ops
  • Author: FangRui0
  • Base/Head: main / refactor_tmp
  • Head SHA: b63bf80074c7
  • Trigger: PR 有新提交
  • Generated At: 2026-06-17T07:01:10Z
  • Previous Head SHA: 30be7a055599
  • Status: failed at codex-review (exit=1)

Summary

Review failed at stage codex-review: exit=1

Findings

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

Log Tail

 * branch            main       -> FETCH_HEAD
Switched to branch 'pr-824'
b63bf80074c766c1480baac95035b0532c5d7642
 docker/create_wheel.sh                             | 156 +++--
 docs/PTO_IR_manual.md                              | 749 ++++++++++++++-------
 include/PTO/IR/PTOOps.td                           |  21 +-
 lib/PTO/IR/PTO.cpp                                 | 132 ++--
 test/lit/pto/a5_unused_tmp_vec_overflow.pto        |  84 +++
 ...ssue708_zero_valid_rowexpand_a5_tmp_invalid.pto |  16 +-
 test/lit/pto/tcolsum_binary_tmp_stride.pto         |  23 +
 test/lit/pto/tmp_contract_a5_non_same_shape.pto    | 215 ++++++
 test/lit/pto/trow_reduction_tmp_layout_invalid.pto |  22 +
 test/lit/pto/trsqrt_precision_emitc.pto            |  12 +-
 test/lit/pto/tsort32_emitc.pto                     |  14 +-
 test/lit/pto/ttrans_tmp_placeholder_a5.pto         |  23 +
 test/lit/pto/txors_tmp_layout_a3.pto               |  23 +
 test/lit/pto/txors_tmp_type_a3.pto                 |  23 +
 .../Rowexpandmax/rowexpandmax_a5_tmp_invalid.py    |   6 +-
 .../Rowprod/trowprod_tmp_mismatch_invalid.py       |   5 +-
 .../npu/a5/src/st/testcase/txors/cases.py          |   6 +
 .../npu/a5/src/st/testcase/txors/txors.pto         |  19 +-
 18 files changed, 1168 insertions(+), 381 deletions(-)
===== END STAGE clone rc=0 @ 2026-06-17 15:00:34 =====

===== STAGE codex-review @ 2026-06-17 15:00:34 =====
set -euo pipefail
cd '/tmp/ptoas-pr-review-monitor/runs/20260617_150027_pr824/repo'
'codex' exec -C '/tmp/ptoas-pr-review-monitor/runs/20260617_150027_pr824/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/20260617_150027_pr824/review_schema.json' -o '/tmp/ptoas-pr-review-monitor/runs/20260617_150027_pr824/codex_last_message.json' --color never - < '/tmp/ptoas-pr-review-monitor/runs/20260617_150027_pr824/review_prompt.txt'
OpenAI Codex v0.115.0 (research preview)
--------
workdir: /tmp/ptoas-pr-review-monitor/runs/20260617_150027_pr824/repo
model: gpt-5.4
provider: codereview
approval: never
sandbox: read-only
reasoning effort: xhigh
reasoning summaries: none
session id: 019ed461-bd38-77f3-9a22-178c4f570a07
--------
user
你现在在审查 GitHub PR。

仓库:hw-native-sys/PTOAS
PR:#824 Align tmp contracts for tile ops
作者:FangRui0
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 #824 存在问题,并返回 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 503 Service Unavailable: Service temporarily unavailable, url: https://codex.0u0o.com/responses, request id: 3edcfd97-e29a-408e-abd9-a854c1594c8a)
Reconnecting... 2/5 (unexpected status 503 Service Unavailable: Service temporarily unavailable, url: https://codex.0u0o.com/responses, request id: b1c50e5e-cb57-4e7b-8db5-604d2996fa3b)
Reconnecting... 3/5 (unexpected status 503 Service Unavailable: Service temporarily unavailable, url: https://codex.0u0o.com/responses, request id: 69cd8e9b-324f-4e25-b559-fbbd025c0940)
Reconnecting... 4/5 (unexpected status 503 Service Unavailable: Service temporarily unavailable, url: https://codex.0u0o.com/responses, request id: b597f99e-2183-46e2-8a6f-6525b0509b3a)
Reconnecting... 5/5 (unexpected status 503 Service Unavailable: Service temporarily unavailable, url: https://codex.0u0o.com/responses, request id: 52309803-7624-4f4a-801f-d4d240a3956c)
ERROR: unexpected status 503 Service Unavailable: Service temporarily unavailable, url: https://codex.0u0o.com/responses, request id: e386f391-7786-4a0c-b223-f82dab47ea9a
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260617_150027_pr824/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-06-17 15:01:10 =====

Signed-off-by: FangRui <fangrui_95@163.com>
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