Skip to content

[ROCm] Disable CK GEMM/SDPA when gfx1250 is the only arch - #190683

Closed
ethanwee1 wants to merge 2 commits into
pytorch:mainfrom
ethanwee1:ethanwee/fix-gfx1250-ck-gemm-upstream
Closed

ethanwee1 wants to merge 2 commits into
pytorch:mainfrom
ethanwee1:ethanwee/fix-gfx1250-ck-gemm-upstream

Conversation

@ethanwee1

@ethanwee1 ethanwee1 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When gfx1250 is the only arch in PYTORCH_ROCM_ARCH, disable
USE_ROCM_CK_GEMM in cmake/Dependencies.cmake before the
-DUSE_ROCM_CK_GEMM compile flag is added. composable_kernel has no gfx1250
support yet, so this ensures both the CK GEMM sources and their call sites
(guarded by USE_ROCM_CK_GEMM in CUDABlas.cpp / GroupedBlas.cpp) are
compiled out consistently. Doing this only in aten/src/ATen/CMakeLists.txt
excludes the sources but still defines USE_ROCM_CK_GEMM, leaving undefined
references to gemm_internal_ck at link time.

Scope / impact

  • Single-arch gfx1250-only builds: previously failed to link; this fixes them.
  • Multi-arch builds (e.g. gfx942 + gfx1250): unaffected. ck_gemm is still
    built as a separate library with gfx1250 filtered out of HIP_ARCHITECTURES,
    so CK GEMM stays enabled for the other archs.

Related

Validation

Validated via TheRock dev wheel builds for gfx1250 (single-arch and multi-arch,
Python 3.12, ROCm 7.15 nightly). Single-arch gfx1250-only builds link cleanly
with this change; multi-arch builds are unaffected.

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang

@pytorch-bot

pytorch-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

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

If PYTORCH_ROCM_ARCH is gfx1250-only, composable_kernel has no supported
arch for ck_gemm and CMake fails with empty HIP_ARCHITECTURES. Disable
USE_ROCM_CK_GEMM next to the existing gfx1250 ck_gemm filtering logic.

Per review on ROCm#3458.
@ethanwee1
ethanwee1 force-pushed the ethanwee/fix-gfx1250-ck-gemm-upstream branch from 0294c83 to c8443b5 Compare July 22, 2026 15:31
@ethanwee1

Copy link
Copy Markdown
Contributor Author

Updated per @jithunnair-amd's review on companion ROCm#3458:

  • Moved gfx1250-only guard next to existing `ck_gemm` arch filtering (instead of early in the file)
  • Simplified to `if(USE_ROCM AND "${PYTORCH_ROCM_ARCH}" STREQUAL "gfx1250")` and only disable `USE_ROCM_CK_GEMM` (SDPA already handled for unsupported archs)

Branch rebased on current `main`; diff is 1 file, +6 lines.

Disabling USE_ROCM_CK_GEMM in aten/src/ATen/CMakeLists.txt excluded the CK
GEMM source files but still left -DUSE_ROCM_CK_GEMM defined (it is emitted
earlier in cmake/Dependencies.cmake). The call sites in CUDABlas.cpp and
GroupedBlas.cpp are guarded by USE_ROCM_CK_GEMM, so they were still compiled
and linked against gemm_internal_ck/bgemm_internal_ck/group_gemm_ck, producing
undefined references at link time for gfx1250-only builds.

Move the gfx1250-only disable into cmake/Dependencies.cmake, before the
-DUSE_ROCM_CK_GEMM flag is added, so the sources and their call sites are
compiled out consistently.
ethanwee1 added a commit to ROCm/TheRock that referenced this pull request Jul 22, 2026
…6735)

JIRA ID : AIPYTORCH-804

## Summary

Enable `gfx125X-dcgpu` (gfx1250) in TheRock's PyTorch release matrix for
**`release/2.12`** and **`nightly`**, matching the existing
`release/2.11` behavior.

Previously, `configure_pytorch_release_matrix.py` filtered gfx1250 out
of those refs even though PyTorch now supports the arch:

- `release/2.12`: ROCm/pytorch#3421
- `nightly`: upstream pytorch/pytorch#188597 (via TheRock's upstream
nightly checkout)

## Changes

- Remove `gfx125X-dcgpu` from the unsupported-family filter for
`release/2.12` and `nightly` in `configure_pytorch_release_matrix.py`.

## Validation

Both the single-arch and multi-arch gfx1250 PyTorch wheel builds are
green with this matrix change (Python 3.12, ROCm `7.15.0a20260712`,
index `rocm.nightlies.amd.com/whl-multi-arch`,
`test_amdgpu_families=none`):

| Scenario | `amdgpu_families` | Run | Result |
|----------|-------------------|-----|--------|
| Single-arch (gfx1250 only) | `gfx125X-dcgpu` |
https://github.com/ROCm/TheRock/actions/runs/29936052631 | ✅ success |
| Multi-arch (gfx942 + gfx1250) | `gfx94X-dcgpu;gfx125X-dcgpu` |
https://github.com/ROCm/TheRock/actions/runs/29938470834 | ✅ success |

Notes:

- The **multi-arch** build (TheRock's production release/nightly path)
works on stock `release/2.12` and `main` because `ck_gemm` is built as a
separate library with gfx1250 filtered out of `HIP_ARCHITECTURES`;
gfx1250 falls back to hipBLASLt at runtime, and CK GEMM stays enabled
for gfx942/gfx950.
- The **single-arch** gfx1250-only case additionally requires the
CK-GEMM CMake fix in ROCm/pytorch#3458 (`release/2.12`) and
pytorch/pytorch#190683 (`main`/nightly). These are not required for the
multi-arch production builds.
@github-actions

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions Bot added the Stale label Sep 25, 2026
@ethanwee1 ethanwee1 closed this Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: rocm AMD GPU support for Pytorch open source Stale topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants