Repository navigation
Enable CUDA graphs for MTP inference #4260
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 103 commits
Commits
Show all changes
148 commits
Select commit
Hold shift + click to select a range
bde9685
Add nvtx ranges for mtp
santhnm2 7587f2f
perf benchmarking
santhnm2 b8bdd12
Remove simpy dependency
santhnm2 e948bc9
cuda graphs for mtp
santhnm2 6c60f34
mtp cuda graphs
santhnm2 90ffe8a
fix cuda graphs
santhnm2 8ce0a4b
cuda graph fix
santhnm2 84129e7
Fix dummy_position_ids dtype
santhnm2 9bfa0fc
Try to compile more
santhnm2 cbc1270
remove extra ep sync
santhnm2 7687743
Add nvtx ranges
santhnm2 407e12d
Remove cpu sync
santhnm2 e54458c
Avoid h2d syncs
santhnm2 70afe4c
Linting
santhnm2 5e84f85
compile rewind_kv_cache
santhnm2 e2020b2
Linting
santhnm2 56b93ff
Fix verify_speculative_tokens
santhnm2 98a32ef
More fixes
santhnm2 3fefb93
Add torch.compile back
santhnm2 96668d6
Linting
santhnm2 9a95577
Try to fix tests
santhnm2 74edd58
Fix test
santhnm2 b6466d2
More test fixes
santhnm2 6941afb
Bug fix
santhnm2 94452d5
Linting
santhnm2 cd981ea
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 774ec53
kernelize
santhnm2 d9c2902
more perf optimizations
santhnm2 45cc1eb
Fix dtype
santhnm2 6c57910
Fix dtype
santhnm2 68923e2
Fix cuda graph
santhnm2 0066e42
Clean up CUDA graph
santhnm2 0a235ff
Clean up graph
santhnm2 0d6243a
Fix graph
santhnm2 5bfd41c
Debugging
santhnm2 95ed9a0
Fix graphs
santhnm2 4b1d093
Fix graphs
santhnm2 7913032
Remove debug prints
santhnm2 819ec4a
Merge remote-tracking branch 'upstream/main' into mtp_perf_v2
santhnm2 a39dffd
Clean up
santhnm2 9e6680c
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 b1e44cf
Merge branch 'mtp_perf_v2' into mtp_perf
santhnm2 9bd8aa4
Add unit test
santhnm2 e8690f8
Linting
santhnm2 89c4ced
Zero out padded values in test
santhnm2 610d434
Fix test
santhnm2 0656373
fix test
santhnm2 93f5a34
Fix test
santhnm2 bd8c4b9
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 bbbb92d
Fix test
santhnm2 24d481e
Fix tests
santhnm2 e872366
Fix tests
santhnm2 aacefb4
Linting
santhnm2 ac2048c
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 13122e7
Mark flaky tests
santhnm2 8dacd28
Merge with main
santhnm2 8d3a063
Fix rewind_kv_cache_bug
santhnm2 210415a
Move MTP cuda graph warmup inline
santhnm2 bcebf41
Linting
santhnm2 c82b70a
Add Triton tests
santhnm2 3a3bbdc
Linting
santhnm2 c05d8a5
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 43de7aa
NVLS all gathers
santhnm2 78fba30
Fix gather_output
santhnm2 4c0ac1a
Expand graph scope
santhnm2 03d52ab
Update tests
santhnm2 4abc573
Fix graph manager
santhnm2 d8b08ac
Fix chaining
santhnm2 836a914
Fix keys
santhnm2 bb597ca
Inference RS
santhnm2 3c3b23b
Fix flag
santhnm2 5391d6c
Merge remote-tracking branch 'upstream/main' into mtp_perf_v2
santhnm2 bc214cf
Formatting
santhnm2 2a77e5b
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 91029d4
Merge branch 'mtp_perf_v2' into mtp_perf
santhnm2 c0f4fff
Clean up and fixes
santhnm2 c39c8e5
Fix tests
santhnm2 084e605
Make MTP cuda graphs test engine level
santhnm2 432722d
Fix dtype
santhnm2 1a59fcc
Cast model to params_dtype
santhnm2 2f8e0c8
Fixes
santhnm2 57771f9
Try again to fix tests
santhnm2 314a2ee
Fix 0 token count graph error
santhnm2 f0a87e0
Fix casting
santhnm2 168028b
Fix input dtype
santhnm2 3d61c13
Add depth
santhnm2 43176d1
Delete cuda graphs for eager
santhnm2 d76da59
Fix delete cuda graphs
santhnm2 248d761
Fix deletion path
santhnm2 187b00d
Linting
santhnm2 4676931
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 aa1e8f6
Cleanup
santhnm2 1bc4a87
Linting
santhnm2 f97e3f6
Remove dead code
santhnm2 fcb2ec3
Clean up resources for test_parallel_inference
santhnm2 259c1f5
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 f2504c5
Fix EP in test
santhnm2 3d21b5d
Fix is_expert arg
santhnm2 fa22202
Fix case where weight is None
santhnm2 389d83e
Add depth kwarg
santhnm2 0825420
Nits
santhnm2 ffdefc5
Fix normalization in unit test
santhnm2 dbd9f20
Fix bias in unit test
santhnm2 9b6a2c4
Add no-op get_extra_state function
santhnm2 343c6bb
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 79c871d
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 2d8b102
Linting
santhnm2 6d2ace5
Address review comments
santhnm2 53bd51d
Address reviewer comments
santhnm2 157c0c5
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 8f5e7d3
Revert unnecessary changes
santhnm2 6d1f0b6
Linting
santhnm2 c5a2d5f
Clean up MTP graph manager tracking
santhnm2 b074789
More cleanup
santhnm2 ed0e028
Restore docstring
santhnm2 ffe4780
Fix skip_weight_param_allocation
santhnm2 3119052
Revert InferenceColumnParallelLinear changes
santhnm2 d991265
Linting
santhnm2 9a72316
Standardize inference_reduce_scatter_first_dim API
santhnm2 0c4b56c
Merge
santhnm2 071ab7f
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 ba6de96
Merge with main
santhnm2 4e56aee
Remove is_expert setting
santhnm2 9d90639
Address reviewer comments
santhnm2 adafdd1
Linting
santhnm2 1700d02
Add mtp_utils_pytorch.py
santhnm2 d75ed23
Linting
santhnm2 4bab4be
setup_method -> setup_cls
santhnm2 0afeb18
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 61bde08
Add classmethod decorator
santhnm2 652c9b5
More test NCCL cleanup
santhnm2 06e6907
Refactor test_dynamic_engine.py
santhnm2 96a01ea
clear nvte env vars
santhnm2 77473c3
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 490165b
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 8eb0c80
Fix test
santhnm2 ac467b1
Refactor test_text_generation_controller.py
santhnm2 3e28f26
Explicitly delete cuda graphs
santhnm2 15d0e83
Add cuda graph deletion to static engine
santhnm2 b4d0d69
More cleanup
santhnm2 1a8f7da
Add clear_nvte_env_vars to static test
santhnm2 9f64401
Add garbage collection to test_moe_inference.py
santhnm2 f193a01
Linting
santhnm2 5266808
Merge remote-tracking branch 'upstream/main' into mtp_perf
santhnm2 c6ad4f3
More cuda graph deletion
santhnm2 2cae20f
Fix copyright
santhnm2 f537865
Revert unnecessary cuda graph changes
santhnm2 84b1ef5
Merge with main
santhnm2 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| set -u | ||
|
|
||
| # Libraries. | ||
| pip install simpy | ||
| pip install sentencepiece | ||
| pip install tiktoken | ||
|
|
||
|
|
||
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 |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| set -u | ||
|
|
||
| # Libraries. | ||
| pip install simpy | ||
| pip install sentencepiece | ||
| pip install tiktoken | ||
|
|
||
|
|
||
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
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.
How does this example work with MoEs, given that it does not have the coordinator?
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.
Good point,
gpt_dynamic_inference_with_coordinator.pyshould be preferred for any MoE workload. But the base script still works, just without data parallelism (I pass in a prompt file so all ranks run all prompts). We should probably consolidate these two scripts in the future though.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.
At some point we should get rid of this example. Perhaps move it inside the tests folder, since some tests still rely on it.
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.
Reverted changes to
gpt_dynamic_inference.py