forked from ggml-org/llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
8000
Show file tree
Hide file tree
Jan 17, 2024
Jan 18, 2024
Jan 18, 2024
Jan 19, 2024
Jan 19, 2024
Jan 20, 2024
Jan 20, 2024
Jan 20, 2024
Jan 20, 2024
Jan 21, 2024
Jan 21, 2024
Jan 21, 2024
Jan 21, 2024
Jan 21, 2024
Jan 21, 2024
Jan 21, 2024
Jan 23, 2024
Jan 23, 2024
Jan 24, 2024
Jan 24, 2024
Jan 24, 2024
Jan 23, 2024
Jan 25, 2024
Jan 25, 2024
Jan 25, 2024
Jan 25, 2024
Jan 25, 2024
Jan 25, 2024
Jan 25, 2024
Jan 27, 2024
Jan 27, 2024
Jan 27, 2024
Jan 28, 2024
Jan 28, 2024
Jan 28, 2024
Jan 28, 2024
Jan 28, 2024
Jan 28, 2024
Jan 28, 2024
Jan 28, 2024
Jan 29, 2024
Jan 29, 2024
Jan 29, 2024
Jan 29, 2024
Jan 29, 2024
Jan 29, 2024
Jan 30, 2024
Jan 30, 2024
Jan 30, 2024
Jan 30, 2024
Jan 31, 2024
Jan 31, 2024
Jan 31, 2024
Jan 31, 2024
Jan 31, 2024
Jan 31, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Feb 3, 2024
Feb 3, 2024
Feb 3, 2024
Feb 3, 2024
Feb 3, 2024
WIP: Flash Attention implementation (forward + backward) #1
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
f7bcfb0
cuda: add flash attention + test
FSSRepo e53de28
fix compilation
FSSRepo a1c004e
ggml : add ggml_flash_attn_ext API
ggerganov fa7ebcc
ggml : fix GQA support in ggml_flash_attn_ext
ggerganov 09db1a7
Merge branch 'gg/flash-attn' of https://github.com/ggerganov/llama.cp…
FSSRepo fded2e6
apply suggestions
FSSRepo c3cdfff
Merge branch 'master' into gg/flash-attn
ggerganov a9681fe
ggml : online attention (CPU)
ggerganov 1173f49
metal : initial implementation
ggerganov 528da75
metal : f16 precision
ggerganov 52ae085
metal : reduce branches
ggerganov b973258
metal : specialize for head size
ggerganov 8cde449
wip : 8 rows per simd group
ggerganov f31955f
wip : 4 rows per simd group
ggerganov a4b6341
wip : template for rows per warp
ggerganov
8000
Jan 21, 2024
77d08f3
metal : parallelize across KV size
ggerganov 17720fa
metal : parallel reduce across heads
ggerganov a689b02
Merge branch 'gg/flash-attn' of https://github.com/ggerganov/llama.cp…
FSSRepo 6374bc5
cuda: port metal version flash_attn_ext
FSSRepo 6416821
fix equivalent fp16 math functions, compiler error 'undefined'
FSSRepo 972c2ad
use half2 instead half4
FSSRepo 0fc36d8
match to metal impl
FSSRepo 1446a12
metal : efficient flash_attn_f16 implementation
ggerganov d917746
metal : avoid redundant loads of the attention
ggerganov 432ad04
metal : scale and mask in matrix form
ggerganov 40ea8cd
metal : fix comment
ggerganov 78da338
Merge branch 'gg/flash-attn' of https://github.com/ggerganov/llama.cp…
FSSRepo f9ca5dc
llama : avoid ggml_cast, use F32 query
ggerganov 6e7cb0e
update implementation
FSSRepo 6fea843
metal : add parallel reduce version (disabled)
ggerganov 0a481fe
integrate tensor cores
FSSRepo 7cea973
Merge branch 'gg/flash-attn' of https://github.com/ggerganov/llama.cp…
FSSRepo 2455a8d
update impl
FSSRepo b3dd7d9
Merge branch 'master' into gg/flash-attn
ggerganov 77f6976
metal : move output into local memory + optimize
ggerganov ecc466a
metal : add tests, fix scaling, support C > 32
ggerganov 3a428a1
metal : improve precision
ggerganov 8612864
ggml : fix f16 mad
ggerganov 0ad44ba
Merge branch 'master' into gg/flash-attn
ggerganov 134c81c
metal : minor
ggerganov 1db22d7
metal : support Q > 8
ggerganov 4794821
tests : add ATTN tests
ggerganov abeaf0d
metal : disable buffer allocation logs
ggerganov c6c1132
tests : more
ggerganov 5fcb9c1
metal : faster inner loop for C == 32
ggerganov a1d5a12
fix compiler error
FSSRepo 7980178
Merge branch 'gg/flash-attn' of https://github.com/ggerganov/llama.cp…
FSSRepo d073e4f
metal : fix array initialization
ggerganov 78df552
tests : ifdef
ggerganov 3d03bcb
Merge branch 'master' into gg/flash-attn
ggerganov 3b0f74b
latest kernel update, wrong values
FSSRepo 2ddc9bb
Merge branch 'master' into gg/flash-attn
ggerganov b1479df
fix kernel
FSSRepo 8ad92dc
ggml : switch to padded F16 mask for ggml_soft_max, ggml_flash_attn_ext
ggerganov 0afe47f
fix naive implementation
FSSRepo 3df0b8d
Merge branch 'gg/flash-attn' of https://github.com/ggerganov/llama.cp…
FSSRepo fd878f7
cuda: mask as fp16
FSSRepo 71b69aa
cuda : fix flash_attn kernel to produce same results as CPU
8000
ggerganov 2c04bee
cuda : avoid extra QxQ matrix in shared memory
ggerganov 9a5c2a1
cuda : switch to F16 scalars + tune warps for RTX 2060
ggerganov ac26f27
cuda : increase C to 128 for better performance
ggerganov 43f7156
Merge pull request #3 from ggerganov/flash-attn-cuda
FSSRepo 9240a84
fix mask nullptr
FSSRepo 8d7a606
don't require LLAMA_CUDA_F16 to compile
FSSRepo 19e0b8e
#ifdef -> #if + fix check -inf
FSSRepo cae985c
cmake: remove unused changes
FSSRepo 53621e3
refactor flash_attn function + improve tests
FSSRepo 674d5ac
unroll 2 loops, int64_t -> int, 309 µs
JohannesGaessler 8b51ab4
Merge pull request #4 from Pints-App/jg/flash-attn-cuda
FSSRepo a1f9ffe
bring optimizations from gg/flash-attn
FSSRepo ba7699d
Merge branch 'flash-attn-cuda' of https://github.com/Pints-App/llama.…
FSSRepo f659f57
fix merge conflicts
FSSRepo 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
apply suggestions
- Loading branch information
commit fded2e6a11bb600e04fec8714ab9165bda7724f8
There are no files selected for viewing
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
6D40
than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.