Skip to content

GPU CommonIR:适配冻结 FLIR main 并保持显式 TileIR 转换 - #88

Draft
macqueen09 wants to merge 4 commits into
triton_v3.6.xfrom
poc-gpu-tileir-conversion-main-sync
Draft

macqueen09 wants to merge 4 commits into
triton_v3.6.xfrom
poc-gpu-tileir-conversion-main-sync

Conversation

@macqueen09

@macqueen09 macqueen09 commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

本次更新

本 PR 在 triton_v3.6.x@3f863acd7 基础上更新 GPU CommonIR POC,并将 FLIR 依赖固定到 GitHub kateyijian/flir 的 main@a884fd3c608db2203f08ec5a281327f5dc0153b0。FLIR 仓库本身不再修改,也不需要配套 FLIR 分支。

  • 适配 FLIR main 中统一后的 CommonIR 目录、Dialect 与 CMake target 名称。
  • 保持显式流程:tle.gpu.* -> tile.alloc/copy/subview/to_tensor/store_tensor -> CommonIRToTTGIR -> ttg.local_alloc/local_load/local_store/memdesc_index。
  • tle.gpu.local_ptr 复用现有 tle.local_pointers,以 builtin.unrealized_conversion_cast 作为临时 !tile.buf -> !ttg.memdesc 桥接;该桥接在 CommonIRToTTGIR 中解析并清除,不残留到 TTGIR。
  • 没有在前端直接生成 ttg.local_alloc,也没有修改 FLIR/community 已有 tile.copy 等接口。
  • 宏关闭时仍走原始 TLE GPU 路径;宏开启仍由统一 C++ 开关控制。

依赖

  • FlagTree base:triton_v3.6.x@3f863acd700bda89514cf3dce6c57020d593d8f3
  • FLIR:main@a884fd3c608db2203f08ec5a281327f5dc0153b0(已在 FlagTree 下载配置中固定)
  • 本 PR 最新提交:59d3f12ef

验证结果

  • 完整编译通过,gpu-tileir-to-ttgir.mlir lit/FileCheck 通过。
  • tle_gpu_primitives.py 的 TileIR/TTGIR dump 通过。
  • native_matmul_gpu.py、native_flash_gpu.py 均精度 PASS。
  • 流程负向检查通过:TileIR 阶段不存在 ttg.local_alloc;TTGIR 阶段不存在残留 tile.alloc/copy/subview/to_tensor/store_tensor 或桥接 cast。
  • 18 项算子精度:12 项完整 PASS、4 项部分 PASS(其余参数由测试自身 skip)、2 项因缺少 vLLM FlashMLA API 全部 skip/阻塞。
  • 18 项性能:14 项具备主线/CommonIR 成对数据,ABBA 同卡交替测量后均未触发“慢 >5% 且 >0.5 us”回归线;2 个门禁仅 CommonIR 路径可运行,2 项依赖阻塞。
  • 两个首轮波动项追加 ABBA 复测后差异为 -0.60%、+2.63%;归一化路径后的最终 PTX 分别 76/76、4/4 完全一致。
  • 仓库 pre-commit --all-files 本地复跑全部通过。

Wheel

已按最终提交重新生成并在独立 ftree 环境强制安装验证:

  • flagtree-0.6.0+git59d3f12e-cp311-cp311-linux_x86_64.whl
  • SHA256:d0a42394e468775cc53b4304b9232cd2cc70d509087d51dc2bc32a3ea05bd324
  • Wheel 安装后 is_common_ir_enabled() == True,matmul/flash 精度及 TileIR/TTGIR 流程检查通过。


#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/IR/BuiltinOps.h"
#include "tle/dialect/include/IR/Dialect.h"

@LeBlanc9 LeBlanc9 Sep 7, 2026 •

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.

commonIR 为什么需要 depend on tle ir ?

Type ptrType = getLocalPointerType(valueType, memDescType.getElementType());
SmallVector<Value> indices =
createFullIndices(builder, loc, memDescType.getShape());
return builder.create<tle::LocalPointersOp>(loc, ptrType, memDesc, indices);

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.

这里又回到了 tle op?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants