-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[TRTLLM-16012][feat] Restrict torch.compile to piecewise graph capture only #18366
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
AlessioNetti
wants to merge
23
commits into
NVIDIA:main
Choose a base branch
from
AlessioNetti:restrict-torch-compile
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.
+336
−19
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2364066
[WiP] Allow disabling torch.compile for generation-only batches
AlessioNetti ee82d07
Refactor compile_generation flag to cover warmup and autotuning passes
AlessioNetti 82fe10a
Rename new flag to compile_only_piecewise_graphs
AlessioNetti 3cfea35
Minor refactoring
AlessioNetti 7ccba0d
Encapsulate torch.compile bypass logic in helper class
AlessioNetti c740f37
Drop trivial config tests
AlessioNetti 70bd3bd
Add documentation
AlessioNetti 8ec255a
Add comments to justify missing torch.compile bypass
AlessioNetti 6f2f62f
Update LLM args manifest
AlessioNetti f8992fb
Add test for numerical stability of compile_only_piecewise_graphs option
AlessioNetti c7fe471
Update docstring for compile_only_piecewise_graphs option
AlessioNetti b76f082
Add checks for conflicting prefill backends and forbid with attention DP
AlessioNetti 66c05c5
Add tests for config validation
AlessioNetti 57f7eae
Move torch.compile bypass logic inside PyTorchModelEngine
AlessioNetti 6a53fd4
Minor fix to model engine tests
AlessioNetti 23f21d6
Encapsulate all torch.compile bypass logic inside _maybe_bypass_torch…
AlessioNetti 5f6451f
Add focused tests for graph eligibility, move stability test to unitt…
AlessioNetti 57d658b
Add documentation
AlessioNetti 5b3bc43
Update comments after refactoring
AlessioNetti 249537c
Fix stale LLM args manifest
AlessioNetti f72f471
Integrate compile restriction with prefill wrapper
AlessioNetti 2256e52
Undo leftover changes in compile utils
AlessioNetti 8ee5a0f
Fix torch_compiling() assignment after rebase
AlessioNetti 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
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.
compile_only_piecewise_graphs=Trueis currently accepted whileprefill_cuda_graph_backendremainsdisabled. In that configuration the backend is not piecewise, but every context/mixed forward still enterstorch.compile, so the option silently violates its name and PR contract.We should either require
PrefillCudaGraphBackend.PIECEWISEinnormalize_prefill_cuda_graph_config()and dispatch on actual piecewise eligibility, or rename the option to describe phase-selective compilation.We should also add validation tests for disabled and conflicting backends.
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.
Thanks - I had missed this. I added a check during config validation with commit 39249ef to prevent this, and also forbid using the new option under attention DP (see other comment). I also added simple validation tests with commit 08f5a04.