-
Notifications
You must be signed in to change notification settings - Fork 300
prefill cuda graph. #1149
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
prefill cuda graph. #1149
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f11341e
add atomic event kernel
a9b5e14
add prefill_cuda_graph.py
a7f7c04
add prefill cuda graph feature
a0c5d58
fix
c05ede4
fix
35b3d92
fix
6a5f887
fix
a12dad4
fix
a218420
fix
6d03694
fix
a53bbd4
g_cache_manager
4b7c4a1
fix
5c5b1d8
fix prefill input padded error
1a7a631
fix requeriments.txt
8e25066
fix
c8a01cc
fix
554e919
fix
abd4317
fix
7845689
fix mtp bug
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
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.
There's redundant logic here for checking if a CUDA graph can be used. The calling function
_prefillalready performs these checks (can_run,find_closest_graph_handle_token_num) and pads the input accordingly. This block repeats the same checks on the already-padded input.This duplicated logic can be simplified. The decision to use a graph and the specific graph to use should be determined once in
_prefilland then passed to_context_forward, for example via theinfer_stateobject. This would make the code cleaner and easier to maintain.A potential refactoring could look like this:
In
_prefill:In
_context_forward: