triton-ascend:基于昇腾平台的Triton编译框架项目

triton-ascend

分支16Tags0
文件最后提交记录最后更新时间
fix(doc): fix doc issue Co-authored-by: kpxing<xingkaipeng@huawei.com> # message auto-generated for no-merge-commit merge: !697 merge master into master fix(doc): fix doc issue Created-by: kpxing Commit-by: kpxing Merged-by: ascend-robot Description: ### 相关的Issue [#248](https://gitcode.com/Ascend/triton-ascend/issues/248) [#247](https://gitcode.com/Ascend/triton-ascend/issues/247) [#244](https://gitcode.com/Ascend/triton-ascend/issues/244) ### 原因(目的、解决的问题等) 不涉及 ### 描述(做了什么,变更了什么) 修复doc相关issue ### 测试用例(新增、改动、可能影响的功能) 不涉及 See merge request: Ascend/triton-ascend!6976 个月前
feat: add html documentation support for triton ascend **Changes:** - Add HTML documentation support for triton ascend - Refactor and format documentation - Add automatic rendering via GitHub Action **Next steps**: - API descriptions should be written into the source code and updated as the code is updated, so all triton APIs that differ from upstream triton need to be updated. 11 个月前
fix: the bug of expanddims Co-authored-by: zhaojingkai<zhaojingkai3@h-partners.com> # message auto-generated for no-merge-commit merge: !1030 merge fix_bug into master fix: the bug of expanddims Created-by: zhaojingkai Commit-by: zhaojingkai Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!10304 个月前
fix(sec): remove triton user in docker Co-authored-by: huafengchun<huafengchun@huawei.com> # message auto-generated for no-merge-commit merge: !744 merge master into master fix(sec): remove triton user in docker Created-by: huafengchun Commit-by: huafengchun Merged-by: ascend-robot Description: ## 描述 1. 解决安全扫描问题,避免在Dockerfile中添加无密码的普通用户 2. 添加CANN依赖的LD_LIBRARY_PATH环境变量 ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!7446 个月前
feat: Add support for reduction axis parsing and dual/persistent reduction parameters - Parse the reduction axis and mark the original axis in keys with 'r'. - Add support for parsing dual_reduction and persistent_reduction parameters. - Fix an issue with pointer parameter parsing. - Update autotune documentation to reflect the changes. 4 个月前
feat(910_95): Add support for Ascend910_95 series Co-authored-by: zhang-chunli01<zhangchunli19@huawei.com> # message auto-generated for no-merge-commit merge: !687 merge 1104-sync-A5 into master feat(910_95): Add support for Ascend910_95 series Created-by: zhang-chunli01 Commit-by: zhang-chunli01 Merged-by: ascend-robot Description: ### 相关的Issue ### 原因(目的、解决的问题等) ### 描述(做了什么,变更了什么) ### 测试用例(新增、改动、可能影响的功能) See merge request: Ascend/triton-ascend!6876 个月前
feat(ascend extension): introduce ascend language extension and add al.scope Co-authored-by: Hocky Yudhiono<hocky.yudhiono@huawei.com> Co-authored-by: chenxiangting<chenxiangting@huawei.com> # message auto-generated for no-merge-commit merge: !977 merge feat-triton-extension-al into master feat(ascend extension): introduce ascend language extension and add al.scope Created-by: cxtjjcz Commit-by: chenxiangting;Hocky Yudhiono Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!9775 个月前
feat(ascend extension): introduce ascend language extension and add al.scope Co-authored-by: Hocky Yudhiono<hocky.yudhiono@huawei.com> Co-authored-by: chenxiangting<chenxiangting@huawei.com> # message auto-generated for no-merge-commit merge: !977 merge feat-triton-extension-al into master feat(ascend extension): introduce ascend language extension and add al.scope Created-by: cxtjjcz Commit-by: chenxiangting;Hocky Yudhiono Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!9775 个月前
feat: Add support for reduction axis parsing and dual/persistent reduction parameters - Parse the reduction axis and mark the original axis in keys with 'r'. - Add support for parsing dual_reduction and persistent_reduction parameters. - Fix an issue with pointer parameter parsing. - Update autotune documentation to reflect the changes. 4 个月前
style: update .clang-format to adapt to Huawei standard 11 个月前
feat(ascend extension): introduce ascend language extension and add al.scope Co-authored-by: Hocky Yudhiono<hocky.yudhiono@huawei.com> Co-authored-by: chenxiangting<chenxiangting@huawei.com> # message auto-generated for no-merge-commit merge: !977 merge feat-triton-extension-al into master feat(ascend extension): introduce ascend language extension and add al.scope Created-by: cxtjjcz Commit-by: chenxiangting;Hocky Yudhiono Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!9775 个月前
fix(ci): set depth = 1 for submodule Co-authored-by: candyhong<1102229410@qq.com> # message auto-generated for no-merge-commit merge: !588 merge fix-clone into master fix(ci): set depth = 1 for submodule Created-by: candyhong Commit-by: candyhong Merged-by: ascend-robot Description: ### 相关的Issue 无 ### 原因(目的、解决的问题等) 在当前的 CI 流程中,拉取 Triton-Ascend 仓库时,会递归更新子模块(包括 LLVM),这导致拉取过程过于缓慢。而在编译 Ascend NPU IR 时,LLVM 并不是必须的,因此可以优化此流程。 ### 描述(做了什么,变更了什么) * 删除了 --recursive 选项,避免递归拉取子模块。 * 同步设置 --depth 1,仅拉取子模块的第一层,而不递归拉取子模块的子模块,从而减少 CI 拉取时间【需在 CI 工程修改,不在仓库代码体现】。 * 删除已废弃的脚本文件: * 删除 scripts/build.sh 和 scripts/prepare_build.sh:这两个脚本为旧的 Gitee 构建流程脚本,现已不再使用。 * 删除 ascend/examples/generalization_cases/full_run.sh:目前不再使用此脚本进行测试。 ### 测试信息(新增、改动、可能影响的功能) 修改前:执行命令 git submodule sync && git submodule update --init --recursive,会递归拉取子模块及其子模块(例如 LLVM),导致拉取时间较长。 ![image.png](https://raw.gitcode.com/user-images/assets/7623225/a5f217a8-0799-4f03-9f0b-751538907a29/image.png 'image.png') 修改后:执行命令 git submodule sync && git submodule update --init --depth 1,只会拉取第一层子模块,而不会递归拉取子模块的子模块(例如 LLVM),如图所示: ![image.png](https://raw.gitcode.com/user-images/assets/7623225/85185ab2-f45b-4477-aca6-589dbe608f54/image.png 'image.png') See merge request: Ascend/triton-ascend!5887 个月前
feat(ascend extension): introduce ascend language extension and add al.scope Co-authored-by: Hocky Yudhiono<hocky.yudhiono@huawei.com> Co-authored-by: chenxiangting<chenxiangting@huawei.com> # message auto-generated for no-merge-commit merge: !977 merge feat-triton-extension-al into master feat(ascend extension): introduce ascend language extension and add al.scope Created-by: cxtjjcz Commit-by: chenxiangting;Hocky Yudhiono Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!9775 个月前
add CONTRIBUTING.zh.md for developers Co-authored-by: jeshd<chengmaofan@huawei.com> # message auto-generated for no-merge-commit merge: !852 merge add_contributing.zh.md into master add CONTRIBUTING.zh.md for developers Created-by: jeshd Commit-by: jeshd Merged-by: ascend-robot Description: ## 描述 添加triton-ascend开源贡献指南 ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!8525 个月前
fix(copyright): add copyright headers and LICENSE to all files while retaining the copyright of the Triton community. Co-authored-by: wangzhanpeng5<wangzhanpeng5@huawei.com> 7 个月前
feat(ci): don't upload pypi in master Co-authored-by: zhaijiahao<982539404@qq.com> # message auto-generated for no-merge-commit merge: !887 merge mst into master feat(ci): don't upload pypi in master Created-by: leopold0801 Commit-by: zhaijiahao Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!8875 个月前
update owners Co-authored-by: huchengbei<huqiao9@huawei.com> 7 个月前
Initial commit 1 年前
add CONTRIBUTING.zh.md for developers Co-authored-by: jeshd<chengmaofan@huawei.com> # message auto-generated for no-merge-commit merge: !852 merge add_contributing.zh.md into master add CONTRIBUTING.zh.md for developers Created-by: jeshd Commit-by: jeshd Merged-by: ascend-robot Description: ## 描述 添加triton-ascend开源贡献指南 ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!8525 个月前
fix(doc): fix document issues Co-authored-by: fengrui<fengrui15@huawei.com> # message auto-generated for no-merge-commit merge: !696 merge fix-doc-issues into master fix(doc): fix document issues Created-by: fengrui886 Commit-by: fengrui Merged-by: ascend-robot Description: ### 相关的Issue ### 原因(目的、解决的问题等) ### 描述(做了什么,变更了什么) ### 测试用例(新增、改动、可能影响的功能) See merge request: Ascend/triton-ascend!6966 个月前
feat(CI): add llvm and triton-ascend build scripts 11 个月前
fix(setup): add pyproject.toml to use the modern way to setup 11 个月前
fix(ut): set num_cube_core fixed value.. Co-authored-by: candyhong<1102229410@qq.com> # message auto-generated for no-merge-commit merge: !836 merge fix-ci into master fix(ut): set num_cube_core fixed value.. Created-by: candyhong Commit-by: candyhong Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 主要修复CI机器中 ut 以下报错: 1. test_linearize.py 中调用 triton.runtime.driver, 概率发生进程限制报错: [PID: 17195] 2025-11-28-01:34:46.869.427 NN_Process_Count_Limit_Exceeded(E30003): The number of started NN processes exceeds the limit. -> 修复方案:避免在ut调用 triton.runtime.driver.active.get_current_device() 2. test_min_dim0.pytest_min_dim1.py 中 torch.min 算子在执行 int8 类型时,概率发生以下报错: RuntimeError: call aclnnMinDim failed, detail:[PID: 1404221] 2025-12-01-10:52:40.127.820 AclNN_Parameter_Error(EZ1001): Tensor self not implemented for DT_INT8, should be in dtype support list [DT_FLOAT,DT_FLOAT16,DT_INT64,DT_BOOL,DT_BFLOAT16,]. -> 修复方案:torch 标杆在 int8 类型时,先升到 int64 类型计算再恢复为 int8 2. test_max_dim0.pytest_max_dim1.py 中 torch.max 算子在执行 int8 类型时,概率发生以下报错: RuntimeError: call aclnnMaxDim failed, detail:[PID: 1471388] 2025-12-01-11:42:51.165.980 AclNN_Parameter_Error(EZ1001): Tensor self not implemented for DT_INT8, should be in dtype support list [DT_FLOAT,DT_FLOAT16,DT_INT64,DT_BOOL,DT_BFLOAT16,]. -> 修复方案:torch 标杆在 int8 类型时,先升到 int64 类型计算再恢复为 int8 ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!8365 个月前
feat(ci): update ISSUE_TEMPLATE.zh-CN.md 8 个月前
feat(ascend extension): introduce ascend language extension and add al.scope Co-authored-by: Hocky Yudhiono<hocky.yudhiono@huawei.com> Co-authored-by: chenxiangting<chenxiangting@huawei.com> # message auto-generated for no-merge-commit merge: !977 merge feat-triton-extension-al into master feat(ascend extension): introduce ascend language extension and add al.scope Created-by: cxtjjcz Commit-by: chenxiangting;Hocky Yudhiono Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## checklist <!-- [x] 表示选中 --> - [ ] 是否通过本地IDE对代码进行静态检查 - [ ] 是否通过本地IDE对代码进行格式化处理 - [ ] 是否进行空指针校验 - [ ] 是否进行返回值校验 - [ ] 是否正确释放new/malloc申请的内存 - [ ] 是否充分考虑接口的异常场景 - [ ] 是否正确记录错误日志 See merge request: Ascend/triton-ascend!9775 个月前
test(CI): Use makefile for building and testing 10 个月前

