Fix non-contiguous inputs in fused RoPE - #334
Merged
Merged
Conversation
albmalamd
marked this pull request as ready for review
June 25, 2026 13:09
pragupta
approved these changes
Jun 29, 2026
Collaborator
|
@albmalamd Please fill out the Test Plan and Rest Results sections. |
This was referenced Jul 1, 2026
pragupta
pushed a commit
that referenced
this pull request
Jul 1, 2026
pragupta
pushed a commit
that referenced
this pull request
Jul 1, 2026
pragupta
pushed a commit
that referenced
this pull request
Jul 1, 2026
This was referenced Jul 3, 2026
albmalamd
added a commit
to ROCm/pytorch
that referenced
this pull request
Jul 3, 2026
Update the apex pinned commit in related_commits from 7e4aca3 to ad1376f2 on the ROCm apex release/1.12.0 branch. This release tracks only a single ubuntu apex line. This bump brings in a cherry-pick of ROCm/apex PR #334 (ROCm/apex#334), which fixes non-contiguous inputs in the fused RoPE aiter backend by enforcing last-dim contiguity at the apex/aiter boundary (fixing the "rope_2d_bwd_impl requires all stride_d to be 1" crash on transposed inputs and broadcast/expanded gradients). This is purely a dependency pin update to pull in the fix, not a PyTorch code change. Test Plan: Metadata-only change to the related_commits pin file; no build or test run. Verified the diff updates only the apex line. Authored-with: Claude (Anthropic AI assistant).
albmalamd
added a commit
to ROCm/pytorch
that referenced
this pull request
Jul 3, 2026
Update the apex pinned commit in related_commits (ubuntu and centos) from 973a3632 to c0f56f7e on the ROCm apex release/1.11.0 branch. This bump brings in a cherry-pick of ROCm/apex PR #334 (ROCm/apex#334), which fixes non-contiguous inputs in the fused RoPE aiter backend by enforcing last-dim contiguity at the apex/aiter boundary (fixing the "rope_2d_bwd_impl requires all stride_d to be 1" crash on transposed inputs and broadcast/expanded gradients). This is purely a dependency pin update to pull in the fix, not a PyTorch code change. Test Plan: Metadata-only change to the related_commits pin file; no build or test run. Verified the diff updates only the two apex lines. Authored-with: Claude (Anthropic AI assistant).
albmalamd
added a commit
to ROCm/pytorch
that referenced
this pull request
Jul 3, 2026
Update the apex pinned commit in related_commits (ubuntu and centos) from 57295015 to e97c6656 on the ROCm apex release/1.10.0 branch. This bump brings in a cherry-pick of ROCm/apex PR #334 (ROCm/apex#334), which fixes non-contiguous inputs in the fused RoPE aiter backend by enforcing last-dim contiguity at the apex/aiter boundary (fixing the "rope_2d_bwd_impl requires all stride_d to be 1" crash on transposed inputs and broadcast/expanded gradients). This is purely a dependency pin update to pull in the fix, not a PyTorch code change. Test Plan: Metadata-only change to the related_commits pin file; no build or test run. Verified the diff updates only the two apex lines. Authored-with: Claude (Anthropic AI assistant).
jithunnair-amd
pushed a commit
to ROCm/pytorch
that referenced
this pull request
Jul 3, 2026
## Summary Updates the apex pinned commit in `related_commits` for the ROCm apex `release/1.10.0` branch, from `57295015408696edf0d03ed09f6f17b42a0be2b6` to `e97c6656fb57d03e5fa48ad417853aa497f123ce` (both ubuntu and centos lines). This bump brings in a cherry-pick of ROCm/apex PR #334 (ROCm/apex#334), which fixes non-contiguous inputs in the fused RoPE aiter backend by enforcing last-dim contiguity at the apex/aiter boundary (fixing the "rope_2d_bwd_impl requires all stride_d to be 1" crash on transposed inputs and broadcast/expanded gradients). This is purely a dependency pin update to pull in the fix, not a PyTorch code change. ## Test plan - [ ] Metadata-only change to the `related_commits` pin file; CI validates apex builds against the new pin. Authored with the assistance of Claude (Anthropic AI assistant).
jithunnair-amd
pushed a commit
to ROCm/pytorch
that referenced
this pull request
Jul 3, 2026
## Summary Updates the apex pinned commit in `related_commits` for the ROCm apex `release/1.11.0` branch, from `973a363235cd056e9da83716aabdd2691df9e70a` to `c0f56f7eccd343a08a1b0d0be59f1e7e0e9b90b7` (both ubuntu and centos lines). This bump brings in a cherry-pick of ROCm/apex PR #334 (ROCm/apex#334), which fixes non-contiguous inputs in the fused RoPE aiter backend by enforcing last-dim contiguity at the apex/aiter boundary (fixing the "rope_2d_bwd_impl requires all stride_d to be 1" crash on transposed inputs and broadcast/expanded gradients). This is purely a dependency pin update to pull in the fix, not a PyTorch code change. ## Test plan - [ ] Metadata-only change to the `related_commits` pin file; CI validates apex builds against the new pin. Authored with the assistance of Claude (Anthropic AI assistant).
jithunnair-amd
pushed a commit
to ROCm/pytorch
that referenced
this pull request
Jul 3, 2026
## Summary Updates the apex pinned commit in `related_commits` for the ROCm apex `release/1.12.0` branch, from `7e4aca37812b99e9c3e302d7d1d2e37ad6377f8c` to `ad1376f20dc0ac107040b6077c96aed52bd14298`. This bump brings in a cherry-pick of ROCm/apex PR #334 (ROCm/apex#334), which fixes non-contiguous inputs in the fused RoPE aiter backend by enforcing last-dim contiguity at the apex/aiter boundary (fixing the "rope_2d_bwd_impl requires all stride_d to be 1" crash on transposed inputs and broadcast/expanded gradients). This is purely a dependency pin update to pull in the fix, not a PyTorch code change. ## Test plan - [ ] Metadata-only change to the `related_commits` pin file; CI validates apex builds against the new pin. Authored with the assistance of Claude (Anthropic AI assistant).
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.
Motivation
The aiter RoPE kernels require the head (last) dim to be unit-stride, but inputs
can arrive non-contiguous: transposed layouts in forward, and broadcast/expanded
gradients (e.g. from
.sum()) in backward.Technical Details
This enforces contiguity at the apex↔aiter boundary across all aiter RoPE variants
(standard, cached, THD, 2D), centralized in a single
_ensure_last_dim_contiguoushelper that copies only when
stride(-1) != 1, leaving outer strides untouched.Test Plan
Run the fused RoPE tests on ROCm with the aiter backend enabled, exercising the
standard, cached, THD, and 2D variants (covers transposed inputs and the
.sum()reduction loss that produces broadcast/expanded gradients):USE_ROCM_AITER_ROPE_BACKEND=1 APEX_TEST_WITH_ROCM=1 python tests/L0/run_transformer/test_fused_rope.pyTest Result
test_2d_forward_backwardaborts withRuntimeError: rope_2d_bwd_impl requires all stride_d to be 1.gradients match within tolerance.
Submission Checklist