Skip to content

refactor: split PTO operation family declarations - #1233

Open
mouliangyu wants to merge 4 commits into
hw-native-sys:mainfrom
mouliangyu:codex/ir-component-migration-design
Open

refactor: split PTO operation family declarations#1233
mouliangyu wants to merge 4 commits into
hw-native-sys:mainfrom
mouliangyu:codex/ir-component-migration-design

Conversation

@mouliangyu

@mouliangyu mouliangyu commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

背景

当前 PTO 的 operation ODS 入口把 PTO Base、PTO Tile、VMI、VPTO 和 UB operation 全部串在一个 PTOOps.td 中,generated public declarations 也只能作为一个整体使用。这样无法形成稳定的 semantic family ownership,也让后续 generated definition、registration 和 handwritten semantics 的迁移缺少可依赖的 public 边界。

本 PR 的范围

本 PR 实现设计中的第一个迁移步骤:为每个 semantic family 建立真实的 ODS owner 和 generated public declaration。它不修改 IR 语法或 operation 语义,也不提前拆 generated definitions、registration 或 PTO.cpp 中的手写实现。

修改内容

  • 保留并完善顶层 family:PTOBasePTO TileVMIVPTOVPTO UB
  • 将 PTO Tile 按语义拆成独立 ODS/header:
    • Memory
    • Cube
    • Pipeline
    • Vector Data
    • Vector Elementwise
    • Vector Reduction
  • 将 VPTO 按硬件语义拆成独立 ODS/header:
    • Control
    • SIMT
    • MTE
    • Cube
    • Vector
    • UB
  • 新增 VPTOOpCommon.td,集中放置跨 VPTO family 共享的 type constraints 和 operation base classes。
  • 每个 family 独立生成自己的 .h.inc,并提供独立 public header。
  • PTOTile.hVPTO.hPTO.h 保留为兼容 aggregate;aggregate 只转发 family headers,不重复展开同一份 generated declarations。
  • PTOOps.tdPTOTileOps.tdVPTOOps.td 继续作为 aggregate TableGen 入口。
  • 更新 pto-ir-family-ownership-design.md,明确第一步覆盖所有 semantic family;generated definitions/registration 和 handwritten semantics 仍按后续步骤迁移。

兼容性与完整性

  • operation 名称、ODS record 内容、generated aggregate 输出和 IR 语法保持不变。
  • 基于本 PR 父提交做 ODS inventory 对比:
    • PTO Tile:166 -> 166,无遗漏、无新增、无重复;
    • VPTO:279 -> 279,无遗漏、无新增、无重复;
    • PTO Base 与 PTO Tile 的 224 个 operation record 已与当前主线逐项对齐;VPTO operation record 保持主线集合,额外的 26 个 UB records 由既有 VPTOUbOps.td aggregate 继续提供。
  • 保留 PTOOps.tdPTOOps.h.incPTOOps.cpp.inc 作为兼容入口和历史实现过渡层。

验证

  • git diff --check
  • cmake --build build --target PTOOpsIncGen -j 8
  • cmake --build build --target PTOIR -j 1
  • 所有新增 family headers、顶层 aggregate headers 以及 PTO.h 独立 include 语法检查

@mouliangyu
mouliangyu force-pushed the codex/ir-component-migration-design branch from 11f784b to 37bb50f Compare August 12, 2026 08:30
@mouliangyu mouliangyu changed the title docs: define PTO IR family ownership refactor: establish PTO IR common ownership boundary Aug 12, 2026
@mouliangyu
mouliangyu force-pushed the codex/ir-component-migration-design branch from 37bb50f to e7950c9 Compare August 12, 2026 09:45
@mouliangyu mouliangyu changed the title refactor: establish PTO IR common ownership boundary refactor: split PTO operation family declarations Aug 12, 2026
@mouliangyu
mouliangyu force-pushed the codex/ir-component-migration-design branch from e7950c9 to 5b44c8c Compare August 12, 2026 15:33
@mouliangyu
mouliangyu marked this pull request as ready for review August 13, 2026 03:09
@mouliangyu
mouliangyu force-pushed the codex/ir-component-migration-design branch 2 times, most recently from a5fc3cb to d7bbda6 Compare August 13, 2026 07:55
@mouliangyu
mouliangyu force-pushed the codex/ir-component-migration-design branch from d7bbda6 to 6006846 Compare August 14, 2026 01:21
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.

1 participant