-
-
Notifications
You must be signed in to change notification settings - Fork 21k
[ModelRunner V2] Speculative Decoding NGram GPU Implementations #40704
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
Open
PatchouliTIS
wants to merge
79
commits into
vllm-project:main
Choose a base branch
from
PatchouliTIS:patchy/async_ngram_v2_pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,065
−66
Open
Changes from 6 commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
58aa569
async ngram gpu debug
4bfb745
complete async ngram v2
02185ac
remove overcomments
242fb82
set minimal values in FP32
8569425
Merge branch 'main' of github.com:vllm-project/vllm into patchy/async…
b4f1db9
remove debug
f22224a
reorg codes
3437791
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 324fe81
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 95dffa8
Merge branch 'main' of github.com:vllm-project/vllm into patchy/async…
3af6547
fix argmax
2527013
Merge branch 'patchy/async_ngram_v2_pr' of https://github.com/Patchou…
199b525
fix merge conflicts and revert changes in gumbel
480614b
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 81a1915
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 7d5deb7
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 00b071a
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS a285ef6
test added for ngram gpu
fcdab55
fix return value
3374d6f
add tests in yaml and change return values into tuple
34fa287
add tests in yaml and change return values into tuple
b0eb7ad
merge conflicts
aabb68f
Merge branch 'main' of github.com:vllm-project/vllm into patchy/async…
a9101c7
fix test error
5986d2b
inputs params fixed
07641bc
fix(test): Add required InitVar fields to SchedulerConfig in ngram_gp…
b906e89
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 29b8a6c
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS a880d05
merge conflicts fixed
7a7ea14
Merge branch 'patchy/async_ngram_v2_pr' of github.com:PatchouliTIS/vl…
29cb65e
modify vllm config to pass ngram_gpu
98cc7da
fix method signature
9d6fd07
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 4824b4a
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 430e18a
Merge branch 'main' of github.com:vllm-project/vllm into patchy/async…
445322d
format fixed
1474690
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 98a0809
fix gpu utils drop bug
4ea6d81
Merge branch 'main' of github.com:vllm-project/vllm into patchy/async…
3cb1b37
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 6fea8f2
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 37cc9c5
merge conflicts fixed
cb77a14
Merge branch 'patchy/async_ngram_v2_pr' of https://github.com/Patchou…
5228bd6
duplicated codes removed
eb4dc4e
merge conflicts resolved
2d0bab6
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS af498ea
triton kernel for ngram gpu
e66fbb8
Merge branch 'patchy/async_ngram_v2_pr' of https://github.com/Patchou…
6dd58ad
return values fixed
2754fe3
fix merge conflicts
709e437
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 3e20869
config bug fixed
172b2bd
Merge branch 'patchy/async_ngram_v2_pr' of https://github.com/Patchou…
4033877
return type fixed
52e79a8
Merge branch 'main' of github.com:vllm-project/vllm into patchy/async…
2d5f8f9
merge conflicts fixed
4702930
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 028e77a
Merge branch 'main' of github.com:vllm-project/vllm into patchy/async…
6097cba
merge conflicts fixed
e9805e6
merge conflicts fixed
80205e7
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS ad4bd48
merge conflicts fixed
PatchouliTIS 66e1ade
test vllm_runner updated
PatchouliTIS 919a826
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 4ae1b28
resolve merge conflicts
PatchouliTIS 223ebc3
merge conflicts fixed and config error fixed
PatchouliTIS 3064455
Merge branch 'main' of https://github.com/vllm-project/vllm into patc…
PatchouliTIS e1a05d6
Merge remote-tracking branch 'origin/main' into patchy/async_ngram_v2_pr
njhill 9ff65bc
[Spec Decode] ngram_gpu on V2: GPU-side draft trimming via shared ver…
njhill d84087e
[Spec Decode] ngram_gpu: conservative trim gating for auto cudagraph …
njhill b8a3834
simplify
njhill e052b8c
[Spec Decode] Resolve both ngram methods to the GPU implementation on…
njhill ee72c7a
Merge remote-tracking branch 'origin/main' into patchy/async_ngram_v2_pr
njhill 6c5dfc9
[Spec Decode] Resolve the varlen-decode cudagraph constraint inside r…
njhill bc5e16d
[Spec Decode] Pass RequestState to speculators at construction
njhill 2e39f8c
[Spec Decode] Derive draft-trimmer prerequisites inside maybe_create_…
njhill 8797fe6
[Spec Decode] Collapse the draft-trim contract into one speculator field
njhill 7e5703a
Merge remote-tracking branch 'origin/main' into patchy/async_ngram_v2_pr
njhill ffeadf6
Merge branch 'main' into patchy/async_ngram_v2_pr
PatchouliTIS 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1671,9 +1671,12 @@ def _free_encoder_inputs(self, request: Request) -> None: | |||||||||||
| self.encoder_cache_manager.free_encoder_input(request, input_id) | ||||||||||||
|
|
||||||||||||
| def update_draft_token_ids(self, draft_token_ids: DraftTokenIds) -> None: | ||||||||||||
| for req_id, spec_token_ids in zip( | ||||||||||||
| draft_token_ids.req_ids, | ||||||||||||
| draft_token_ids.draft_token_ids, | ||||||||||||
| num_valid_list = draft_token_ids.num_valid_draft_tokens | ||||||||||||
| for i, (req_id, spec_token_ids) in enumerate( | ||||||||||||
| zip( | ||||||||||||
| draft_token_ids.req_ids, | ||||||||||||
| draft_token_ids.draft_token_ids, | ||||||||||||
| ) | ||||||||||||
| ): | ||||||||||||
| request = self.requests.get(req_id) | ||||||||||||
| if request is None or request.is_finished(): | ||||||||||||
|
|
@@ -1686,6 +1689,12 @@ def update_draft_token_ids(self, draft_token_ids: DraftTokenIds) -> None: | |||||||||||
| request.spec_token_ids = [] | ||||||||||||
| continue | ||||||||||||
|
|
||||||||||||
| # Variable-length drafters: truncate to the number of drafts | ||||||||||||
| if num_valid_list is not None: | ||||||||||||
| num_valid = num_valid_list[i] | ||||||||||||
| if num_valid < len(spec_token_ids): | ||||||||||||
| spec_token_ids = spec_token_ids[:num_valid] | ||||||||||||
|
|
||||||||||||
| # Add newly generated spec token ids to the request. | ||||||||||||
| if self.structured_output_manager.should_advance(request): | ||||||||||||
| metadata = request.structured_output_request | ||||||||||||
|
|
@@ -1696,11 +1705,14 @@ def update_draft_token_ids_in_output( | |||||||||||
| self, draft_token_ids: DraftTokenIds, scheduler_output: SchedulerOutput | ||||||||||||
| ) -> None: | ||||||||||||
| num_invalid_spec_tokens: dict[str, int] = {} | ||||||||||||
| num_valid_list = draft_token_ids.num_valid_draft_tokens | ||||||||||||
|
|
||||||||||||
| sched_spec_tokens = scheduler_output.scheduled_spec_decode_tokens | ||||||||||||
| for req_id, spec_token_ids in zip( | ||||||||||||
| draft_token_ids.req_ids, | ||||||||||||
| draft_token_ids.draft_token_ids, | ||||||||||||
| for i, (req_id, spec_token_ids) in enumerate( | ||||||||||||
| zip( | ||||||||||||
| draft_token_ids.req_ids, | ||||||||||||
| draft_token_ids.draft_token_ids, | ||||||||||||
| ) | ||||||||||||
|
Member
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. can collapse
Suggested change
|
||||||||||||
| ): | ||||||||||||
| request = self.requests.get(req_id) | ||||||||||||
| if request is None or request.is_finished(): | ||||||||||||
|
|
@@ -1714,7 +1726,14 @@ def update_draft_token_ids_in_output( | |||||||||||
| orig_num_spec_tokens = len(placeholder_spec_tokens) | ||||||||||||
| # Trim drafts to scheduled number of spec tokens | ||||||||||||
| # (needed for chunked prefill case for example). | ||||||||||||
| del spec_token_ids[orig_num_spec_tokens:] | ||||||||||||
| effective_num_spec_tokens = orig_num_spec_tokens | ||||||||||||
| if num_valid_list is not None: | ||||||||||||
| effective_num_spec_tokens = max( | ||||||||||||
| 0, | ||||||||||||
| min(num_valid_list[i], orig_num_spec_tokens), | ||||||||||||
|
Member
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.
Suggested change
|
||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| del spec_token_ids[effective_num_spec_tokens:] | ||||||||||||
| # Filter out spec tokens which do not adhere to the grammar. | ||||||||||||
| if self.structured_output_manager.should_advance(request): | ||||||||||||
| metadata = request.structured_output_request | ||||||||||||
|
|
||||||||||||
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
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
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
Empty file.
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.
can collapse