Skip to content

[KMCompiler][TLE] Common IR triton35 - #974

Draft
zhongsanming wants to merge 85 commits into
flagos-ai:triton_v3.5.xfrom
KernelLLM:common-ir-poc-triton35
Draft

[KMCompiler][TLE] Common IR triton35#974
zhongsanming wants to merge 85 commits into
flagos-ai:triton_v3.5.xfrom
KernelLLM:common-ir-poc-triton35

Conversation

@zhongsanming

@zhongsanming zhongsanming commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

相关SIG flagos-ai/community#95

引入一种新的Common IR作为TTIR的补充,CommonIR的主要功能是对算子层暴露更低层次的抽象,让算子层能解锁更多优化的机会。这个PR在triton 3.5 分支上完成了昇腾设备的POC工作,打通了从tle.dsa到Common IR到linalg IR到npubin的全流程。

现有flaggems全量op的精度测试结果:飞书文档

如果飞书文档没有权限请先使用以下链接:
summary

环境配置:

  • CANN: 9.1.0 ,目前9.1.0以下的CANN版本无法通过编译
  • 硬件:昇腾910B/910C

kateyijian and others added 30 commits August 13, 2026 10:18
* fix(test): pass combine_batch

* fix(test): replace PP

* fix(test): pass BLOCK_M, BLOCK_N, DIM

* fix(test): add tl.constexpr

* fix(test): fix workspace type
* fix(test): remove vid and HALF_M

* feat(test): add fa dummy

* feat(test): comment code

* feat(test): add linalg_ir dump

* fix(third_party): comment add_triton_to_annotation
Co-authored-by: zsm <zsm@compiler-dev.com>
* fix CANN enum name and numpy import

* add solution for some issue

---------

Co-authored-by: zhongsanming <sanming.zhong@compiler-dev.com>
* feat(test): add matmul raw

* feat(test): add test and dump

* feat(test): use one loop

* feat(test): use prologue

* feat(test): remove unused variables

* fix(test): use mat_c_l0c

* feat(test): use sub_view

* fix(test): preload 2 buffer

* fix(test): fix gcd

* fix(test): add out-of-bounds check
* feat(test): add matmul_add_residual

* feat(test): add matmul_add_residual_cv

* fix(test): remove mat_c_l0c

* feat(test): add matmul_prefetch

* convert tile.subview to memref.subview (#16)

Co-authored-by: zhongsanming <zhongsanming@compiler-dev.com>

---------

Co-authored-by: zhongsanming <116532846+zhongsanming@users.noreply.github.com>
Co-authored-by: zhongsanming <zhongsanming@compiler-dev.com>
103yiran and others added 13 commits August 13, 2026 10:20
* test(test): add matmul subview

* test(test): add no sync fa

* test(test): add gpu pass fa

* test(test): add fa_serial

* test(test): add missing sync

* fix(test): recover sub function

* refactor(test): remove used variables

* fix(third_party): add tile::MemorySpace::Global

* fix(CMakeLists.txt): add no-dangling-assignment-gsl
* fix(test): fix L0C to UB error

* fix(test): fix L0C to UB error

* test(test): add fa 4func

* test(test): add fa serial

* test(test): add matmul_low_dim
* fix(test): fix cube use ub error

* refactor(test): use tl.load
* fix(test): fix cube use ub error

* refactor(test): use tl.load

* fix(test): remove l1 alloc and copy, fix sync error
Co-authored-by: zhongsanming <zhongsanming@compiler-dev.com>
* fix(test): fix cube use ub error

* refactor(test): use tl.load

* fix(test): fix fa compile error

* fix(test): fix rebase error
@CLAassistant

CLAassistant commented Aug 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added DOC Improvements or additions to documentation tle ascend CORE triton_v3.5.x labels Aug 13, 2026
@zhongsanming
zhongsanming marked this pull request as ready for review August 13, 2026 06:00
@zhongsanming zhongsanming changed the title Common ir poc triton35 [KMCompiler][TLE] Common IR triton35 Aug 13, 2026
@zhongsanming
zhongsanming marked this pull request as draft August 13, 2026 07:24
@zhongsanming
zhongsanming force-pushed the common-ir-poc-triton35 branch from 73e293d to e59ce83 Compare August 13, 2026 07:25
sunnycase
sunnycase previously approved these changes Aug 13, 2026

@sunnycase sunnycase 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.

LGTM


registry.insert<
mlir::triton::TritonDialect, mlir::cf::ControlFlowDialect,
mlir::triton::tile::TileIRDialect, mlir::hivm::HIVMDialect,

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.

  1. 使用宏进行隔离 (目前只影响ascend 后端)

@@ -0,0 +1,184 @@
# 2× L1 缓冲区在 Linalg 降级流水线中被意外消除

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.

文档需要删除

Comment thread python/src/ir.cc
>();
DLTIDialect, // flagtree tle raw
mlir::triton::tle::TleDialect, // flagtree tle raw
::mlir::index::IndexDialect, func::FuncDialect>();

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.

CI 所有厂商 triton 3.5.x: 燧原,昇腾



@triton.jit
def copy_buffer(x):

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.

dsa用例放哪里合理

return op->getResult(0);
})
// Add an annotation
.def("create_tanh",

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.

删除文件

if(FLAGTREE_BACKEND STREQUAL "ascend")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dsa/dialect/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/dsa/dialect/include)
include_directories(${CMAKE_SOURCE_DIR}/third_party/flir/include)

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.

删除一行

MLIRTargetLLVMIRImport
TleIR
TileIRIR
BiShengIRHIVMDialect

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.

删除这一行

Comment thread CMakeLists.txt
if(NOT MSVC)
if(FLAGTREE_BACKEND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-covered-switch-default")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-covered-switch-default -Wno-dangling-assignment-gsl")

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.

@macqueen09 删除这一行

Comment thread CMakeLists.txt
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-covered-switch-default -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-covered-switch-default -Wno-dangling-assignment-gsl -fvisibility=hidden")

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.

@103yiran 删除这一行

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.

@103yiran 加到flagtree CI用例

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

Labels

ascend CORE DOC Improvements or additions to documentation tle triton_v3.5.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants