Add optional torch.compile support to InferenceRunner via InferenceConfig - #3098
Closed
maximpavliv wants to merge 6 commits into
Closed
Add optional torch.compile support to InferenceRunner via InferenceConfig#3098maximpavliv wants to merge 6 commits into
torch.compile support to InferenceRunner via InferenceConfig#3098maximpavliv wants to merge 6 commits into
Conversation
maximpavliv
marked this pull request as draft
September 17, 2025 13:33
maximpavliv
force-pushed
the
maxim/torch_compile
branch
2 times, most recently
from
September 17, 2025 19:34
8e1469a to
c732fe7
Compare
torch.compile to InferenceRunner
maximpavliv
marked this pull request as ready for review
September 18, 2025 12:29
torch.compile support and inference configuration classes
maximpavliv
marked this pull request as draft
September 23, 2025 08:43
maximpavliv
force-pushed
the
maxim/torch_compile
branch
from
September 23, 2025 13:58
1c799cb to
a755682
Compare
torch.compile support and inference configuration classestorch.compile support to InferenceRunner via InferenceConfig
maximpavliv
marked this pull request as ready for review
September 24, 2025 08:15
Contributor
|
Tested this on various projects. After the initial compilation delay, the speed up is great!
|
Contributor
Author
|
Thanks for your review @arashsm79 ! As this PR no longer has any diffs against main because its commits were included in #3105, I'm closing as redundant. I'll address your feedback in #3106 @arashsm79 . |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR adds optional support for
torch.compilein theInferenceRunnerclass via the newInferenceConfigclass (built on top of PR #3104).If compilation is enabled, the model is compiled at

InferenceRunnerinitialization using the specified backend. In our speed benchmarking suite, enablingtorch.compileshows faster inference speed:However, there are some important caveats:
For these reasons,
torch.compileis disabled by default, but advanced users can opt in at their own risk.Key changes
Added
torch.compilesupport via theInferenceConfigclass.Compilation parameters can now be passed either through the
InferenceConfigobject or via theinference:block inpytorch_config.yaml, consistent with the multithreading configuration.When enabled, the model is compiled at initialization using the specified backend.
Notes