Triton Ascend

Triton是近几年来受到开发者青睐的Python化编程语言。开发者仅需关注Tile/Block的切分方式以及基于Tile/Block的运算逻辑,编译器将在Triton代码的编译过程中结合底层硬件特点自动完成内存分配、数据搬运、数据计算、流水并行等,因此,算子的开发难度大幅降低、开发效率显著提升。

Triton Ascend是面向昇腾平台构建的Triton编译框架,旨在让Triton代码能够在昇腾硬件上高效运行。目前,Triton Ascend还在不断完善中,我们将不断提升Triton Python API完备度、数据类型支持度、访存方式灵活性等,并持续优化编译器的自动优化能力,提升Triton Ascend整体的功能与性能泛化性。

  • RoadMap

里程碑 重要特性更新情况 状态
2025.11.14 triton-ascend 3.2.0rc4预发布版本上线
2025.09.30 完善Scan/Sort类Triton Python API,支持非连续访存,完成vLLM、sglang开源仓中重点Triton算子适配
2025.08.15 完善Atomic类Triton Python API支持,完成Flaggems开源仓重点Triton算子适配,提供Matmul等简单算子高性能实现参考用例
2025.06.30 支持85% Triton Python API,支持连续访存,覆盖基本使用场景需求
2025.05.20 Triton Ascend开源,Gitcode代码仓Alive!
  • 已支持平台

昇腾设备:Atlas 800T/I A2产品

主机CPU架构:x86/ARM

主机操作系统:Linux Ubuntu

帮助文档

欢迎广大开发者试用,但在您开始使用之前,建议您先根据您的开发需求浏览下列文档,希望能够帮助您快速上手!如果您在使用过程中遇到了问题,请您提交Issue反馈相关信息,我们将竭尽全力处理,感谢您的支持!

  • Triton Ascend 安装

详细安装步骤请参考 安装指南

  • Triton Ascend Dockerfile开发环境

我们为开发者提供了Dockerfile,帮助开发者快速构建开发环境。Dockerfile文件请参考Dockerfile

  • Triton Python API支持情况与约束

目前Triton Ascend已经使能了85%以上Triton社区官方提供的Python API,详细的功能支持情况(包括数据类型支持度、使用约束等)请参考 API 支持情况总览

  • Triton算子开发指南(入门级)

在昇腾平台上开发Triton算子的方式与在GPU平台上基本相同。我们提供了下列算子的示例源码与配套说明来解释如何开发Triton算子的设备侧Kernel函数、主机侧调用代码以及算子功能验证代码。 此外,面向不同数据类型,我们提供了用于验证Triton算子精度的示例代码供大家参考:算子精度验证开发指南参考样例Python文件

