-
Notifications
You must be signed in to change notification settings - Fork 667
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
Flash attention v2 forward #10484
Merged
Merged
Flash attention v2 forward #10484
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
2e16534
updata cmake files for flash-attention.
cccddd77 f8bcb78
update flash_attention.cmake
cccddd77 c74d206
add flash-attention 2 forward kernel.
cccddd77 79a4e39
Merge branch 'Oneflow-Inc:master' into flash_attn_v2
cccddd77 60d616b
fix bugs.
cccddd77 45f9ee0
Merge branch 'flash_attn_v2' of https://github.com/cccddd77/oneflow i…
cccddd77 78aa88b
format check.
cccddd77 599f11f
fix bug.
cccddd77 0062b64
add output tensor for rng_state.
cccddd77 5058ebd
fix typo.
cccddd77 7fbaf6a
rm duplicated license.
cccddd77 bb68ee1
format check.
cccddd77 996c00c
cmake format.
cccddd77 6aa9f1b
update flash-attention forward sbp.
cccddd77 803ae51
add cuda_version check, flash-attention only support cuda_version >=
cccddd77 a55977d
fix cmake bugs.
cccddd77 d94c500
auto format by CI
oneflow-ci-bot df1c97a
rm useless op trait of flash-attn.
cccddd77 2e641f4
change cuda version requirement to >= 11.7
cccddd77 a6780e2
add test file.
cccddd77 7b2e632
typo.
cccddd77 359cc12
format check.
cccddd77 a83daf8
Merge branch 'master' into flash_attention_v2_forward
cccddd77 a99d71e
use git to get flash-attention.
cccddd77 ffe3f74
fix test bug on cpu only env.
cccddd77 fcc088f
auto format by CI
oneflow-ci-bot 4c06137
change test file.
cccddd77 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
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
include(ExternalProject) | ||
|
||
find_package(Threads) | ||
|
||
# NOTE: A git version of 1.6.5 or later is required if this download method is used. | ||
find_package(Git QUIET REQUIRED) | ||
|
||
set(FLASH_ATTENTION_PROJECT flash_attention) | ||
|
||
set(FLASH_ATTENTION_URL https://github.com/Oneflow-Inc/flash-attention-v2.git) | ||
set(FLASH_ATTENTION_TAG eed2e82b880e06237af3e50ceac4cf6728b15645) | ||
|
||
set(FLASH_ATTENTION_INSTALL_DIR ${THIRD_PARTY_DIR}/flash_attention) | ||
set(FLASH_ATTENTION_INCLUDE_DIR ${FLASH_ATTENTION_INSTALL_DIR}/include CACHE PATH "" FORCE) | ||
set(FLASH_ATTENTION_LIBRARY_DIR ${FLASH_ATTENTION_INSTALL_DIR}/lib CACHE PATH "" FORCE) | ||
set(FLASH_ATTENTION_LIBRARIES ${FLASH_ATTENTION_LIBRARY_DIR}/libflash_attention.so) | ||
|
||
if(THIRD_PARTY) | ||
ExternalProject_Add( | ||
${FLASH_ATTENTION_PROJECT} | ||
PREFIX flash_attention | ||
GIT_REPOSITORY ${FLASH_ATTENTION_URL} | ||
GIT_TAG ${FLASH_ATTENTION_TAG} | ||
UPDATE_COMMAND "" | ||
BUILD_BYPRODUCTS ${FLASH_ATTENTION_LIBRARIES} | ||
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} | ||
-DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG} | ||
-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE} | ||
-DCMAKE_CUDA_ARCHITECTURES:STRING=${CMAKE_CUDA_ARCHITECTURES} | ||
CMAKE_CACHE_ARGS | ||
-DCMAKE_CUDA_COMPILER:STRING=${CUDAToolkit_NVCC_EXECUTABLE} | ||
-DCMAKE_C_COMPILER_LAUNCHER:STRING=${CMAKE_C_COMPILER_LAUNCHER} | ||
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=${CMAKE_CXX_COMPILER_LAUNCHER} | ||
-DCMAKE_INSTALL_PREFIX:PATH=${FLASH_ATTENTION_INSTALL_DIR} | ||
-DCMAKE_INSTALL_LIBDIR:PATH=${FLASH_ATTENTION_LIBRARY_DIR} | ||
-DCMAKE_INSTALL_MESSAGE:STRING=${CMAKE_INSTALL_MESSAGE} | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) | ||
endif(THIRD_PARTY) |
This file contains 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 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 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个第三方库 之后最好把它挪到external目录下去 原则上新添加的第三方依赖都放external下