Skip to content

[ROCm] Add initial GFX1250 architecture support - #188565

Closed
glen-amd wants to merge 7 commits into
pytorch:mainfrom
glen-amd:initial_amd_gfx1250_support_3
Closed

glen-amd wants to merge 7 commits into
pytorch:mainfrom
glen-amd:initial_amd_gfx1250_support_3

Conversation

@glen-amd

@glen-amd glen-amd commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Initial, gate-only enablement for AMD gfx1250 (Wave32). PyTorch learns to recognize the arch and routes it onto Wave32-safe paths (hipBLASLt GEMM, scaled/MX-format GEMM, shared-memory and workspace sizing). Every currently Wave64-only path (CK GEMM/SDPA, rocSHMEM collectives, int4mm MFMA kernels) is explicitly rejected or auto-disabled so it fails at the capability check instead of miscompiling or crashing at launch. No new kernels; unavailable features (AOTriton image, CK FAv3/AITER attention) are left disabled with documented TODOs.

Why gate-only

gfx1250 isn't a drop-in arch-list addition: it's Wave32 (vs. Wave64), uses WMMA/SWMMAC (vs. MFMA) matrix intrinsics, and has no published AOTriton/CK artifacts yet. This PR lands the correct detection/gating foundation so existing safe paths work today and feature PRs can build on it.

Out of scope (by design)

  • AMD Tensor Data Mover (TDM) / persistent-MM inductor work.
  • AOTriton gfx1250 image (slot added, commented TODO; build from source if needed).
  • CK kept off for gfx1250 (XDL/MFMA/Wave64 → needs WMMA).
  • Flash / mem-efficient attention (no artifacts yet).

What's enabled vs. rejected

Enabled on gfx1250 (ROCm ≥ 7.2) Rejected / auto-disabled
hipBLASLt GEMM, 128 MiB workspace CK GEMM / grouped-GEMM (Wave64)
scaled-mm + MX-format (e8m0fnu) shape checks CK SDPA flash / mem-efficient attention
hipSparseLt, MSLK fp8-grouped-GEMM int4mm (_weight_int4pack_mm, Wave64 MFMA)
320 KB shared-mem limit, allocator/workspace rocSHMEM AllToAllv (Wave64-only)

Key changes

  • Detection/test gating: CDNA5OrLater() + nested CDNA{2,3}OrLater; GFX1250_ARCH; fp8/MX gating; arch-suffix stripping (gfx1250:sramecc+ → gfx1250).
  • BLAS: gfx1250 added to hipBLASLt preferred archs, scaled-mm allow-list, MX shape checks, 128 MiB workspace (all ROCm ≥ 7.2).
  • Build: CK GEMM isolated into a dedicated ck_gemm target with HIP_ARCHITECTURES filtered to gfx90a/942/950; auto-disable on gfx1250-only builds; AOTriton slot as TODO.
  • Reject-not-crash: check_ck_sdpa_hardware_support() (SDPA), checkWave64Device() (rocSHMEM), isCDNA5orLater() (int4mm) all reject gfx1250 up front.
  • Wave32 safety: gfx942 Wave64 fast paths in CUDALoops.cuh/MemoryAccess.cuh documented as non-portable; gfx1250 uses the generic path.
  • CI/tests: gfx1250 added to PYTORCH_ROCM_ARCH, runners registered, test_cuda.py/test_linalg.py gating updated.

Design rules

Advertise only what the runtime honors (ROCm 7.2 gates) · fail at capability check, not launch · auto-disable cleanly in mixed-arch builds · document the why for every omission.

Follow-ups (TODOs in-tree)

AOTriton gfx1250 image → attention · CK FAv3/AITER (Wave32/WMMA) · WMMA int4mm & CK GEMM · wave-size-aware rocSHMEM · retune elementwise fast paths for Wave32.

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

glen-amd added 6 commits June 29, 2026 17:52
Recognize gfx1250 (CDNA5, Wave32) across arch-detection helpers and test
gating: CDNAxOrLater helpers, device-arch checks, and warp-size aware test
utilities. Strips arch feature suffixes (e.g. gfx1250:sramecc+) before
comparison.

Co-authored-by: Glen Cao <[email protected]>
Enable gfx1250 paths in scaled/grouped GEMM, int4mm, sparse cuSPARSELt,
and CUDA loop/memory-access helpers; add gfx1250 to allocator config.

Co-authored-by: Glen Cao <[email protected]>
Gate CK GEMM/SDPA, MSLK, and rocSHMEM so unsupported archs auto-disable
based on PYTORCH_ROCM_ARCH; reject CK SDPA on gfx1250 at the capability
check until FAv3/AITER artifacts ship. Leave the gfx1250 AOTriton image
commented as a TODO (no mainline AOTriton image yet) and add CI/lint
plumbing.

Co-authored-by: Glen Cao <[email protected]>
Validate M/N multiples of 16 and K multiple of 128 for MX (e8m0fnu)
scaled GEMM on gfx1250, gated on ROCM_VERSION >= 70200. Mirrors the
existing gfx950 check.

Co-authored-by: Glen Cao <[email protected]>
Extend the 128MiB default workspace arch list to include gfx125x,
matching gfx94x/gfx95x.

Co-authored-by: Glen Cao <[email protected]>
@pytorch-bot

pytorch-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

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

@pytorch-bot pytorch-bot Bot added ciflow/b200 ciflow/docker ciflow/h100 ciflow/h100-symm-mem ciflow/inductor ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/torchtitan Run TorchTitan integration tests module: inductor module: rocm AMD GPU support for Pytorch release notes: releng release notes category labels Jun 30, 2026
@pytorch-bot

pytorch-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:

  • ciflow/inductor
  • ciflow/rocm-mi300
  • ciflow/h100
  • ciflow/h100-symm-mem
  • ciflow/b200
  • ciflow/torchtitan
  • ciflow/docker

Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows.

1 similar comment
@pytorch-bot

pytorch-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:

  • ciflow/inductor
  • ciflow/rocm-mi300
  • ciflow/h100
  • ciflow/h100-symm-mem
  • ciflow/b200
  • ciflow/torchtitan
  • ciflow/docker

Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants