Skip to content

Add & test the remaining arithmetic operations for VecValue in ptodsl#919

Open
liggest wants to merge 5 commits into
hw-native-sys:mainfrom
liggest:vec_value_arith
Open

Add & test the remaining arithmetic operations for VecValue in ptodsl#919
liggest wants to merge 5 commits into
hw-native-sys:mainfrom
liggest:vec_value_arith

Conversation

@liggest

@liggest liggest commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ptodsl 中的 VecValue 类型只定义了乘法操作,这个 PR 简单补全了剩余的加、减操作(SIMT 中的向量除法不被 bisheng 支持),使得 ptodsl 在编译带有这些向量运算操作的 kernel 时不会报错,并添加了相应的测试

@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 implements basic vector arithmetic operations (addition, subtraction, and division) for surface values in the DSL, including their reflected counterparts. It also adds a JIT compilation test to verify that these operations lower correctly to MLIR vector instructions. There are no review comments, and I have no feedback to provide.

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.

@reedhecre

reedhecre commented Jul 9, 2026

Copy link
Copy Markdown

Codex Review

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

Summary

Review failed at stage codex-review: exit=1

Findings

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

Log Tail

set -euo pipefail
rm -rf '/tmp/ptoas-pr-review-monitor/runs/20260710_143529_pr919/repo'
git clone --branch 'main' --depth 50 'https://github.com/hw-native-sys/PTOAS.git' '/tmp/ptoas-pr-review-monitor/runs/20260710_143529_pr919/repo'
cd '/tmp/ptoas-pr-review-monitor/runs/20260710_143529_pr919/repo'
git fetch origin 'refs/pull/919/head:pr-919' --depth 50
git fetch origin 'main' --depth 50 || true
git checkout -f 'pr-919'
git rev-parse HEAD
git diff --stat 'origin/main...HEAD' || true
Cloning into '/tmp/ptoas-pr-review-monitor/runs/20260710_143529_pr919/repo'...
From https://github.com/hw-native-sys/PTOAS
 * [new ref]           refs/pull/919/head -> pr-919
From https://github.com/hw-native-sys/PTOAS
 * branch              main       -> FETCH_HEAD
Switched to branch 'pr-919'
a7972babe9c6beb948b888ef118e1ab54c2f0879
 ptodsl/ptodsl/_surface_values.py           |  12 ++++
 ptodsl/tests/test_jit_compile.py           |  43 +++++++++++++
 ptodsl/tests/test_ptoas_frontend_verify.py |  51 +++++++++++++++
 test/dsl-st/vec_value_arith_simt.py        | 100 +++++++++++++++++++++++++++++
 4 files changed, 206 insertions(+)
===== END STAGE clone rc=0 @ 2026-07-10 14:35:37 =====

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

仓库:hw-native-sys/PTOAS
PR:#919 Add & test the remaining arithmetic operations for VecValue in ptodsl
作者:liggest
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 #919 存在问题,并返回 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: a18d8cabfff4f3df-LAS, request id: d7667332-e250-4385-8302-1b7ce7757acc)
Reconnecting... 2/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18d8caf4a5ab6a2-LAX, request id: 840400e9-7dfa-4e63-8e8a-9b183ccd91c8)
Reconnecting... 3/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18d8cb39d026e2c-LAX, request id: a2d94400-2c55-4b2d-9af5-79a03dfc614c)
Reconnecting... 4/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18d8cba5f37c4e7-LAX, request id: cc83ff2b-d136-4a5a-a9cb-c6d61fd3f6d8)
Reconnecting... 5/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18d8cc5dca1f8b7-LAX, request id: 7e2b11e6-6cd1-41ce-91cf-4240ef541354)
ERROR: unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18d8cdaa8af55c7-LAX, request id: bebaf9ac-ad40-43d9-8701-507ef16ca092
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260710_143529_pr919/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-07-10 14:35:45 =====

@liggest liggest force-pushed the vec_value_arith branch from 3b5dd37 to eea5c8f Compare July 9, 2026 07:16
Comment thread ptodsl/ptodsl/_surface_values.py Outdated
def __rmul__(self, other):
return _emit_vec_binary_op("mul", other, self)

def __truediv__(self, other):

@Zhendong404 Zhendong404 Jul 10, 2026

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.

SIMT中不支持的运算,不要在前端暴露

@liggest liggest Jul 10, 2026

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.

已修改

Comment thread test/dsl-st/vec_value_arith.py Outdated
mode="explicit",
insert_sync=False,
)
def vec_value_arith_kernel(

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.

标量核不是pto.Vec类型的目标场景,请使用SIMT kernel构造测例

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.

已修改

@liggest liggest requested a review from Zhendong404 July 10, 2026 06:38
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.

3 participants