-
Notifications
You must be signed in to change notification settings - Fork 23
Enable AOTriton BWD V3 API #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
d10fa92
Initial commit
Micky774 eef7dc0
Updated to build from source by default
Micky774 cc68ab7
Updated for V3 API
Micky774 4455361
Fixed build, reverted AOTriton bwd changes (now V2)
Micky774 2586b18
Removed alterations
Micky774 aa80f81
Removed lazy tensor wrapper
Micky774 9a91b9e
Streamlined cmakelist, other PR review feedback adressed
Micky774 023deb4
Removed `pad_between_seqs`
Micky774 6b8dbe5
Updated typing to be more explicit
Micky774 68303d0
Minor streamlining and formatting
Micky774 8181972
Initial implementation
Micky774 6788a16
Simplified window size func for current non-SWA support
Micky774 182101a
Removed accidental include
Micky774 19a9c0f
Merge branch 'zain/aotriton' into zain/aotriton-bwd
Micky774 fef6baa
Corrected bwd args
Micky774 3a4fab8
Updated causal window default
Micky774 917e3c3
Updated window values for causal
Micky774 ce32e3b
Merge branch 'zain/aotriton' into zain/aotriton-bwd
Micky774 36045c8
Corrected DQ_ACC buffer, added env var for GPU kernel building
Micky774 d6e46c1
Update AOTriton to 0.11.1b
Micky774 1349a48
Merge branch 'dev' into zain/aotriton
Micky774 8ed0009
Merge branch 'zain/aotriton' into zain/aotriton-bwd
Micky774 2bd9006
Added AOTriton commit SHA
Micky774 a9bef37
Merge branch 'dev' into zain/aotriton-bwd
Micky774 0fdff86
Moved handling of env variable to makefile
Micky774 3f6e054
Simplified lazy tensor implementation
Micky774 2246da4
Merge branch 'dev' into zain/aotriton-bwd
Micky774 2a17f7b
Merge branch 'dev' into zain/aotriton-bwd
Micky774 1a267cd
Update AOTriton version
Micky774 51da203
Improved tests
Micky774 945c8b2
Fix dq_acc stride. AITER ASM expects BHS.
xinyazhang e478e1a
Merge branch 'dev' into zain/aotriton-bwd
Micky774 872bc12
Revert unnecessary changes
Micky774 4478af5
Updated copyright and IS_HIP_EXTENSION guard
Micky774 8d06ef1
Update test and cmakelist
Micky774 0654925
Updated tests
Micky774 f2798b7
Merge branch 'dev' into zain/aotriton-bwd
Micky774 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule aotriton
updated
13 files
| +9 −2 | .ci/build-release.sh | |
| +6 −3 | .ci/releasesuite-git-head.sh | |
| +2 −2 | CMakeLists.txt | |
| +41 −0 | dockerfile/input/docker-script-build-altwheel.sh | |
| +7 −1 | dockerfile/input/docker-script-build.sh | |
| +3 −1 | include/aotriton/util.h | |
| +1 −1 | tritonsrc/attn_torch_function.py | |
| +1 −1 | v3python/compile.py | |
| +15 −5 | v3python/gpu_targets.py | |
| +1 −1 | v3src/flash/aiter_bwd.cc | |
| +1 −1 | v3src/flash/attn_bwd.cc | |
| +1 −1 | v3src/flash/attn_fwd.cc | |
| +4 −0 | v3src/util.cc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipanfilo marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved. | ||
| # Copyright (c) 2022-2026, Advanced Micro Devices, Inc. All rights reserved. | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| cmake_minimum_required(VERSION 3.21) | ||
|
|
@@ -8,19 +8,16 @@ project(aotriton LANGUAGES CXX) | |
| # The AOTriton C++ runtime will be built from {TE}/3rdparty/aotriton | ||
| # Hence there is no need to add multiple ROCM version here | ||
|
|
||
| if(DEFINED ENV{AOTRITON_PATH}) | ||
| set(AOTRITON_PATH $ENV{AOTRITON_PATH}) | ||
| endif() | ||
|
|
||
| set(__AOTRITON_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/aotriton") | ||
| set(__AOTRITON_SUFFIX "_TEprivate") | ||
|
|
||
| if(NOT DEFINED AOTRITON_PATH) | ||
| # If AOTRITON_PATH is not provided, we proceed to build the runtime | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your original changes used env variable to control it. On the other hand this feature seems unused |
||
| # ourselves and either build or download the GPU kernels | ||
| if(USE_FUSED_ATTN_AOTRITON_BUILD_GPU_KERNELS) | ||
| set(AOTRITON_NOIMAGE_MODE OFF) | ||
| else() | ||
| set(AOTRITON_NOIMAGE_MODE ON) | ||
| endif() | ||
|
|
||
| set(__AOTRITON_VER "0.11.1b") | ||
| set(__AOTRITON_VER "0.11.2b") | ||
| set(__AOTRITON_IMAGE_LIST | ||
| "amd-gfx942" | ||
| "amd-gfx950" | ||
|
|
@@ -66,8 +63,7 @@ if(NOT DEFINED AOTRITON_PATH) | |
|
|
||
| # Build the AOTriton runtime from source with custom suffix to avoid | ||
| # potential conflict with libaotriton as provided by PyTorch | ||
| function(aotriton_build_from_source noimage) | ||
| message(STATUS "No-image mode: ${noimage}.") | ||
| function(aotriton_build_from_source) | ||
| get_git_commit(${TE}/3rdparty/aotriton AOTRITON_SHA) | ||
| ExternalProject_Add(aotriton_external | ||
| LIST_SEPARATOR "," | ||
|
|
@@ -78,7 +74,7 @@ if(NOT DEFINED AOTRITON_PATH) | |
| -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
| -DAOTRITON_NO_PYTHON=ON | ||
| -DAOTRITON_NAME_SUFFIX=${__AOTRITON_SUFFIX} | ||
| -DAOTRITON_NOIMAGE_MODE=${noimage} | ||
| -DAOTRITON_NOIMAGE_MODE=ON | ||
| -DTE_AOTRITON_COMMIT_SHA1=${AOTRITON_SHA} | ||
| -DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/aotriton_custom.cmake | ||
| BUILD_BYPRODUCTS "${__AOTRITON_INSTALL_DIR}/lib/libaotriton${__AOTRITON_SUFFIX}_v2.so" | ||
|
|
@@ -97,7 +93,7 @@ if(NOT DEFINED AOTRITON_PATH) | |
| add_library(aotriton INTERFACE) | ||
| message(STATUS "Building AOTriton from source.") | ||
| string(REPLACE ";" "," ARCH_LIST_COMMA_STR "${CMAKE_HIP_ARCHITECTURES}") | ||
| aotriton_build_from_source(${AOTRITON_NOIMAGE_MODE}) | ||
| aotriton_build_from_source() | ||
|
|
||
| # Download GPU kernels if needed | ||
| if(NOT USE_FUSED_ATTN_AOTRITON_BUILD_GPU_KERNELS) | ||
|
|
@@ -121,8 +117,9 @@ if(NOT DEFINED AOTRITON_PATH) | |
| else() | ||
| # Use aotriton built during initial TE building/installation | ||
| # When only need rebuild TE library itself | ||
| message(STATUS "Using existing AOTriton lib at $ENV{AOTRITON_PATH}") | ||
| unset(AOTRITON_LIB CACHE) | ||
| find_library(AOTRITON_LIB NAMES aotriton aotriton${__AOTRITON_SUFFIX}_v2 PATHS ${AOTRITON_PATH}/lib REQUIRED NO_DEFAULT_PATH) | ||
| find_library(AOTRITON_LIB NAMES aotriton aotriton${__AOTRITON_SUFFIX}_v2 PATHS ${AOTRITON_PATH} REQUIRED NO_DEFAULT_PATH) | ||
| add_library( aotriton SHARED IMPORTED ) | ||
| set_target_properties( aotriton PROPERTIES IMPORTED_LOCATION ${AOTRITON_LIB} ) | ||
| target_include_directories(aotriton INTERFACE ${AOTRITON_PATH}/include) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.