Repository navigation
Studio tests: pin that pip_install_try clears the torch probe memo too - #8796
Closed
danielhanchen wants to merge 1 commit into
Closed
danielhanchen wants to merge 1 commit into
danielhanchen wants to merge 1 commit into
Conversation
#8779 memoizes the torch classification and invalidates it on a pip operation. Both entry points do that now, but only pip_install has a test, so the pip_install_try half can be dropped without anything going red. It is the half that matters on Windows AMD. _ensure_rocm_torch reinstalls the ROCm torch trio through pip_install_try, and the repair paths run at two points with the torchao version probe between them. A memo that survives that install pins torchao against the torch that was just replaced. Two tests: the memo is cleared, and the torchao consumer specifically sees the reinstalled version. Both fail with the invalidate call removed. The decode half is already covered by test_undecodable_import_chatter_does_not_escape, which drives the real subprocess, so nothing is added there.
danielhanchen
added a commit
that referenced
this pull request
Aug 14, 2026
Folds in the one test #8796 had that this branch did not. The other two there duplicate what is already here, so #8796 closes in favour of this. _select_torchao_spec reads _probe_installed_torch_version() between the two repair points, which makes it the consumer that would actually read a memo left over from before a reinstall, and pin torchao against the torch that was just replaced. The existing cases assert on _probe_torch_runtime directly; this one goes through the accessor that the torchao path really calls. Fails with the _invalidate_torch_runtime_probe() line removed from pip_install_try, along with the three siblings, and passes with it.
Member
Author
|
Closing in favour of #8795, which pins the same invariant on the same file. The two overlap on Verified there: 24 pass, and removing the |
danielhanchen
added a commit
that referenced
this pull request
Aug 14, 2026
…llers (#8795) * Studio tests: pin the torch probe invalidation contract to both installers #8779 made pip_install_try() drop the memoized torch classification, because it installs the Windows AMD ROCm trio and a memo it does not clear can answer for the build it just replaced. That fix shipped with no test: only pip_install() was covered, so reverting the pip_install_try() line kept the suite green. Three tests, each of which fails with that line removed: - pip_install_try() drops the memo, mirroring the pip_install() case - a real reinstall is really reclassified: two real torch packages on disk and a real probe subprocess either side of a real call into each installer, so the answer that replaces the memo is shown to come from the venv as it is now rather than from the mock that dropped it - every function that builds a pip or uv install command invalidates. Read out of the module with ast rather than listed here, so a third installer helper cannot be added without either invalidating or failing this test No production change. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pin the torchao consumer to the reinstalled torch as well Folds in the one test #8796 had that this branch did not. The other two there duplicate what is already here, so #8796 closes in favour of this. _select_torchao_spec reads _probe_installed_torch_version() between the two repair points, which makes it the consumer that would actually read a memo left over from before a reinstall, and pin torchao against the torch that was just replaced. The existing cases assert on _probe_torch_runtime directly; this one goes through the accessor that the torchao path really calls. Fails with the _invalidate_torch_runtime_probe() line removed from pip_install_try, along with the three siblings, and passes with it. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]>
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.
Follow-up to #8779. Tests only, no source change.
#8779 memoizes the torch classification and clears it on a pip operation. Both entry points do that now, but only
pip_installhas a test, so thepip_install_tryhalf can be removed and nothing goes red.Why that half is the one worth pinning
_ensure_rocm_torchreinstalls the ROCm torch trio throughpip_install_try(studio/install_python_stack.py, the Windows AMD path), and the repair paths run at two points with the torchao version probe between them:_ensure_cuda_torch/_ensure_rocm_torch/_ensure_xpu_torch/_ensure_cpu_torch_probe_installed_torch_version()then_select_torchao_spec(...)A memo that survives the reinstall pins torchao against the torch that was just replaced, and
_ensure_cpu_torchreads the same stale answer two lines after the install.The tests
test_pip_install_try_invalidates_the_cache: probe, reinstall throughpip_install_try, probe again, and the second call both re-spawns and reports the new buildtest_the_torchao_probe_sees_the_reinstalled_torch: the same through_probe_installed_torch_version, which is the consumer that actually reads the stale valueBoth fail with the
_invalidate_torch_runtime_probe()call removed frompip_install_try, and pass with it.Not added
The strict-decode half is already covered by
test_undecodable_import_chatter_does_not_escape, which drives the real subprocess rather than a mock. I wrote a second pair for it before noticing, and dropped them as redundant.Verification
tests/studio/install/plustests/studio/test_xpu_triton_swap.py: 2608 passed, 2 skippedruff check: clean