[release/2.12] Backport Inductor warp-size handling#3380
Open
naromero77amd wants to merge 2 commits into
Open
Conversation
) Route threads-per-wave through a single source of truth (DeviceProperties.warp_size, from torch.cuda.get_device_properties) and thread it through the config-generation helpers, replacing _NUM_THREADS_PER_WARP, cc_warp_size, and scattered `warp_size or 32` / `torch.version.hip` branches. Behavior change: _num_warps halves num_warps only when warp_size == 64 (AMD CDNA/gfx9), not on every HIP device; AMD RDNA (wave32) now follows the NVIDIA path. Authored with: Claude Pull Request resolved: pytorch#181112 Approved by: https://github.com/jansel (cherry picked from commit 521f9d7)
…h#183014) Upstream PR pytorch#181112 (`[inductor] Unify threads-per-wave (warp_size) extraction`) has now landed and did much of the original broad warp-size plumbing for this PR: it centralized `DeviceProperties.warp_size`, threaded `warp_size` through Inductor's Triton config helpers, and made HIP wave32 devices follow the non-wave64 path. After rebasing on top of that work, this PR is now focused on the remaining stricter ROCm-safe behavior: - Preserve missing `DeviceProperties.warp_size` as `None` instead of synthesizing `32` for CUDA/HIP devices. - Make `DeviceProperties.warp_size_or_default` raise for missing CUDA/HIP warp-size metadata, while preserving the explicit non-GPU fallback. - Skip optional autotune/rblock/fusion/split-reduction heuristics when required warp-size metadata is unavailable instead of guessing. - Keep CUDA launcher generation on the fast `32` path, but use the device warp size for HIP launcher block dimensions. - Use queried device warp size in template register-spill pruning, with graceful fallback on non-CUDA/XPU builds. - Update the relevant Inductor tests for the stricter missing CUDA/HIP metadata behavior. - Rebased cleaned stack onto `upstream/main` at `19791183fec`. - Rebuilt PyTorch from scratch with `/home/niromero/docker_workspace/framework_scripts/pytorch/build.sh`. - Ran impacted UTs: - `python test/inductor/test_triton_heuristics.py TestWarpSizeUnification TestTritonHeuristics.test_autotune_hints_to_configs TestFastLauncherDeviceSupport` - `python test/inductor/test_max_autotune.py TestMaxAutotune.test_max_autotune_includes_max_autotune_pointwise_configs` - `python test/inductor/test_torchinductor_dynamic_shapes.py -k test_embedding_backward_dynamic_shapes_large_grid` - `python test/inductor/test_torchinductor.py -k test_reduction_config_limit` Made with [Cursor](https://cursor.com) Pull Request resolved: pytorch#183014 Approved by: https://github.com/jansel, https://github.com/glen-amd, https://github.com/jeffdaily, https://github.com/eellison (cherry picked from commit 9183299)
|
Jenkins build for 0cc2280e44da48851d2b7aaf85d9e87fa2a3c796 commit finished as FAILURE |
Author
|
Update on the distributed CI failures: I tried to reproduce the failing distributed tests locally against a clean Failures observed in CI on this PR:
Local checks performed:
Both targeted repro attempts passed locally, including the Python-files-over-baseline run. I was not able to reproduce the tensor mismatch failures from Jenkins. |
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.
Summary
Test plan
python -m py_compileon all changed Python filesgit diff --check origin/release/2.12...HEADtorch.version