Skip to content

Package PTODSL into PTOAS wheel and unify install flows#900

Merged
zhangstevenunity merged 5 commits into
hw-native-sys:mainfrom
Zhendong404:pack-ptodsl-in-wheel
Jul 6, 2026
Merged

Package PTODSL into PTOAS wheel and unify install flows#900
zhangstevenunity merged 5 commits into
hw-native-sys:mainfrom
Zhendong404:pack-ptodsl-in-wheel

Conversation

@Zhendong404

Copy link
Copy Markdown
Contributor

Summary

This PR packages PTODSL together with the PTOAS wheel and unifies the install and editable development flows so users no longer need to manually locate a separate PTODSL checkout.

Changes included:

  • install PTODSL into the root PTOAS install tree
  • include the PTODSL payload when building and collecting PTOAS wheels
  • switch PTODSL editable development to the root PTOAS editable flow
  • remove path bootstrap fallbacks that searched for PTODSL manually in examples and tests
  • update Chinese and English docs for the unified install flow

Details

The wheel packaging flow now treats PTODSL as part of the PTOAS distribution instead of an external package that users must discover and wire up themselves.

To support local development, the editable flow is also consolidated at the repository root, so PTODSL developers can continue iterating from the source tree without maintaining a separate package install path.

The runtime and test/example codepaths are updated accordingly to stop injecting manual PTODSL path bootstrap logic.

Testing

  • Not run in this PR flow

@reedhecre

reedhecre commented Jul 3, 2026

Copy link
Copy Markdown

Codex Review

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

  • PR: Package PTODSL into PTOAS wheel and unify install flows #900 Package PTODSL into PTOAS wheel and unify install flows
  • Author: Zhendong404
  • Base/Head: main / pack-ptodsl-in-wheel
  • Head SHA: 33409e4bb862
  • Trigger: 检测到新的 open PR
  • Generated At: 2026-07-03T09:40:46Z
  • Status: failed at codex-review (exit=1)

Summary

Review failed at stage codex-review: exit=1

Findings

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

Log Tail

 ptodsl/examples/tilelang_codegen.py                | 13 -----
 ptodsl/examples/topk_launch.py                     | 13 -----
 ptodsl/pyproject.toml                              | 13 -----
 ptodsl/tests/test_ast_rewrite_example_ir.py        |  3 --
 ptodsl/tests/test_docs_as_test.py                  |  2 -
 ptodsl/tests/test_flash_attention_demo_compile.py  |  3 --
 ptodsl/tests/test_jit_compile.py                   |  2 -
 ptodsl/tests/test_jit_diagnostics.py               |  4 --
 ptodsl/tests/test_ptoas_frontend_verify.py         |  2 -
 ptodsl/tests/test_subkernel_diagnostics.py         |  6 ---
 ptodsl/tests/test_vector_cube_ops.py               |  5 --
 test/dsl-st/README.md                              | 30 +++++++++++
 test/dsl-st/__main__.py                            |  6 ---
 test/dsl-st/common.py                              | 14 -----
 test/dsl-st/cube_matrix_pipeline.py                |  6 ---
 test/dsl-st/gemv_mx_pipeline.py                    |  6 ---
 test/dsl-st/predicate_pack.py                      |  6 ---
 test/dsl-st/simt_gm_memory_core.py                 |  6 ---
 test/dsl-st/vmulscvt.py                            |  6 ---
 test/samples/TPushTPop/ptodsl/local_c2v/kernel.py  | 12 -----
 47 files changed, 344 insertions(+), 365 deletions(-)
===== END STAGE clone rc=0 @ 2026-07-03 17:40:37 =====

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

仓库:hw-native-sys/PTOAS
PR:#900 Package PTODSL into PTOAS wheel and unify install flows
作者: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 #900 存在问题,并返回 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: a154ee098ff35e6f-LAX, request id: e1032012-0910-403e-8eec-e7b3cb8bcc7d)
Reconnecting... 2/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a154ee0cff862ede-LAX, request id: f23d212e-8808-4697-802a-2ba32248c210)
Reconnecting... 3/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a154ee11aa8309f3-LAS, request id: 406d3103-ab6c-4a55-b5cb-73c3e3714cf4)
Reconnecting... 4/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a154ee191bd6c213-LAX, request id: 72db32be-22c3-4662-991c-fb718c3f1843)
Reconnecting... 5/5 (unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a154ee24af9309cf-LAX, request id: cedd8db4-486e-4405-94c1-44c7b358ac63)
ERROR: unexpected status 403 Forbidden: {"code":"INSUFFICIENT_BALANCE","message":"Insufficient account balance"}, url: https://codex.0u0o.com/responses, cf-ray: a154ee3ae90ada94-LAS, request id: 91a9639b-2427-4498-ac4f-057af897b7da
Warning: no last agent message; wrote empty content to /tmp/ptoas-pr-review-monitor/runs/20260703_174029_pr900/codex_last_message.json
===== END STAGE codex-review rc=1 @ 2026-07-03 17:40:46 =====

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@zhangstevenunity zhangstevenunity left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the PTODSL packaging / install-flow consolidation. No blockers - the design is coherent and well-guarded: fail-fast _assert_installed_ptodsl_payload in the build backend, has_ptodsl_init + in-zip re-check in create_wheel.sh, and the compiler-only-tarball guards added to both collect_ptoas_dist*.sh.

Coverage of the bootstrap removal looks correct. On the ci_sim path, test/dsl-st no longer self-locates ptodsl, but scripts/sim_dsl.sh sources scripts/ptoas_env.sh, which puts ${PTO_INSTALL_DIR} on PYTHONPATH, and the new ptodsl/CMakeLists.txt install rule stages ${PTO_INSTALL_DIR}/ptodsl/__init__.py - so import ptodsl resolves. The executable editable .pth also gets the ordering right: mlir_core first (avoiding the MLIR-shadowing pitfall ptoas_env.sh:111-113 explicitly warns about) and the repo ptodsl sources ahead of the install-tree copy. No stale references to the deleted ptodsl/pyproject.toml remain in CI/scripts.

Two inline notes below (both non-blocking), plus one trivial nit: ptodsl/tests/test_jit_compile.py now has an unused import sys (its only use was the removed sys.path.insert) - harmless at runtime but ruff/flake8 F401 would flag it.

pto.tile.store(tile, dst)


mlir_text = wheel_compile_probe.compile().mlir_text()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This smoke test used to be two trivial imports; it now runs a full @pto.jit(target="a5").compile(). CompiledKernelHandle.build() -> build_module() calls module.operation.verify() (ptodsl/ptodsl/_tracing/runtime.py:91), and pto.tload has a verifier whose documented constraint is "product of partition-view sizes must match product of tile valid dims" (include/PTO/IR/PTOOps.td:648). This probe loads a dynamic [rows, cols] partition into a static [1, 128] tile, so it relies on the verifier skipping the dynamic case (it most likely does - verifiers only reject provable mismatches).

The concern is coverage: this probe now gates three release jobs - the docker builder stage, the docker runtime stage, and the mac wheel test - that previously only ran import mlir.ir / from mlir.dialects import pto. Given the PR notes "Testing: Not run in this PR flow," please run it once before merge (e.g. the docker builder-stage test_wheel_imports.sh, and one scripts/sim_dsl.sh test/dsl-st). A verifier rejection or a target/arch dependency here would fail all three image/wheel builds. (Risk is bounded: I confirmed the probe is fully in-process - no ptoas binary, numpy, or torch needed - and the op names / surface APIs it asserts on are correct.)

Comment thread ptodsl/CMakeLists.txt
set(PTODSL_BUILD_PACKAGE_DIR
"${PTODSL_BUILD_ROOT}/ptodsl")

add_custom_target(PTODSLPackage ALL

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PTODSLPackage is an ALL target with no OUTPUT/DEPENDS/BYPRODUCTS, so the remove_directory + copy_directory pair re-copies the entire package on every ninja invocation, including no-op incremental builds. Consider an add_custom_command(OUTPUT <stamp> DEPENDS <sources>) + wrapper target, or file(COPY ...) at configure time, so staging only reruns when the sources actually change. Non-blocking.

@zhangstevenunity zhangstevenunity merged commit 22c4f2c into hw-native-sys:main Jul 6, 2026
13 of 14 checks passed
@reedhecre

Copy link
Copy Markdown

A3 板测完成(有跳过)

  • 触发方式:merged
  • 源码提交:22c4f2c65ca1
  • 结果汇总:OK 220 / FAIL 0 / SKIP 2
  • 日志:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260706_092805_merged_pr900.log
  • LLVM cache:/home/zhongxuan/ptoas-board-monitor/cache/llvm-project-vpto-llvm21/build-shared
  • 结果 TSV:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260706_092805_merged_pr900.tsv

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