Skip to content

fix: align MAT fill and expand sync pipes#930

Open
HecreReed wants to merge 1 commit into
hw-native-sys:mainfrom
HecreReed:codex/fix-mat-pipe-sync
Open

fix: align MAT fill and expand sync pipes#930
HecreReed wants to merge 1 commit into
hw-native-sys:mainfrom
HecreReed:codex/fix-mat-pipe-sync

Conversation

@HecreReed

Copy link
Copy Markdown
Collaborator

Summary

Align PTOAS automatic sync pipe selection with the current pto-isa event contract for MAT tile operations:

  • classify TFILLPAD(MAT) as PIPE_MTE2 instead of PIPE_MTE1
  • classify TEXPANDS(MAT) as PIPE_MTE2 while preserving PIPE_V for vector destinations
  • cover both InsertSync and GraphSyncSolver

Root cause

The current pto-isa mapping defines:

  • TFILLPAD_MAT -> PIPE_MTE2
  • TEXPANDS_MAT -> PIPE_MTE2
  • TEXPANDS -> PIPE_V

PTOAS classified MAT TFILLPAD as MTE1 and all TEXPANDS as V. For a MAT producer followed by a MAT-to-RIGHT TMOV, sync insertion therefore placed an event before the producer or emitted an event for the wrong source pipe, leaving the actual MTE2 producer unordered with the MTE1 consumer.

Change

  • Update TExpandsOp::getPipe() to inspect the destination address space in both tile and lowered memref form.
  • Update the MAT-to-MAT TFillPadOp::getPipe() result to MTE2.
  • Update the existing TFILLPAD regression to check event placement after TFILLPAD.
  • Add a focused TEXPANDS MAT regression.
  • Exercise both sync implementations in both tests.

Verification

  • Release/Werror ptoas build completed successfully.
  • Focused InsertSync and GraphSyncSolver checks passed for both TFILLPAD and TEXPANDS.
  • check-pto: 847/847 passed.

Reviewed against pto-isa ecb6c303f797749f811a494742c3c08156aacabb.

@reedhecre

reedhecre commented Jul 10, 2026

Copy link
Copy Markdown

Codex Review

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

  • PR: fix: align MAT fill and expand sync pipes #930 fix: align MAT fill and expand sync pipes
  • Author: HecreReed
  • Base/Head: main / codex/fix-mat-pipe-sync
  • Head SHA: 4b5395dac408
  • Trigger: 检测到新的 open PR
  • Generated At: 2026-07-10T09:10:49Z
  • 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-10 17:10:33 =====
set -euo pipefail
rm -rf '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/repo'
git clone --branch 'main' --depth 50 'https://github.com/hw-native-sys/PTOAS.git' '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/repo'
cd '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/repo'
git fetch origin 'refs/pull/930/head:pr-930' --depth 50
git fetch origin 'main' --depth 50 || true
git checkout -f 'pr-930'
git rev-parse HEAD
git diff --stat 'origin/main...HEAD' || true
Cloning into '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/repo'...
From https://github.com/hw-native-sys/PTOAS
 * [new ref]           refs/pull/930/head -> pr-930
From https://github.com/hw-native-sys/PTOAS
 * branch              main       -> FETCH_HEAD
Switched to branch 'pr-930'
4b5395dac4087899549acd40185a03d28b2f9546
 include/PTO/IR/PTOOps.td                        | 27 +++++++++++++++--
 test/lit/pto/texpands_mat_pipe_selection.pto    | 39 +++++++++++++++++++++++++
 test/lit/pto/tfillpad_a5_mat_pipe_selection.pto | 21 +++++++++----
 3 files changed, 79 insertions(+), 8 deletions(-)
===== END STAGE clone rc=0 @ 2026-07-10 17:10:40 =====

===== STAGE codex-review @ 2026-07-10 17:10:40 =====
set -euo pipefail
cd '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/repo'
'codex' exec -C '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/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/20260710_171032_pr930/review_schema.json' -o '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/codex_last_message.json' --color never - < '/tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/review_prompt.txt'
[monitor] stage timeout: 1800s
OpenAI Codex v0.115.0 (research preview)
--------
workdir: /tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/repo
model: gpt-5.4
provider: codereview
approval: never
sandbox: read-only
reasoning effort: xhigh
reasoning summaries: none
session id: 019f4b4b-1c94-7533-b0c2-1c2042291c4b
--------
user
你现在在审查 GitHub PR。

仓库:hw-native-sys/PTOAS
PR:#930 fix: align MAT fill and expand sync pipes
作者:HecreReed
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 #930 存在问题,并返回 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: a18e6fcf6ea1dab4-LAX, request id: 019e87ac-6f7a-4d3f-84e3-34064e63bc5f)
Reconnecting... 2/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18e6fd2398ac121-LAS, request id: 1b0b2cb9-eb70-4bc4-9c8d-0615483c36a0)
Reconnecting... 3/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18e6fd689a85808-LAS, request id: 395d3b62-e184-4e8b-b918-fb035684e238)
Reconnecting... 4/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18e6fdd58197b7f-LAS, request id: 31e0b6f2-8185-4167-b144-f5a28c690c7b)
Reconnecting... 5/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18e6fe94d236c4b-LAS, request id: 2872a780-aed5-4ff8-aa45-993114e22ed1)
ERROR: unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18e6ffeabcf6e22-LAX, request id: f54753d7-bed3-40e1-b937-372d6b16ac64
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260710_171032_pr930/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-07-10 17:10:49 =====

@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 updates the pipe selection logic for TExpandsOp and TFillPadOp in PTOOps.td. Specifically, TExpandsOp now determines its pipe based on the destination address space (returning PIPE_MTE2 for MAT), and TFillPadOp has been updated to return PIPE_MTE2 instead of PIPE_MTE1 when both source and destination are in the MAT address space. Corresponding test cases have been added and updated to verify these changes. The review feedback suggests simplifying the getASFromType helper lambda in TExpandsOp to reduce boilerplate and improve readability.

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 include/PTO/IR/PTOOps.td
Comment on lines +4539 to +4555
auto getASFromType = [](Type ty)
-> std::optional<::mlir::pto::AddressSpace> {
if (auto tb = ::mlir::dyn_cast<::mlir::pto::TileBufType>(ty)) {
if (auto as = ::mlir::dyn_cast_or_null<::mlir::pto::AddressSpaceAttr>(
tb.getMemorySpace()))
return as.getAddressSpace();
return std::nullopt;
}
if (auto mr = ::mlir::dyn_cast<::mlir::MemRefType>(ty)) {
if (auto ms = mr.getMemorySpace()) {
if (auto as = ::mlir::dyn_cast<::mlir::pto::AddressSpaceAttr>(ms))
return as.getAddressSpace();
}
return std::nullopt;
}
return std::nullopt;
};

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

The helper lambda getASFromType can be simplified to reduce boilerplate and improve readability by extracting the memory space attribute first, and then performing a single dyn_cast_or_null check.

      auto getASFromType = [](::mlir::Type ty) -> std::optional<::mlir::pto::AddressSpace> {
        ::mlir::Attribute ms;
        if (auto tb = ::mlir::dyn_cast<::mlir::pto::TileBufType>(ty))
          ms = tb.getMemorySpace();
        else if (auto mr = ::mlir::dyn_cast<::mlir::MemRefType>(ty))
          ms = mr.getMemorySpace();
        if (auto as = ::mlir::dyn_cast_or_null<::mlir::pto::AddressSpaceAttr>(ms))
          return as.getAddressSpace();
        return std::nullopt;
      };

@HecreReed HecreReed marked this pull request as ready for review July 10, 2026 09:11
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@HecreReed

Copy link
Copy Markdown
Collaborator Author

/run a3

@reedhecre

Copy link
Copy Markdown

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

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

@reedhecre

Copy link
Copy Markdown

A3 板测完成(有跳过)

  • 触发方式:manual
  • 源码提交:6f61c6558110
  • 结果汇总:OK 221 / FAIL 0 / SKIP 2
  • 日志:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260710_021208_manual_pr930.log
  • 结果 TSV:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260710_021208_manual_pr930.tsv
  • 手动指令:/run a3
  • 触发人:HecreReed
  • 触发评论:fix: align MAT fill and expand sync pipes #930 (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