Skip to content

feat(ptodsl): Migrate TileLib from TilelangDSL to PTODSL: Daemon and metadata#931

Open
Zhendong404 wants to merge 60 commits into
hw-native-sys:mainfrom
Zhendong404:ptodsl-tilelib
Open

feat(ptodsl): Migrate TileLib from TilelangDSL to PTODSL: Daemon and metadata#931
Zhendong404 wants to merge 60 commits into
hw-native-sys:mainfrom
Zhendong404:ptodsl-tilelib

Conversation

@Zhendong404

Copy link
Copy Markdown
Contributor

No description provided.

ManiSadati and others added 30 commits July 10, 2026 19:22

@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 the PTODSL TileLib backend for VPTO tile-op expansion, adding the InsertTemplateAttributes pass to query legal candidates and updating ExpandTileOp to support PTODSL-native templates with robust specialization caching. It also implements the Python-side TileLib serving daemon, registry, and ported templates. The review feedback highlights critical compilation errors in FoldTileBufIntrinsics.cpp where MLIR Op wrappers incorrectly use the . operator instead of -> to access Operation methods, as well as a minor capitalization inconsistency in the design documentation.

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 +304 to +308
if (memrefCastOp.getNumOperands() == 1 && memrefCastOp.getNumResults() == 1 &&
isa<MemRefType>(memrefCastOp.getOperand(0).getType()) &&
isa<MemRefType>(memrefCastOp.getResult(0).getType())) {
castOp = memrefCastOp;
memrefVal = memrefCastOp.getOperand(0);

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.

critical

In MLIR, Op wrappers (like UnrealizedConversionCastOp) do not inherit Operation methods directly via the . operator. To access Operation methods such as getNumOperands(), getNumResults(), getOperand(), and getResult(), you must use the -> operator or call getOperation(). Using . will result in a compilation error.

Suggested change
if (memrefCastOp.getNumOperands() == 1 && memrefCastOp.getNumResults() == 1 &&
isa<MemRefType>(memrefCastOp.getOperand(0).getType()) &&
isa<MemRefType>(memrefCastOp.getResult(0).getType())) {
castOp = memrefCastOp;
memrefVal = memrefCastOp.getOperand(0);
if (memrefCastOp->getNumOperands() == 1 && memrefCastOp->getNumResults() == 1 &&
isa<MemRefType>(memrefCastOp->getOperand(0).getType()) &&
isa<MemRefType>(memrefCastOp->getResult(0).getType())) {
castOp = memrefCastOp;
memrefVal = memrefCastOp->getOperand(0);

Comment on lines +804 to +810
func.walk([&](UnrealizedConversionCastOp castOp) {
if (castOp.use_empty() && castOp.getNumOperands() == 1 &&
isa<MemRefType>(castOp.getOperand(0).getType()) &&
isa<MemRefType, pto::PartitionTensorViewType, pto::TileBufType>(
castOp.getResult(0).getType()))
deadCasts.push_back(castOp);
});

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.

critical

Similar to the previous issue, castOp is an UnrealizedConversionCastOp wrapper object. You must use the -> operator to access Operation methods like use_empty(), getNumOperands(), getOperand(), and getResult() to avoid compilation errors.

Suggested change
func.walk([&](UnrealizedConversionCastOp castOp) {
if (castOp.use_empty() && castOp.getNumOperands() == 1 &&
isa<MemRefType>(castOp.getOperand(0).getType()) &&
isa<MemRefType, pto::PartitionTensorViewType, pto::TileBufType>(
castOp.getResult(0).getType()))
deadCasts.push_back(castOp);
});
func.walk([&](UnrealizedConversionCastOp castOp) {
if (castOp->use_empty() && castOp->getNumOperands() == 1 &&
isa<MemRefType>(castOp->getOperand(0).getType()) &&
isa<MemRefType, pto::PartitionTensorViewType, pto::TileBufType>(
castOp->getResult(0).getType()))
deadCasts.push_back(castOp);
});

- `fusible`
- `loop_depth`
- `id`
- `Tail`

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 field name Tail is capitalized, whereas all other fields in this list (e.g., priority, fusible, loop_depth, id, is_post_update) are lowercase. To maintain consistency with the other metadata fields, it should be lowercase tail.

Suggested change
- `Tail`
- `tail`

@reedhecre

reedhecre commented Jul 11, 2026

Copy link
Copy Markdown

Codex Review

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

Summary

Review failed at stage codex-review: exit=1

Findings

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

Log Tail


===== STAGE clone @ 2026-07-11 23:50:26 =====
set -euo pipefail
rm -rf '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/repo'
git clone --branch 'main' --depth 50 'https://github.com/hw-native-sys/PTOAS.git' '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/repo'
cd '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/repo'
git fetch origin 'refs/pull/931/head:pr-931' --depth 50
git fetch origin 'main' --depth 50 || true
git checkout -f 'pr-931'
git rev-parse HEAD
git diff --stat 'origin/main...HEAD' || true
Cloning into '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/repo'...
From https://github.com/hw-native-sys/PTOAS
 * [new ref]           refs/pull/931/head -> pr-931
From https://github.com/hw-native-sys/PTOAS
 * branch              main       -> FETCH_HEAD
Switched to branch 'pr-931'
2a0058d1058ccecef73ce265698ee26ae13c8098
fatal: origin/main...HEAD: no merge base
===== END STAGE clone rc=0 @ 2026-07-11 23:50:31 =====

===== STAGE codex-review @ 2026-07-11 23:50:31 =====
set -euo pipefail
cd '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/repo'
'codex' exec -C '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/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/20260711_235025_pr931/review_schema.json' -o '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/codex_last_message.json' --color never - < '/tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/review_prompt.txt'
[monitor] stage timeout: 1800s
OpenAI Codex v0.115.0 (research preview)
--------
workdir: /tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/repo
model: gpt-5.4
provider: codereview
approval: never
sandbox: read-only
reasoning effort: xhigh
reasoning summaries: none
session id: 019f51df-8b0b-77b3-960e-5d3ad01857c4
--------
user
你现在在审查 GitHub PR。

仓库:hw-native-sys/PTOAS
PR:#931 feat(ptodsl): Migrate TileLib from TilelangDSL to PTODSL: Daemon and metadata
作者:Zhendong404
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 #931 存在问题,并返回 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: a198f6e7fb3c2efe-LAX, request id: 3e86f65d-8fbe-4764-bb6f-7058f4762d83)
Reconnecting... 2/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a198f6ea999bc8d2-LAX, request id: e672db44-cc99-4b86-a418-60005b920507)
Reconnecting... 3/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a198f6ee3aefcdfb-LAX, request id: 01bff9b2-6326-48bb-bc9d-a9a0fe50b9a8)
Reconnecting... 4/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a198f6f49b75f04d-LAS, request id: 87b65d21-eac3-4173-8b1c-3812c83624b9)
Reconnecting... 5/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a198f7008d1bb800-LAX, request id: e5360b3d-a33f-446f-bd46-4c27f1cabac0)
ERROR: unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a198f716f889090e-LAX, request id: bafc280e-82c9-4ac8-ab9e-05f0729cc5df
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260711_235025_pr931/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-07-11 23:50:40 =====

