Repository navigation
[precompile] support Dynamo graph breaks - #194148
bobrenjc93 wants to merge 11 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194148
Note: Links to docs will display an error until the docs builds have been completed. ❌ 21 New Failures, 1 Unrelated Failure, 1 Unclassified FailureAs of commit 508db9d with merge base ab5fb26 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
The Dynamo precompile path previously required full-graph capture, so an explicit graph break or torch._dynamo.disable call could not be packaged. Guard minimization also treated dependent guard records independently, which could route aliasing or dictionary-order cases to the wrong variant. Capture and serialize every Dynamo entry and resume frame, rebuild their dispatchers at load, and embed closure-free disabled functions with portable globals. Guard reduction now preserves each complete manager's outcome vector across the examples; identity-dependent example guards are rejected instead of being discarded during capture. Compiled graphs and Inductor kernels remain readable Python, while only guard state and required bytecode stay opaque. I considered replaying graph breaks through a runtime Dynamo compiler, but that would violate the artifact's no-runtime-recompilation contract. Reconstructing the captured resume frames keeps the artifact standalone and deterministic. Test Plan: ``` /home/bobren/local/b/pytorch-env/bin/python agent_space/run_precompile_overlay.py test -v -k dynamo ``` ``` /home/bobren/local/b/pytorch-env/bin/python agent_space/run_precompile_overlay.py test -v TestPrecompile.test_tracer_default_and_explicit_make_fx TestPrecompile.test_cache_envelope_is_weights_only_safe TestPrecompile.test_example_inputs_is_keyword_only TestPrecompile.test_make_fx_requires_one_example_input_num_examples_0 TestPrecompile.test_make_fx_requires_one_example_input_num_examples_2 ``` ``` PATH=/home/bobren/.conda/envs/xlformers_finetune_conda-newest/bin:$PATH TMPDIR=/home/bobren/local/e/pytorch/agent_space/precompile-example-inputs/agent_space/lintrunner_tmp UV_OFFLINE=1 lintrunner -a ``` ``` /home/bobren/local/b/pytorch-env/bin/python agent_space/run_precompile_overlay.py example ``` Authored with an AI assistant. ghstack-source-id: 2d4d0a0 Pull-Request: #194148
Stack from ghstack (oldest at bottom):
Human note:
This is the graph-break layer of the folded stack. I reviewed it separately because it adds the native cache-entry and resume-frame machinery needed to serve captured graph breaks without running Dynamo at runtime.
AI-assisted review summary: