Skip to content

Route TLE GPU through TileIR conversion - #75

Open
kateyijian wants to merge 2 commits into
triton_v3.6.xfrom
poc-gpu-tileir-conversion
Open

kateyijian wants to merge 2 commits into
triton_v3.6.xfrom
poc-gpu-tileir-conversion

Conversation

@kateyijian

@kateyijian kateyijian commented Aug 18, 2026 •

Copy link
Copy Markdown

本次更新内容

本次修改完善 Triton 3.6 下 TLE GPU 经由 CommonIR 转换到 TTGIR 的完整路径:

tle.gpu.* DSL
  -> tile.* / !tile.buf
  -> CommonIRToTTGIR conversion
  -> ttg.* / !ttg.memdesc
  -> NVIDIA backend

主要改动

  • 增加显式 C/C++ 编译宏 FLAGTREE_COMMON_IR;仅显式开启时构建 FLIR 和 CommonIR conversion,关闭时保留原始 TLE GPU 路径。
  • 删除旧的 _tileir_mode 和分散的 builder 能力判断,由 C++ 暴露统一开关,Python 只读取一次。
  • tle.gpu.alloc/copy/subview/local_ptr/to_tensor/store_tensor 在 CommonIR 模式下生成对应 TileIR。
  • 保持 TleOps.td 中 pipe 输入为 TTG_MemDescType,通过 FLIR 的 tile.get_memdesc 完成 !tile.buf -> !ttg.memdesc 桥接。
  • 将旧的 TLE 侧 conversion 移到 NVIDIA 的 CommonIRToTTGIR 层,并统一 pass、目录和 Python binding 命名。
  • 不修改社区已有 TMA/descriptor copy 语义;动态 offsets 继续使用原有社区路径。
  • 新增 triton-opt + FileCheck 测试,验证 TileIR 能完整转换为 TTGIR 且无目标 GPU TileIR op 残留。

验证结果

  • native_matmul_gpu.py:编译、CUBIN、精度 PASS。
  • native_flash_gpu.py:编译、CUBIN、精度 PASS。
  • TMA copy 回归测试:PASS。
  • CommonIR ON/OFF 构建开关检查:PASS。
  • 18 项算子复测:严格/门禁通过 11 项,部分通过 2 项,fallback 3 项,依赖阻塞 2 项,未发现稳定性能回归。

说明

Comment thread third_party/nvidia/backend/compiler.py Outdated
# TLE GPU always enters through TileIR when the dialect is available.
# Convert the target-independent buffers to TritonGPU descriptors
# before the standard TTIR-to-TTGIR conversion.
tle.passes.add_convert_gpu_tile_to_ttgir(pm)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

添加一个宏

# Use provided layout
layout_handle = layout.to_ir(_semantic.builder)

if _tileir_available(_semantic.builder):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

这个if控制原因?

if _tileir_mode():
if not hasattr(_semantic.builder, "create_tile_store_tensor"):
raise RuntimeError("TLE GPU TileIR mode requires a TileIR-enabled TLE builder")
if hasattr(_semantic.builder, "create_tile_store_tensor"):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

if 判断全部去除


def Tle_PipeWriterCommitOp : Tle_Op<"pipe.writer_commit"> {
let arguments = (ins
Variadic<TTG_MemDescType>:$fields,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

这个数据类型为什么需要改?

//
// Copyright (c) 2025 The FlagOS Contributors

#include "tle/dialect/include/Transforms/Passes.h"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

CommonIRToTTGIR

def Tle_PipeCreateOp : Tle_Op<"pipe.create"> {
let summary = "create a typed TLE GPU pipe";
let arguments = (ins
Variadic<TTG_MemDescType>:$fields,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

不要改这个文件


include "mlir/Pass/PassBase.td"

def TritonTleConvertGpuTileToTtgir

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@@ -1,5 +1,6 @@
# flagtree tle
add_triton_library(TritonTLETransforms
TleConvertGpuTileToTtgir.cpp

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

名字+宏命令限制

NVWSIR
)

if(TARGET TileIRIR)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

名字替换为CommonIR

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