@Zhendong404

Copy link
Copy Markdown
Contributor Author

/run a3

@Zhendong404

Copy link
Copy Markdown
Contributor Author

/run a5

@reedhecre

Copy link
Copy Markdown

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

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

@reedhecre

Copy link
Copy Markdown

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

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

@reedhecre

Copy link
Copy Markdown

A5 板测失败

日志尾部

_sync_basic.py) OK   generated: test_mem_inject_sync_basic-pto.cpp
Sync(test_set_wait_unified_api.py) OK   generated: test_set_wait_unified_api-pto.cpp
Sync(test_tmov_col_major_16x1_align_a5.pto) FAIL ptoas failed: test_tmov_col_major_16x1_align_a5.pto
Sync(test_tmov_col_major_16x1_align_a5.py) OK   generated: test_tmov_col_major_16x1_align_a5-pto.cpp
Sync(test_tmov_row_major_1x16_control_a5.pto) FAIL ptoas failed: test_tmov_row_major_1x16_control_a5.pto
Sync(test_tmov_row_major_1x16_control_a5.py) OK   generated: test_tmov_row_major_1x16_control_a5-pto.cpp
Sync(tmatmulk_autosync_a5.py) OK   generated: tmatmulk_autosync_a5-pto.cpp
TileSetGetValue(tile_getval_mat_invalid.py) XFAIL ptobc encode failed as expected
TileSetGetValue(tileSetGetValue.py) OK   generated: tileSetGetValue-pto.cpp
TInsert(tinsert_fp.py) OK   generated: tinsert_fp-pto.cpp
TInsert(tinsert.py) OK   generated: tinsert-pto.cpp
Tpows(tpows.py) OK   generated: tpows-pto.cpp
Tpow(tpow.py) OK   generated: tpow-pto.cpp
TPrefetchAsync(tprefetch_async_binding.py) OK   generated: tprefetch_async_binding-pto.cpp
TPrefetch(tprefetch.py) OK   generated: tprefetch-pto.cpp
TquantMx(tquant_mx.pto) OK   generated: tquant_mx-pto.cpp
Trans(trans.py) OK   generated: trans-pto.cpp
Trap(trap.py) OK   generated: trap-pto.cpp
TTri(ttri.py) OK   generated: ttri-pto.cpp
VectorAddition(vadd_pto_ir.py) OK   generated: vadd_pto_ir-pto.cpp
VectorAddition(vadd_validshape_hyper.py) OK   generated: vadd_validshape_hyper-pto.cpp
VectorAddition(vectorAddition.py) OK   generated: vectorAddition-pto.cpp
Xors(xors.py) OK   generated: xors-pto.cpp
Xor(xor.py)  OK   generated: xor-pto.cpp
-----------------------------
OK=240  FAIL=4  SKIP=29
=============================
===== END STAGE sample-build-and-test rc=1 @ 2026-07-11 23:59:12 =====

@reedhecre

Copy link
Copy Markdown

A3 板测完成(有跳过)

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