fix: torch compile default to inductor on cpu#673
Open
gsprochette wants to merge 2 commits into
Open
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Member
|
Why were we using openvino in the first place? isn't it only optimal for intel? |
begumcig
approved these changes
Jun 8, 2026
begumcig
left a comment
Member
There was a problem hiding this comment.
Well it makes sense to me that you even got a slightly better performance (assuming you ran this on your company laptop or your workstation, neither uses intel cpus), I don't think our default should be openvino at all and thank you for noticing and changing this!
Member
|
Rerunning the tests that failed due to an internet error, let's wait for them to pass then merge away!!! thanks again <3 |
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 makes inductor the default for torch compile on CPU. Doing this moves away from openvino which fails on some architectures due to some known shape checks in openvino.
With a very quick benchmark of
torchvision.models.vit_b_16on CPU with both torch 2.11 and 2.12, the compiled model with inductor backend also runs slightly faster than the openvino one (41ms with 0.3ms uncertainty for openvino vs 39ms with 0.2ms uncertainty for inductor, on torch 2.12). Hence this change should not affect performance, or even improve them.Related Issue
Fixes tests/algorithms/test_algorithms.py::test_full_integration[TestTorchCompile_shufflenet-cpu]
Type of Change
Testing
uv run pytest -m "cpu and not slow")The tests/algorithms/test_algorithms.py::test_full_integration[TestTorchCompile_shufflenet-cpu] usually only passes because of the retry, which for some reason uses cached states on the second run avoiding the faulty shape assumptions. This can be reproduced with the following bash code that needs to run at the root of the pruna project, with your venv activated:
This test reliably fails on main for me with different versions of torch (+cu126 versions), and passes with the torch inductor switch.
Checklist
Thanks for contributing to Pruna! We're excited to review your work.
New to contributing? Check out our Contributing Guide for everything you need to get started.