mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #200] [CLOSED] [HIP] Add software tiled GEMM support to older HIP architectures (RDNA1 and Vega) #220
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-kitchen#220
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/200
Author: @Zakhrov
Created: 9/25/2026
Status: ❌ Closed
Base:
main← Head:hip-bringup📝 Commits (10+)
9507848Add support for gfx90c and gfx1010 GPU architectures and optimize flash decode kernele0075dfRefactor HIP backend for Sage attention kernels and enhance testing83f53c3Update error message for wave32 requirement5e0ffefRefactor tests and improve code readabilityda75655Merge branch 'Comfy-Org:main' into main54f400bFix failing tests on gfx90ca4cd6c0Update README to reflect gfx90c and gfx1010 support3750a88Enable software GEMM tiling and attention for Vega, RDNA1 and RDNA27c226c3Refactor HIP backend for Sage attention kernels and enhance testinga9030efMerge branch 'Comfy-Org:main' into main📊 Changes
67 files changed (+5276 additions, -1156 deletions)
View changed files
📝
README.md(+237 -14)📝
comfy_kitchen/__init__.py(+73 -6)📝
comfy_kitchen/backends/cuda/__init__.py(+11 -1)📝
comfy_kitchen/backends/eager/__init__.py(+20 -1)📝
comfy_kitchen/backends/eager/conv3d.py(+35 -13)📝
comfy_kitchen/backends/eager/quantization.py(+40 -3)📝
comfy_kitchen/backends/eager/sol_attn.py(+7 -3)📝
comfy_kitchen/backends/hip/CMakeLists.txt(+31 -3)📝
comfy_kitchen/backends/hip/__init__.py(+613 -99)📝
comfy_kitchen/backends/hip/architecture_config.h.in(+13 -0)📝
comfy_kitchen/backends/hip/architectures.json(+7 -1)📝
comfy_kitchen/backends/hip/dlpack_bindings.cpp(+261 -11)📝
comfy_kitchen/backends/hip/epilogue.h(+14 -0)➕
comfy_kitchen/backends/hip/gemm_simt.h(+694 -0)📝
comfy_kitchen/backends/hip/gemm_wmma.h(+2 -1)📝
comfy_kitchen/backends/hip/hadamard.h(+71 -21)📝
comfy_kitchen/backends/hip/mma.h(+218 -58)📝
comfy_kitchen/backends/hip/ops/conv3d_fp16.hip(+139 -9)📝
comfy_kitchen/backends/hip/ops/convrot_w4a4.hip(+8 -1)📝
comfy_kitchen/backends/hip/ops/flash_decode.hip(+6 -1)...and 47 more files
📄 Description
This PR supersedes #185, and extends the HIP backend from its current RDNA2+ scope to validated Vega (
gfx900,gfx906,gfx90c) and RDNA1 (gfx1010–gfx1012) targets.The key point is that this is not a claim that these devices have WMMA/matrix-core hardware. They do not. Instead, the backend provides a software 16×16 tile policy that preserves the fragment contract used by the supported HIP kernels:
sdot4.That distinction lets us expand compatibility without changing the fast path or capability assumptions on newer hardware.
Why this matters
AMD has restored Rocm support for Vega/GCN5, and has brought full RDNA 1 support starting with Rocm 10.2 as shown here: https://github.com/ROCm/TheRock/blob/main/SUPPORTED_GPUS.md
While Vega and RDNA1 / RDNA2 don't have hardware level WMMA instructions, they are still perfectly capable of AI inference workloads and are currently only VRAM constricted when it comes to larger models, and the usual CUDA tricks of using Sageattention don't work on them for reducing VRAM usage.
This implementation aims to close that parity.
Falling through to eager attention has particularly poor memory behavior for long contexts:
(B, H, T, T)score tensor and associated intermediate tensors;Sol-Attn still has compact block-level quadratic routing storage, so this is not a claim of strictly linear memory. It is, however, a major reduction versus token-level FP32 quadratic score storage and makes long-context execution realistic on legacy AMD GPUs.
Scope and safety
The change is deliberately narrow and fail-closed:
The dispatch tests cover the architecture grouping and ensure the software-tile targets advertise only the intended capabilities.
pytest -q tests/test_hip_dispatch.pypasses (67 passed, 2 skipped).Expected tradeoff
This is a compatibility and memory-efficiency improvement, not a promise that Vega/RDNA1 will match RDNA3+ throughput. Software-tile attention will be slower than native WMMA. But the alternative is often eager execution with substantially higher peak VRAM, or no practical long-context execution at all.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.