benchmark
f65725fa - Make dynamo debug/repro utilities device-agnostic (#184851)

Commit
57 days ago
Make dynamo debug/repro utilities device-agnostic (#184851) Summary: Dynamo's debug and repro utilities (`debug_utils.py`, `repro/after_aot.py`, `repro/after_dynamo.py`, `utils.py`, `_functorch/benchmark_utils.py`) were hardcoded to CUDA — using `tensor.is_cuda`, `.cuda()`, `torch.cuda.synchronize()`, and `torch.amp.autocast("cuda", ...)`. This breaks repro script generation and synchronization-based error detection for any non-CUDA accelerator. This PR replaces those CUDA-specific paths with device-agnostic equivalents: - `tensor.is_cuda` → `tensor.device.type != "cpu"`. - `.cuda()` / `device="cuda"` in generated repro code → `.to("<actual_device>")`. - `torch.cuda.synchronize()` → `torch.accelerator.synchronize()` (guarded by `torch.accelerator.is_available()`). - Hardcoded `torch.amp.autocast("cuda", ...)` → device type inferred from actual tensor arguments. Tests covering the fixed paths are added to `test_debug_utils.py`, `test_after_aot.py`, `test_minifier.py`, and `test_utils.py` using `instantiate_device_type_tests` so they run across all available devices. X-link: https://github.com/pytorch/pytorch/pull/184851 Approved by: https://github.com/williamwen42, https://github.com/jansel Reviewed By: jeanschmidt Differential Revision: D106831372 fbshipit-source-id: 668fc8d9cdbb756f7abf34ca0986fe7e6ca4cc7c
Author
generatedunixname499836121
Committer
Parents
Loading