Repository navigation
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/196153
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 56d828d with merge base 13d3489 ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
…e_on_one_rank Every rank compiled the same graph and then missed on every other rank's cache entry, so no compiled artifact was ever shared. The index reaches the key through exactly one component -- example_inputs' TensorMetadata: [lfqb4cez...] example_inputs[0]: TensorMetadata(..., device=device(type='cuda', index=0), ...) Nothing else contributes one. In particular the graph hashed alongside it does not: the key is built in _compile_fx_inner before _recursive_post_grad_passes runs, so it sees the AOT graph, where devices are still current_device() nodes. Measured on a 16-GPU CooR job, 4730 device-bearing key lines per rank, all of them example_inputs, and zero from gm. Strip it in extract_tensor_metadata_for_cache_key, whose stated job is removing fields not needed for caching, and which already does this for storage_offset and storage_bytes. Gated on the accelerator being the current one, so cpu tensors and non-CooR compiles keep their index -- outside CooR several devices can legitimately be live and must not collide. The full key is now byte-identical across devices under CooR, and still correctly distinct without it. test_inductor_compiled_on_one_device_runs_on_another asserted a cache *miss* as a deliberate tripwire for this change -- its comment asked that landing a device-agnostic key trip the test rather than silently widen it. It now asserts the hit. That comment also flagged CompiledFxGraph.device_idxs as a second requirement, and it is one: cudagraphify takes its device_index from the loaded artifact, so a cuda:1 rank hitting rank 0's entry warmed up and captured under cuda:0's device, stream and pool, and crashed with `CUDA driver error: invalid argument`. Under CooR the artifact now records no index, and CompiledFxGraph.device_index() resolves it to the current device at load time -- the same single-accelerator invariant the key change relies on. Outside CooR the recorded index is kept, since the current device need not match the graph's there. The alternative, keeping the stored index and overriding it on load, would leave a wrong value in the artifact for the next reader to trip over. extract_tensor_metadata_for_cache_key also feeds the AOTAutogradCache key (and graph_region_tracker), so that key becomes rank-agnostic under CooR too, which is what cross-rank reuse needs. Test Plan: ``` TORCHINDUCTOR_COMPILE_THREADS=1 python test/distributed/tensor/test_compile_on_one_rank.py python test/inductor/test_cudagraph_trees.py ``` test_cudagraphs_reuses_artifact_across_devices (both graph_partition settings) fails with the invalid-argument error without the output_code.py change and passes with it. This PR was authored with the help of an AI assistant. ghstack-source-id: a521845 Pull-Request: #196153
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 STARTUP failures reported, please check workflows syntax! trunk Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 STARTUP failures reported, please check workflows syntax! trunk Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: HTTP Error 504: Gateway Timeout Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…compile_on_one_rank (#196154) InputWriter records each input storage's device, so fx_graph_runnable comes out different on every rank: 3568 of the 3716 lines differing between two ranks of a 16-GPU job were device(type='cuda', index=N). It also makes a repro produced by rank 11 unrunnable anywhere with fewer than 12 GPUs. Under compile_on_one_rank the inputs are on the current accelerator by invariant, so writing the index records nothing that is true of any other rank. Drop it and let the reader place the storage on whatever device is current: the repro replays the same compile, matches across ranks, and runs on a box with fewer GPUs than the rank that produced it. This extends the defaulting the writer already does -- there is a TODO there observing that defaulting to cpu is unhelpful when the repros that matter are CUDA. Gated, so a non-CooR repro still names its device: several accelerators can be live at once there and the repro has to say which one it used. Pull Request resolved: #196154 Approved by: https://github.com/bobrenjc93 ghstack dependencies: #196153
…e_on_one_rank (pytorch#196153) Every rank compiled the same graph and then missed on every other rank's cache entry, so no compiled artifact was ever shared. The index reaches the key through exactly one component -- example_inputs' TensorMetadata: [lfqb4cez...] example_inputs[0]: TensorMetadata(..., device=device(type='cuda', index=0), ...) Nothing else contributes one. In particular the graph hashed alongside it does not: the key is built in _compile_fx_inner before _recursive_post_grad_passes runs, so it sees the AOT graph, where devices are still current_device() nodes. Measured on a 16-GPU CooR job, 4730 device-bearing key lines per rank, all of them example_inputs, and zero from gm. Strip it in extract_tensor_metadata_for_cache_key, whose stated job is removing fields not needed for caching, and which already does this for storage_offset and storage_bytes. Gated on the accelerator being the current one, so cpu tensors and non-CooR compiles keep their index -- outside CooR several devices can legitimately be live and must not collide. The full key is now byte-identical across devices under CooR, and still correctly distinct without it. test_inductor_compiled_on_one_device_runs_on_another asserted a cache *miss* as a deliberate tripwire for this change -- its comment asked that landing a device-agnostic key trip the test rather than silently widen it. It now asserts the hit. That comment also flagged CompiledFxGraph.device_idxs as a second requirement, and it is one: cudagraphify takes its device_index from the loaded artifact, so a cuda:1 rank hitting rank 0's entry warmed up and captured under cuda:0's device, stream and pool, and crashed with `CUDA driver error: invalid argument`. Under CooR the artifact now records no index, and CompiledFxGraph.device_index() resolves it to the current device at load time -- the same single-accelerator invariant the key change relies on. Outside CooR the recorded index is kept, since the current device need not match the graph's there. The alternative, keeping the stored index and overriding it on load, would leave a wrong value in the artifact for the next reader to trip over. extract_tensor_metadata_for_cache_key also feeds the AOTAutogradCache key (and graph_region_tracker), so that key becomes rank-agnostic under CooR too, which is what cross-rank reuse needs. Test Plan: ``` TORCHINDUCTOR_COMPILE_THREADS=1 python test/distributed/tensor/test_compile_on_one_rank.py python test/inductor/test_cudagraph_trees.py ``` test_cudagraphs_reuses_artifact_across_devices (both graph_partition settings) fails with the invalid-argument error without the output_code.py change and passes with it. This PR was authored with the help of an AI assistant. Pull Request resolved: pytorch#196153 Approved by: https://github.com/bobrenjc93
…compile_on_one_rank (pytorch#196154) InputWriter records each input storage's device, so fx_graph_runnable comes out different on every rank: 3568 of the 3716 lines differing between two ranks of a 16-GPU job were device(type='cuda', index=N). It also makes a repro produced by rank 11 unrunnable anywhere with fewer than 12 GPUs. Under compile_on_one_rank the inputs are on the current accelerator by invariant, so writing the index records nothing that is true of any other rank. Drop it and let the reader place the storage on whatever device is current: the repro replays the same compile, matches across ranks, and runs on a box with fewer GPUs than the rank that produced it. This extends the defaulting the writer already does -- there is a TODO there observing that defaulting to cpu is unhelpful when the repros that matter are CUDA. Gated, so a non-CooR repro still names its device: several accelerators can be live at once there and the repro has to say which one it used. Pull Request resolved: pytorch#196154 Approved by: https://github.com/bobrenjc93 ghstack dependencies: pytorch#196153
…e_on_one_rank (pytorch#196153) Every rank compiled the same graph and then missed on every other rank's cache entry, so no compiled artifact was ever shared. The index reaches the key through exactly one component -- example_inputs' TensorMetadata: [lfqb4cez...] example_inputs[0]: TensorMetadata(..., device=device(type='cuda', index=0), ...) Nothing else contributes one. In particular the graph hashed alongside it does not: the key is built in _compile_fx_inner before _recursive_post_grad_passes runs, so it sees the AOT graph, where devices are still current_device() nodes. Measured on a 16-GPU CooR job, 4730 device-bearing key lines per rank, all of them example_inputs, and zero from gm. Strip it in extract_tensor_metadata_for_cache_key, whose stated job is removing fields not needed for caching, and which already does this for storage_offset and storage_bytes. Gated on the accelerator being the current one, so cpu tensors and non-CooR compiles keep their index -- outside CooR several devices can legitimately be live and must not collide. The full key is now byte-identical across devices under CooR, and still correctly distinct without it. test_inductor_compiled_on_one_device_runs_on_another asserted a cache *miss* as a deliberate tripwire for this change -- its comment asked that landing a device-agnostic key trip the test rather than silently widen it. It now asserts the hit. That comment also flagged CompiledFxGraph.device_idxs as a second requirement, and it is one: cudagraphify takes its device_index from the loaded artifact, so a cuda:1 rank hitting rank 0's entry warmed up and captured under cuda:0's device, stream and pool, and crashed with `CUDA driver error: invalid argument`. Under CooR the artifact now records no index, and CompiledFxGraph.device_index() resolves it to the current device at load time -- the same single-accelerator invariant the key change relies on. Outside CooR the recorded index is kept, since the current device need not match the graph's there. The alternative, keeping the stored index and overriding it on load, would leave a wrong value in the artifact for the next reader to trip over. extract_tensor_metadata_for_cache_key also feeds the AOTAutogradCache key (and graph_region_tracker), so that key becomes rank-agnostic under CooR too, which is what cross-rank reuse needs. Test Plan: ``` TORCHINDUCTOR_COMPILE_THREADS=1 python test/distributed/tensor/test_compile_on_one_rank.py python test/inductor/test_cudagraph_trees.py ``` test_cudagraphs_reuses_artifact_across_devices (both graph_partition settings) fails with the invalid-argument error without the output_code.py change and passes with it. This PR was authored with the help of an AI assistant. Pull Request resolved: pytorch#196153 Approved by: https://github.com/bobrenjc93
…compile_on_one_rank (pytorch#196154) InputWriter records each input storage's device, so fx_graph_runnable comes out different on every rank: 3568 of the 3716 lines differing between two ranks of a 16-GPU job were device(type='cuda', index=N). It also makes a repro produced by rank 11 unrunnable anywhere with fewer than 12 GPUs. Under compile_on_one_rank the inputs are on the current accelerator by invariant, so writing the index records nothing that is true of any other rank. Drop it and let the reader place the storage on whatever device is current: the repro replays the same compile, matches across ranks, and runs on a box with fewer GPUs than the rank that produced it. This extends the defaulting the writer already does -- there is a TODO there observing that defaulting to cpu is unhelpful when the repros that matter are CUDA. Gated, so a non-CooR repro still names its device: several accelerators can be live at once there and the repro has to say which one it used. Pull Request resolved: pytorch#196154 Approved by: https://github.com/bobrenjc93 ghstack dependencies: pytorch#196153
Stack from ghstack (oldest at bottom):
Every rank compiled the same graph and then missed on every other rank's cache
entry, so no compiled artifact was ever shared. The index reaches the key through
exactly one component -- example_inputs' TensorMetadata:
[lfqb4cez...] example_inputs[0]: TensorMetadata(..., device=device(type='cuda', index=0), ...)
Nothing else contributes one. In particular the graph hashed alongside it does
not: the key is built in _compile_fx_inner before _recursive_post_grad_passes
runs, so it sees the AOT graph, where devices are still current_device() nodes.
Measured on a 16-GPU CooR job, 4730 device-bearing key lines per rank, all of
them example_inputs, and zero from gm.
Strip it in extract_tensor_metadata_for_cache_key, whose stated job is removing
fields not needed for caching, and which already does this for storage_offset
and storage_bytes. Gated on the accelerator being the current one, so cpu
tensors and non-CooR compiles keep their index -- outside CooR several devices
can legitimately be live and must not collide.
The full key is now byte-identical across devices under CooR, and still
correctly distinct without it.
test_inductor_compiled_on_one_device_runs_on_another asserted a cache miss as
a deliberate tripwire for this change -- its comment asked that landing a
device-agnostic key trip the test rather than silently widen it. It now asserts
the hit.
That comment also flagged CompiledFxGraph.device_idxs as a second requirement,
and it is one: cudagraphify takes its device_index from the loaded artifact, so a
cuda:1 rank hitting rank 0's entry warmed up and captured under cuda:0's device,
stream and pool, and crashed with
CUDA driver error: invalid argument. UnderCooR the artifact now records no index, and CompiledFxGraph.device_index()
resolves it to the current device at load time -- the same single-accelerator
invariant the key change relies on. Outside CooR the recorded index is kept, since
the current device need not match the graph's there. The alternative, keeping
the stored index and overriding it on load, would leave a wrong value in the
artifact for the next reader to trip over.
extract_tensor_metadata_for_cache_key also feeds the AOTAutogradCache key (and
graph_region_tracker), so that key becomes rank-agnostic under CooR too, which is
what cross-rank reuse needs.
Test Plan:
test_cudagraphs_reuses_artifact_across_devices (both graph_partition settings)
fails with the invalid-argument error without the output_code.py change and
passes with it.
This PR was authored with the help of an AI assistant.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo