Skip to content

feat(vpto): prepare PTODSL pipe expansion - #986

Draft
jimmychou0 wants to merge 4 commits into
hw-native-sys:mainfrom
jimmychou0:zjm/issue-966-vpto-pipe-tilelib
Draft

feat(vpto): prepare PTODSL pipe expansion#986
jimmychou0 wants to merge 4 commits into
hw-native-sys:mainfrom
jimmychou0:zjm/issue-966-vpto-pipe-tilelib

Conversation

@jimmychou0

@jimmychou0 jimmychou0 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Prepare the A5 VPTO compiler contract for PTODSL unified-pipe expansion: PipeState materialization, terminal tdrain, resolved pipe metadata, ExpandTileOp specialization, and VPTO LLVM lowering.
  • Preserve the existing PTODSL Pipe API and each transaction's split value; derive terminal-drain split from resolved pipe-level nosplit.
  • Document the compiler/TileLib boundary in English and Chinese. ptodsl/tilelib/**, TileLib templates, and TileLib-ST/runtime validation are intentionally excluded and owned by the TileLib follow-up.

Fixes #966

Validation

  • ninja -C build-local-vpto ptoas PTOPythonModules
  • ptodsl/tests/test_vector_cube_ops.py -v (38 passed)
  • A5 VPTO PTODSL TileLib daemon smoke: expand_tile_op_tilelang_tadds.pto
  • git diff --check

@jimmychou0
jimmychou0 force-pushed the zjm/issue-966-vpto-pipe-tilelib branch from f77ab73 to 3b3b6c4 Compare July 24, 2026 03:01
@jimmychou0 jimmychou0 changed the title feat(vpto): expand unified pipe ops through PTODSL TileLib feat(vpto): prepare PTODSL pipe expansion Jul 24, 2026
@jimmychou0
jimmychou0 force-pushed the zjm/issue-966-vpto-pipe-tilelib branch from 3b3b6c4 to fc00205 Compare July 24, 2026 03:46
@jimmychou0
jimmychou0 force-pushed the zjm/issue-966-vpto-pipe-tilelib branch from fc00205 to 0b8266d Compare July 24, 2026 06:51
Comment thread lib/PTO/IR/PTO.cpp
case PIPE::PIPE_MTE1:
case PIPE::PIPE_MTE2:
case PIPE::PIPE_MTE3:
case PIPE::PIPE_V:

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.

DSL侧允许set_intra_flag/wait_intra_flag设置PIPE_S,和这里不统一,看一下应该改哪里

@jimmychou0 jimmychou0 Jul 27, 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.

已修复 DSL 与 A5 verifier 的 endpoint 不一致:SyncSetOpSyncWaitOp 现均接受 PIPE_S,与 PTODSL set_intra_flag / wait_intra_flag 的表层契约一致。

编译器侧路径仅由以下开关启用:

```text
--enable-pipe-tilelib-expand

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.

这个特性不需要加开关吧,应该是一个基础能力

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.

已删除flag, a5 的vpto 后端自动开启相关能力。

`pto.tdrain` 是只由 PipeState 路径插入的内部 operation:

```text
pto.tdrain(%pipe, %state : !pto.pipe, !pto.struct<i32, i32>) { split = <0|1> }

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.

这个新增OP的语义、命名可能需要再讨论下。建议组织个会讲一次吧

global pipe entry 可以直接使用 `pto.declare_global` 的结果,也可以使用从该声明
经过一个或多个 `pto.tassign` 得到的结果。传给 pipe op 的仍是重绑定后的结果值。

## 9. TileLib 交接

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.

似乎缺少了DSL侧为Pipe提供的操作抽象API定义,即lib开发者在他写的template中可以对pipe对象进行哪些操作?

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.

已补充第 4.3 节:定义了 PTODSL Pipe 的构造器、初始化、alloc/push/pop/free、属性及方向/split 约束。同时明确 TileLib template 不接收 Python Pipe 对象;它只通过 PipeSpec、资源、PipeState、entry 和 subblock ABI 实现各 transaction 的运行时语义。

Comment thread tools/ptoas/ptoas.cpp
static std::unique_ptr<Pass> createSerialFrontendPipeLoweringPass() {
return std::make_unique<SerialFrontendPipeLoweringPass>();
static std::unique_ptr<Pass> createRecursivePipeStateMaterializationPass() {
return std::make_unique<RecursivePipeStateMaterializationPass>();

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.

Materialize pipe state的位置要考虑下,放在哪里对现有pass的影响最小

@jimmychou0 jimmychou0 Jul 27, 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.

已将 MaterializePipeState 后移到 PTOResolveReservedBuffers 后、pipe-only InsertTemplateAttributes 前。这样 Layout、Fusion、PlanMemory 和 reserved-buffer 相关既有 pass 仍消费原有 pipe IR;PipeState 只在 metadata/expansion 需要前生成,且仅插入到 A5 VPTO 的 pipe transaction 路径。

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.

[Feature] Support tpush/tpop lowering in the vpto backend

2 participants