Skip to content

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

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

[KMCompiler][TLE] Common IR triton35#974
zhongsanming wants to merge 87 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

精度测试环境:
FlagGems: flaggems主线分支

FlagTree:
triton_v3.5 分支提交: flagtree 3.5
commonir 提交: common ir特性分支

@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

Comment thread bin/RegisterTritonDialects.h Outdated
Comment thread docs/double-buffer-elimination.md Outdated
Comment thread python/src/ir.cc Outdated
Comment thread python/test/tle/test_bind_buffer.py Outdated
Comment thread third_party/ascend/triton_ascend.cc Outdated
Comment thread third_party/tle/CMakeLists.txt Outdated
Comment thread third_party/tle/CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread test/CommonIR/Ascend/success_case/matmul_double_buffer.py
@github-actions github-actions Bot added the CI/CD label Aug 18, 2026
@zhongsanming
zhongsanming force-pushed the common-ir-poc-triton35 branch from 0f72332 to fb9eb49 Compare August 18, 2026 02:35
@zhongsanming
zhongsanming marked this pull request as ready for review August 18, 2026 02:42
@zhongsanming
zhongsanming force-pushed the common-ir-poc-triton35 branch from 1ce4010 to 1efb4e0 Compare August 18, 2026 09:42
zhongsanming and others added 29 commits August 19, 2026 17:40
Co-authored-by: zhongsanming <sanming.zhong@compiler-dev.com>
* feat(test): add matmul_dsa_slice (#26)

* feat(test): add matmul_dsa_slice

* feat(test): use double buffer

* docs(docs): add md file

* [TileIRToHIVM] Lower scattered-pointer tile.copy via tt.load/tt.store (#35)

A tile.copy whose source or destination is a scattered pointer
(tensor<Nx!tt.ptr>) cannot be turned into a structured DMA in this pass,
and previously produced an unresolved materialization cast that failed
later in the pipeline.

Rewrite such copies back into triton tt.load / tt.store so the access
rejoins flir normal lowering path, where PtrAnalysis structures it
downstream (reducing to a contiguous DMA when the indices are
contiguous). Non-scattered copies (on-chip buffers, block pointers) keep
their existing hivm.copy / memref.copy lowering unchanged.

Co-authored-by: Your Name <you@example.com>

---------

Co-authored-by: 103yiran <1039105206@qq.com>
Co-authored-by: Shane <93116528+LeBlanc9@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: zhongsanming <sanming.zhong@compiler-dev.com>
This reverts commit 51358e1.

Co-authored-by: zhongsanming <sanming.zhong@compiler-dev.com>
对double buffer处理默认为编译器处理

算子处理会出现a loop-carried value of the outer task loop

同时EnableStrideAlign处理时会生成unrealized_conversion_cast

解决方案:算子不生成double buffer逻辑

将double buffer逻辑交给编译器处理

GraphSyncBlock问题:
如果算子控制workspace和CV 同步
需要使用_USE_CUSTOM_COMPILE_OPT,将bisheng编译器相关编译选项关闭
* 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
* update commit id of flir

* remove docs

* remove script folder

* rename TileIR to CommonIR

* revert unrelevant changes

* revert changes unrelated to ascend

* revert changes to backend testing tools

* revert unrelated create_tanh ffi

* revert compiler flags

* remove HIVM dependency of tle

* remove redundant header include directory

* guard commonir c++ changes with __TLE_DSA__

* add commonir python comments and guard

* change the license header for newly added source

* run commonir success tests in ascend ci

* move common ir unit test to it's own folder

* add more python comment

* remove envvar to replace ir

* move common ir changes to tle/dsa

* add more python comments

* add comment to explain flir commit id changes

---------

Co-authored-by: zhongsanming <zhongsanming@compiler-dev.com>
@zhongsanming
zhongsanming force-pushed the common-ir-poc-triton35 branch from 1efb4e0 to 105ef10 Compare August 19, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ascend CI/CD 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