-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
[Kernel] Enable Hybrid Model Support in Triton Unified Attention Kernel #21197
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
30 commits
Select commit
Hold shift + click to select a range
c3f8dd4
modify shape of kv cache
jvlunteren 7d52de7
removed prefill support from split-kv attention
jvlunteren 41a1254
added reorder_batch method
jvlunteren 6109a14
added tiling to support large non-power-of-2 block sizes
jvlunteren 343ed93
formatting
jvlunteren a96e229
updated parameters
jvlunteren ffa29db
resolved conflicts
jvlunteren 6a375ee
removed unneeded files
jvlunteren 39e352d
Merge branch 'vllm-project:main' into jvl-hybrid-support
jvlunteren c4f7d67
add prefill support back to split-kv kernel
jvlunteren b4fd773
removed changes to triton_attn.py
jvlunteren 40218f4
Merge branch 'vllm-project:main' into jvl-hybrid-support
jvlunteren 832ccb8
restored changes to triton_attn.py
jvlunteren d893bcb
formatting
jvlunteren 02b0464
Merge branch 'main' into jvl-hybrid-support
jvlunteren 9b63155
formatting
jvlunteren d3979e9
Merge branch 'main' into jvl-hybrid-support
jvlunteren 771f524
Merge branch 'main' into jvl-hybrid-support
jvlunteren ec62011
Merge branch 'main' into jvl-hybrid-support
jvlunteren 39ed6b6
temporarily revert changes to enable simpler merge with latest main
jvlunteren eead28e
Merge branch 'vllm-project:main' into jvl-hybrid-support
jvlunteren 2b415b6
Merge branch 'vllm-project:main' into jvl-hybrid-support
jvlunteren 4254fad
restore changes to triton_unified_attention.py
jvlunteren db61501
Merge branch 'main' into jvl-hybrid-support
jvlunteren 3605c65
Merge branch 'main' into jvl-hybrid-support
jvlunteren 8a846bc
replaced block size check by tile size check
jvlunteren f41f90e
Merge branch 'main' into jvl-hybrid-support
jvlunteren 3dedd20
assign default tile sizes for prefill and decode, remove check
jvlunteren ee82dd5
Merge branch 'main' into jvl-hybrid-support
jvlunteren 8da5f74
Merge branch 'main' into jvl-hybrid-support
jvlunteren 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 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
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.
How come the 3D kernel didn't need to compute
max_seq_prefix_lenbefore this change? It looks like the 2D kernel did need to.Uh oh!
There was an error while loading. Please reload this page.
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.
The value
max_seq_prefix_lenrelates to the number of tokens preceding the last query token in a Q block (for prefill, there can be multiple query tokens in a Q block), and is determined also considering potential padding. Because the 3D kernel is only used for decodes and therefore each Q block will only contain one query token, consequently the number of tokens preceding that single query token can be determined directly from the sequence length andmax_seq_prefix_lendoes need to be calculated.When I added prefill support back to 3d (split-kv) kernel, to simplify the review process (c4f7d67), I also added using
max_seq_prefix_lenback to the 3d kernel for the same purpose, by making the 2d and 3d kernels very similar.In order to synchronize the branch of the fork involved in this PR with the vLLM main branch, it was easier to temporarily remove my updates, do the synchronization with the main vLLM branch, and then apply the updates again. Because the 3d kernel in the vLLM main branch does not use
max_seq_prefix_len, it looks like the update only happened with the last change, but as indicated above, it was already included with commit c4f7d67. In a follow-up PR, I intend to simplify the 3d kernel by removing all functionality needed to support prefills, including the use ofmax_seq_prefix_len.