Skip to content

Allow alloc_buffer outside SIMT scopes#925

Draft
and0d0 wants to merge 1 commit into
hw-native-sys:mainfrom
and0d0:486_alloc_buffer_simt_out
Draft

Allow alloc_buffer outside SIMT scopes#925
and0d0 wants to merge 1 commit into
hw-native-sys:mainfrom
and0d0:486_alloc_buffer_simt_out

Conversation

@and0d0

@and0d0 and0d0 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@and0d0 and0d0 marked this pull request as draft July 9, 2026 12:23

@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 removes the restriction that pto.alloc_buffer can only be used inside SIMT subkernels, allowing it to be used in top-level explicit kernels. Documentation and tests are updated to reflect this change. The reviewer pointed out that the error message and docstring for alloc_buffer still contain outdated references to SIMT-only allocations and should be updated for consistency.

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 ptodsl/ptodsl/_ops.py
@@ -2351,7 +2335,6 @@ def alloc_buffer(shape, dtype, **kwargs):
"pto.castptr/pto.addptr and pass the dynamic UB byte count at launch."

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

由于此 PR 允许在 SIMT 范围之外声明 alloc_buffer(即作为跨 SIMT 的 buffer),第 2334 行的错误提示信息 "It only allocates SIMT local buffers; ..." 已经不再准确。建议将其更新为更通用的描述,例如 "It only allocates local scratch buffers; ..."

同时,alloc_buffer 的 docstring(第 2323-2329 行)中也提到了 "Allocate SIMT lane-local scratch storage...""surrounding SIMT helper",建议一并更新,以保持文档与代码的一致性。

@reedhecre

reedhecre commented Jul 9, 2026

Copy link
Copy Markdown

Codex Review

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

  • PR: Allow alloc_buffer outside SIMT scopes #925 Allow alloc_buffer outside SIMT scopes
  • Author: and0d0
  • Base/Head: main / 486_alloc_buffer_simt_out
  • Head SHA: c69ef5cf4000
  • Trigger: PR 有新提交
  • Generated At: 2026-07-10T04:35:43Z
  • Previous Head SHA: 6830b3c8f2ff
  • Status: failed at codex-review (exit=1)

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_123527_pr925/repo'
git clone --branch 'main' --depth 50 'https://github.com/hw-native-sys/PTOAS.git' '/tmp/ptoas-pr-review-monitor/runs/20260710_123527_pr925/repo'
cd '/tmp/ptoas-pr-review-monitor/runs/20260710_123527_pr925/repo'
git fetch origin 'refs/pull/925/head:pr-925' --depth 50
git fetch origin 'main' --depth 50 || true
git checkout -f 'pr-925'
git rev-parse HEAD
git diff --stat 'origin/main...HEAD' || true
Cloning into '/tmp/ptoas-pr-review-monitor/runs/20260710_123527_pr925/repo'...
From https://github.com/hw-native-sys/PTOAS
 * [new ref]           refs/pull/925/head -> pr-925
From https://github.com/hw-native-sys/PTOAS
 * branch              main       -> FETCH_HEAD
Switched to branch 'pr-925'
c69ef5cf4000209d8c0e41d678ab5323a529efe2
 ptodsl/docs/user_guide/04-type-system-and-buffer.md |  2 +-
 ptodsl/ptodsl/_ops.py                               | 11 +++++------
 ptodsl/ptodsl/_surface_values.py                    |  2 ++
 ptodsl/tests/test_jit_compile.py                    |  7 ++-----
 4 files changed, 10 insertions(+), 12 deletions(-)
===== END STAGE clone rc=0 @ 2026-07-10 12:35:34 =====

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

仓库:hw-native-sys/PTOAS
PR:#925 Allow alloc_buffer outside SIMT scopes
作者:and0d0
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 #925 存在问题,并返回 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: a18cdcd179be9810-LAX, request id: c0932cff-c94e-400a-af5c-fa72b9b78353)
Reconnecting... 2/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18cdcd44e3ecb7a-LAX, request id: 5c3ee391-1e68-4659-ab7b-b1cfef15968a)
Reconnecting... 3/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18cdcd80b3c91e9-LAX, request id: 6c7ad105-74a8-4208-a1e4-03b0643d40e4)
Reconnecting... 4/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18cdcdeb8b834a9-LAS, request id: 1d4fe736-fdee-4c54-adc6-63e5bd654933)
Reconnecting... 5/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18cdcea4ee0cb86-LAX, request id: 0d284aa5-55a2-404c-8720-8baf452efaac)
ERROR: unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a18cdd012ec52378-LAX, request id: b79d17d3-e89b-4f3d-9c66-822d71683464
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260710_123527_pr925/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-07-10 12:35:43 =====

@and0d0 and0d0 force-pushed the 486_alloc_buffer_simt_out branch from e75015a to 6830b3c Compare July 10, 2026 03:40
@and0d0 and0d0 force-pushed the 486_alloc_buffer_simt_out branch from 6830b3c to c69ef5c Compare July 10, 2026 04:33
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