Skip to content

[ROCm][Inductor] Make missing GPU warp-size metadata explicit - #183014

Closed
naromero77amd wants to merge 12 commits into
pytorch:mainfrom
naromero77amd:rocm-remove-hardcoded-warp-sizes
Closed

naromero77amd wants to merge 12 commits into
pytorch:mainfrom
naromero77amd:rocm-remove-hardcoded-warp-sizes

Conversation

@naromero77amd

@naromero77amd naromero77amd commented May 9, 2026 •

Copy link
Copy Markdown
Collaborator

Upstream PR #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.

Validation

  • 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

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @pragupta @jerrymannil @xinyazhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @mlazos

@pytorch-bot

pytorch-bot Bot commented May 9, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/183014

Note: Links to docs will display an error until the docs builds have been completed.

❌ You can merge normally! (9 Unrelated Failures), 4 Unclassified Failures

As of commit dd72247 with merge base 1979118 (image):

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@linux-foundation-easycla

linux-foundation-easycla Bot commented May 9, 2026 •

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

@naromero77amd naromero77amd changed the title Make Inductor warp-size handling device-aware [ROCm][inductor] Make Inductor warp-size handling device-aware May 9, 2026
@pytorch-bot pytorch-bot Bot added the module: rocm AMD GPU support for Pytorch label May 9, 2026
@naromero77amd
naromero77amd force-pushed the rocm-remove-hardcoded-warp-sizes branch from 4750ec0 to 96b8fe7 Compare May 9, 2026 00:31
@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@claude explain those CI failures

@claude

claude Bot commented May 15, 2026 •

Copy link
Copy Markdown

Claude finished @naromero77amd's task in 2m 1s —— View job


CI Failure Analysis

  • Review the PR code changes
  • Analyze the 6 "New Failures"
  • Analyze the "Unclassified Failures"
  • Provide summary and recommendations

Summary

There are two root causes for the CI failures. Both are directly introduced by this PR.


1. Lint Failure (RUFF F521 / FLAKE8 F521 + PYFMT)

File: torch/_inductor/codegen/cuda/device_op_overrides.py:58

The C++ source code template string contains curly braces ({ and }) as part of C++ syntax (e.g., do {, if (code != CUDA_SUCCESS) {), which conflict with Python's .format() call. The linter correctly flags this as an invalid format string (F521).

The problematic code:

source_codes = """
    #define CUDA_DRIVER_CHECK(EXPR)                    \\
    do {                                               \\
        CUresult code = EXPR;                          \\
        ...
    } while (0);
    ...
    func, gridX, gridY, gridZ, {warp_size}*numWarps, 1, 1, ...
""".format(warp_size=warp_size)

Python's .format() tries to interpret all {...} as format placeholders. The C++ braces cause the parse error.

Fix: You need to either:

  • Escape all C++ braces by doubling them ({ → {{, } → }}), or
  • Use string concatenation / f-string with the warp_size value inserted only in the relevant line, or
  • Use the previous .replace() approach (which is what was used before this PR)

There's also a minor PYFMT warning in torch/_inductor/runtime/hints.py — after removing the _NUM_THREADS_PER_WARP constant, a blank line is missing before class HeuristicType. This is an auto-fixable formatting issue (lintrunner -a).


2. Inductor Test Failures (All 5 GPU test jobs + Unclassified ones)

Root cause: _get_current_warp_size() calls torch.cuda.current_device() inside a forked subprocess, which triggers:

RuntimeError: Cannot re-initialize CUDA in forked subprocess. 
To use CUDA with multiprocessing, you must use the 'spawn' start method

The stack trace shows:

triton_heuristics.py:3110, in triton_config
    min_elem_per_thread * _get_current_warp_size() * num_warps,
triton_heuristics.py:2987, in _get_current_warp_size
    return torch.cuda.get_device_properties(torch.cuda.current_device()).warp_size
torch/cuda/__init__.py:1201, in current_device
    _lazy_init()
RuntimeError: Cannot re-initialize CUDA in forked subprocess.

The Inductor compile worker (subproc_pool.py) uses forked child processes. In these forked children, CUDA cannot be re-initialized, so calling torch.cuda.current_device() fails. The old code used the constant _NUM_THREADS_PER_WARP = 32, which didn't require a CUDA call at runtime.

Fix: The _get_current_warp_size() function cannot call torch.cuda.get_device_properties() at the point where it's used (inside triton_config() which runs in compile workers). You need to pass the warp size through the compile metadata or resolve it before forking. Some options:

  1. Accept the warp size as a parameter to triton_config() / _check_max_grid_x() (threaded from the parent process).
  2. Cache the warp size in a module-level variable that gets set before any forking occurs.
  3. Use DeviceProperties which is already passed around in some places (e.g., device_props.warp_size in autotune_hints_to_configs).

Unclassified Failures

  • test_hipify_aoti_driver_header — Likely related to the device_op_overrides.py format string issue (the C++ driver code is malformed due to the broken .format() call, causing hipify tests to fail).
  • "Cannot re-initialize CUDA in forked subprocess" failures across multiple jobs (NVIDIA, ROCm, etc.) — Same root cause as Don't support legacy Python #2.
  • Other failures (cutlass, flex_attention, triton-cpu strided blocks, linalg, replicate_on_devices) — These appear to be pre-existing trunk failures unrelated to this PR, as noted by DrCI ("this job did not run on the merge base").

Recommendations

  1. For the format string issue: Replace .format(warp_size=warp_size) with either an f-string approach on just the relevant line, or revert to .replace("{warp_size}*numWarps", f"{warp_size}*numWarps").

  2. For the subprocess issue: The warp size needs to be resolved before forking into compile workers. Consider passing it through compile_meta or triton_config's parameters, similar to how device_props is already threaded through autotune_hints_to_configs.

  3. Run lintrunner -a to fix the minor formatting issue in hints.py.


@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@pytorchbot fix-lint

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully applied lint patches in https://github.com/pytorch/pytorch/actions/runs/25944330377. Please pull locally before pushing more changes.

@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased rocm-remove-hardcoded-warp-sizes onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout rocm-remove-hardcoded-warp-sizes && git pull --rebase)

@pytorchmergebot
pytorchmergebot force-pushed the rocm-remove-hardcoded-warp-sizes branch from e961780 to f454fa3 Compare May 15, 2026 22:30
@naromero77amd
naromero77amd force-pushed the rocm-remove-hardcoded-warp-sizes branch from 10f5c2b to 8f5db0f Compare May 26, 2026 20:37
@naromero77amd
naromero77amd requested review from aorenste, eellison, jansel and jataylo and removed request for aorenste May 27, 2026 15:03
@naromero77amd
naromero77amd marked this pull request as ready for review May 27, 2026 15:05
@naromero77amd
naromero77amd marked this pull request as draft May 27, 2026 15:33
@naromero77amd
naromero77amd force-pushed the rocm-remove-hardcoded-warp-sizes branch from 8f5db0f to e9864c3 Compare May 27, 2026 19:29
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 3 jobs have failed, first few of them are: xpu / win-vs2022-xpu-n-py3 / build, xpu / win-vs2022-xpu-n-1-py3 / build, xpu / linux-noble-xpu-n-py3.10 / test (default, 9, 12, linux.idc.xpu)

Details for Dev Infra team Raised by workflow job

@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@claude is it safe to merge this PR?

@claude

claude Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Claude finished @naromero77amd's task in 1m 14s —— View job


Is it safe to merge?

  • Pull current CI status (commit dd72247)
  • Check the previously-regressing triton-cpu tests (the autorevert cause)
  • Triage remaining failures
  • Verdict

Verdict: Yes, safe to merge from a CI standpoint.

Most importantly, the regression that triggered the June 12 autorevert is now fixed. That revert was caused by the triton-cpu split-reduction tests (test_2d_reduction_odd_shapes_view_size1, test_2d_welford_reduction_size1) generating 1 kernel instead of 2, because reduction_split_factor returned 1 on CPU when warp_size is None. Commit dd72247 fixed that by using DeviceProperties.warp_size_or_default (falls back to 32 on CPU, stays strict on CUDA/HIP). The proof it worked: the inductor workflow — which runs the inductor-triton-cpu shard — is now green ✅.

The jobs that actually validate this PR's warp-size behavior all pass:

  • ✅ rocm-mi300, inductor-rocm-mi300 (the platforms this PR targets)
  • ✅ inductor (incl. the triton-cpu shard that caused the revert)
  • ✅ Lint, BC Lint, trunk, TSan, docs-build, Limited CI for CUTLASS backend on H100

Remaining red checks — all pre-existing / unrelated

Workflow Cause PR-related?
Limited CI on H100 (x2) test_max_autotune_addmm_persistent_tma: Unregistered range symbol: yindex — persistent-TMA template codegen bug. Has appeared on every run for weeks. No
xpu Failing shards are the DrCI-listed disabled/flaky tests (test_aot_inductor xpu cases, test_conv_large, test_decomp, test_multiprocessing) + a separate Windows XPU build-infra failure. None touch warp-size code. No
B200 Smoke Tests test_conv2d_backward...: CUDA illegal memory access on sm100 hardware. Recurring B200 driver issue. No
torchtitan-test pip dependency / network failure + known broken-trunk torchtitan step. No (infra)
pull The one failed leaf was the crossref cpp/test_jit job, which DrCI marks as flaky-on-trunk. No

DrCI's own classification agrees: "You can merge normally! (10 Unrelated Failures)."

Caveat

The earlier @pytorchbot merge (June 13) failed only because the merge bot won't auto-ignore the XPU build/test failures. Since those are confirmed unrelated (disabled tests + infra), you'll likely need @pytorchbot merge -i to land it, as you did on June 12. Everything that gates correctness for this PR is green.
• branch: rocm-remove-hardcoded-warp-sizes

@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@claude analyze the merge failure and let me know if this PR can be safely merged?

@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -i

@claude

claude Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Claude finished @naromero77amd's task in 49s —— View job


Merge failure analysis

  • Pull current CI status (commit dd72247)
  • Identify which checks blocked the merge
  • Triage whether they are PR-related
  • Verdict on merge safety

Why the June 13 @pytorchbot merge failed

It was not a code regression. The merge bot rejected the land because 3 non-ignored checks were red:

xpu / win-vs2022-xpu-n-py3 / build
xpu / win-vs2022-xpu-n-1-py3 / build
xpu / linux-noble-xpu-n-py3.10 / test (default, 9, 12, linux.idc.xpu)

A plain @pytorchbot merge (no -i) will not auto-ignore these. The two Windows XPU build jobs are a build-infra failure, and the linux XPU shard is one of the DrCI-listed disabled/flaky tests. None touch warp-size code. This is the same reason your June 12 land needed merge -i.

Current CI (commit dd72247): 11 passed, 6 failed

The jobs that actually validate this PR's behavior are all green:

  • ✅ rocm-mi300, inductor-rocm-mi300 — the platforms this PR targets
  • ✅ inductor — includes the inductor-triton-cpu shard that caused the June 12 autorevert (the reduction_split_factor fix in dd72247 holds)
  • ✅ Lint, BC Lint, trunk, TSan, docs-build, Limited CI for CUTLASS backend on H100

The 6 red workflows are all pre-existing / infra, none in any warp-size path:

Workflow Cause PR-related?
Limited CI on H100 (x2) test_max_autotune_addmm_persistent_tma: Unregistered range symbol: yindex — persistent-TMA template codegen bug, present on every run for weeks No
xpu Windows XPU build-infra failure + DrCI-listed disabled/flaky tests (test_aot_inductor xpu cases, test_conv_large, test_decomp, test_multiprocessing) No
B200 Smoke Tests test_conv2d_backward: CUDA illegal memory access on sm100 hardware — recurring B200 driver issue No
torchtitan-test pip dependency / network failure + known broken-trunk step No (infra)
pull Failed leaf is crossref cpp/test_jit, which DrCI classifies as flaky-on-trunk No

DrCI's own banner agrees: "You can merge normally! (10 Unrelated Failures)."

Verdict: Yes, safe to merge

Everything that gates correctness for this PR is green, including the triton-cpu shard whose regression triggered the earlier autorevert — that fix is confirmed working. The red checks are pre-existing trunk bugs and infra/hardware issues unrelated to the warp-size changes.

To actually land it: use @pytorchbot merge -i (the -i flag ignores the unrelated XPU build/test failures). A plain @pytorchbot merge will keep failing on those same 3 XPU checks, since the bot won't auto-ignore them.

@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Can't merge closed PR #183014

pytorchmergebot pushed a commit to Isalia20/pytorch that referenced this pull request Jun 15, 2026
…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.

### Validation

- 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
apakbin pushed a commit to apakbin/pytorch that referenced this pull request Jun 16, 2026
…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.

### Validation

- 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
pragupta pushed a commit to ROCm/pytorch that referenced this pull request Jul 8, 2026
## Summary
- Backports upstream PyTorch PR pytorch#181112 to unify Inductor warp-size
plumbing and make HIP wave32 devices avoid the Wave64 num_warps halving
path.
- Backports upstream PyTorch PR pytorch#183014 to make missing CUDA/HIP
warp-size metadata explicit and preserve non-GPU fallback behavior.
- Resolves release/2.12 conflicts by preserving ROCm release branch
structure while applying the upstream warp-size behavior.

## Test plan
- `python -m py_compile` on all changed Python files
- `git diff --check origin/release/2.12...HEAD`
- IDE lints: no errors
- Not run: focused runtime unit tests, because the checkout is not
built/generated enough for local `torch.version`

---------

Co-authored-by: Bin Bao <[email protected]>
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…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.

### Validation

- 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
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…pytorch#183014)"

This reverts commit fe3ca45.

Reverted pytorch#183014 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](pytorch#183014 (comment)))
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…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.

### Validation

- 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
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…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.

### Validation

- 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
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…pytorch#183014)"

This reverts commit fe3ca45.

Reverted pytorch#183014 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](pytorch#183014 (comment)))
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…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.

### Validation

- 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
pablo-garay pushed a commit to ROCm/pytorch that referenced this pull request Jul 29, 2026
…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)
Signed-off-by: pablo-garay <[email protected]>
jithunnair-amd pushed a commit to ROCm/pytorch that referenced this pull request Jul 31, 2026
…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)
Signed-off-by: pablo-garay <[email protected]>
jithunnair-amd pushed a commit to ROCm/pytorch that referenced this pull request Jul 31, 2026
…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)
Signed-off-by: pablo-garay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/b200 ciflow/h100 ciflow/inductor ciflow/inductor-rocm-mi300 Trigger "inductor" config CI on ROCm MI300/MI325 ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request ciflow/xpu Run XPU CI tasks Merged module: inductor module: rocm AMD GPU support for Pytorch open source release notes: inductor Reverted triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

8 participants