算子名称 开发指南 可执行Python文件
VectorAdd VectorAdd开发指南 VectorAdd Python文件
Softmax Softmax开发指南 Softmax Python文件
LayerNorm LayerNorm开发指南 LayerNorm Python文件
FlashAttention FlashAttention开发指南 FlashAttention Python文件
Matmul Matmul开发指南 Matmul Python文件
  • Triton算子自动寻优指南(入门级)

Triton Ascend支持Triton原生的Autotune能力。通过对Tile/Block的形状配置进行搜索寻优,开发者可以在不改变Triton算子写法的条件下获得更优的性能。 此外,配合Triton Ascend编译器自有的自动优化算法,我们也额外提供了新的可调优参数,开发者可以按需选用。关于Triton算子自动寻优,详情请参考 Autotune性能寻优指南

  • 高性能Triton算子编程开发指南(进阶级)

为能获得更好的执行性能,除了利用Autotune之外,开发者在编写Triton算子时需要结合昇腾平台的软硬件特点进行开发。我们总结梳理了一些通用优化思路与方法,包括Tile/Block切分方式、高效访存方式以及如何与编译器开展协同优化等,详情请参考高性能Triton算子编程指南

  • 非昇腾平台Triton算子快速迁移指南

目前,许多开源仓已经提供了面向GPU等平台开发的Triton算子。因为昇腾平台在内存大小、运行时接口功能上与GPU等平台存在差异,将这些算子迁移到昇腾平台运行需要完成少量必要的代码修改,具体修改方法请参考非昇腾平台Triton算子迁移指南

  • 开源仓Triton算子适配与支持情况

我们也正逐步将主流开源仓中的GPU Triton算子适配到昇腾平台,当前已适配的算子请参见 已适配开源仓算子列表

  • Triton Ascend调试调优工具使用指南

为了简化用户编程难度,助力开发者低成本完成高性能算子开发,MindStudio算子开发工具已适配Triton算子调试调优。
1) msProf op: 算子性能调优工具,支持Triton算子上板性能数据采集、内存热力图、仿真流水图生成等,详情参考:MindStudio 算子性能调优工具使用参考
2) msSanitizer: 算子内存检测工具,支持Triton算子异常行为检测,包括内存、竞争、未初始化异常检测,可精准定位异常代码行,详情参考:MindStudio 算子异常检测工具使用参考

  • Triton Ascend环境变量

Triton Ascend支持Triton原生的环境变量,此外,面向昇腾平台上的新功能特性进行了拓展。Triton Ascend涉及的全量环境变量,请参考 环境变量总览

  • Triton Ascend贡献指南

Triton Ascend贡献指南请参考 贡献指南

  • Triton Ascend常见报错与应对方案

针对在开发或迁移Triton算子时经常遇到的报错信息与解决方案,我们正在汇总并梳理相关文档供大家参考。该文档正在开发中,将于近期发布,敬请期待。

安全声明

我们重视开发者在使用Triton Ascend时的信息安全,安全防护建议与相关信息请见 安全声明

许可证

本项目代码与文档均采用 MIT许可证