Repository navigation
[precompile] Make the installed-artifact regenerate hint conditional on a source change - #200526
bobrenjc93 wants to merge 54 commits into
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/200526
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 6434204 with merge base 80c4d80 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Claude finished @bobrenjc93's task in 26s —— View job This PR is still correct and self-contained after the tb103 rebase. The PR Review: #200526SummaryThis PR makes the regenerate hint in What I checked at this position:
I didn't run the tests. This comes from reading the code. RecommendationApprove |
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 25s —— View job This PR is still correct and self-contained after the tb104 rebase, and I found no issues. PR Review: #200526SummaryThis PR makes the regenerate hint in What I checked at this position:
I didn't run the tests. This comes from reading the code. RecommendationApprove |
[ghstack-poisoned]
[ghstack-poisoned]
…itional on a source change
When `_build_installed_forward` cannot rebuild or install an artifact's package, it raises a PrecompileError that appends the cause and ended "If that source changed since capture, regenerate the artifact against it." Here "that source" read as `{module_name}.{FN_NAME}`, the entry function, but the package also checksums every inlined source, and those often live in other modules. The same `except Exception` also catches causes that name no source at all (an AssertionError inside install, say). Only the "Source code changes detected for <module> (line a - line b)" RuntimeError from `CompilePackage` names the source that changed.
The hint is now conditional: "If the cause names a source that changed since capture, regenerate the artifact against it." Giving the regenerate hint only for the source-mismatch RuntimeError would mean matching that error's text, which this driver avoids elsewhere (it catches the refusal by type). So the hint is left to the reader, who can see the cause.
This addresses review comments on the commit that introduced the message (#198556). That PR is approved, so the change goes here at the top of the stack instead of being amended into it.
Test Plan:
`test_an_installed_artifact_names_a_changed_helper_module_at_load` changes a module the entry inlines, not the entry's own module, and checks that the cause names that module and the message carries the conditional hint. The existing install-failure tests still pass:
```
python test/test_precompile.py -k test_an_installed_artifact_names_a_changed_helper_module_at_load
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
lintrunner -a --skip PYREFLY,CLANGTIDY torch/_precompile_driver.py
```
This PR was authored with an AI assistant (Claude Code).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ghstack-source-id: 3c000d6
Pull-Request: #200526
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 25s —— View job I found no issues. The diff is the same one approved at the last review. PR Review: #200526SummaryThis PR changes the regenerate hint in the catch-all install error of Against
I didn't run the tests. This comes from reading the code. RecommendationApprove |
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 26s —— View job I found no issues. The diff is the same one approved at the last review. PR Review: #200526SummaryThis PR changes the regenerate hint in the catch-all install error of Compared with
I didn't run the tests. This comes from reading the code. RecommendationApprove |
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 13s —— View job I found no issues; the diff is the same one approved at the last review. PR Review: #200526SummaryThis PR changes the regenerate hint in Against RecommendationApprove I didn't run the tests; this comes from reading the code. |
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 19s —— View job I found no issues. The diff hasn't changed since the last approved review. PR Review: #200526SummaryThis PR changes the regenerate hint in the catch-all install error in Against RecommendationApprove I didn't run the tests. This comes from reading the code. |
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 15s —— View job I found no issues. The diff is the same one approved at the last review. PR Review: #200526SummaryThis PR changes the regenerate hint in the catch-all install error in Against RecommendationApprove I didn't run the tests. This comes from reading the code. |
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 16s —— View job I found no issues. The diff is the same one approved at the last review. PR Review: #200526SummaryThis PR changes the regenerate hint in the catch-all install error in Against RecommendationApprove I didn't run the tests. This comes from reading the code. |
Stack from ghstack (oldest at bottom):
co_qualnameis stale #200824Problem. When an installed artifact fails to install, its error ends "If that source changed since capture, regenerate the artifact against it.", which reads as pointing at the entry function even when the source that changed is an inlined helper in another module, or when no source changed at all.
Fix. The hint is now conditional on the cause, which the error already appends: "If the cause names a source that changed since capture, regenerate the artifact against it."
Summary. When
_build_installed_forwardcannot rebuild or install an artifact's package, it raises aPrecompileErrorthat appends the cause and ended "If that source changed since capture, regenerate the artifact against it." Here "that source" read as{module_name}.{FN_NAME}, the entry function, but the package also checksums every inlined source, and those often live in other modules; the sameexcept Exceptionalso catches causes that name no source at all (anAssertionErrorinside install, say). Only the "Source code changes detected for (line a - line b)"RuntimeErrorfromCompilePackagenames the source that changed, so the hint now says "If the cause names a source that changed since capture, regenerate the artifact against it." Giving the hint only for thatRuntimeErrorwould mean matching its text, which this driver avoids elsewhere (it catches the refusal by type), so the hint is left to the reader, who can see the cause. This addresses review comments on #198556, which introduced the message; that PR is approved, so the change goes here at the top of the stack instead of being amended into it.Example
The new test captures an entry whose graph-breaking frame inlines
helper.scaledfrom a separate module, then edits only the helper before loading:test_an_installed_artifact_names_a_changed_helper_module_at_loadasserts that the error containsSource code changes detected for <helper module>and the new conditional sentence.Test Plan:
test_an_installed_artifact_names_a_changed_helper_module_at_loadchanges a module the entry inlines, not the entry's own module, and checks that the cause names that module and the message carries the conditional hint. The existing install-failure tests still pass:This PR was authored with an AI assistant (Claude Code).
Co-Authored-By: Claude Opus 5.5 [email protected]