mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #262] Optimize HIP SVDQuant W4A4 kernels #266
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#266
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/262
Author: @0xDELUXA
Created: 10/19/2026
Status: 🔄 Open
Base:
main← Head:amd/hip-svdquant-perf📝 Commits (1)
08216d9Optimize HIP SVDQuant W4A4 kernels📊 Changes
4 files changed (+305 additions, -81 deletions)
View changed files
📝
comfy_kitchen/backends/hip/__init__.py(+6 -1)📝
comfy_kitchen/backends/hip/mma.h(+17 -0)📝
comfy_kitchen/backends/hip/ops/svdquant_w4a4.hip(+251 -79)📝
tests/test_hip_wmma.py(+31 -1)📄 Description
Brings the HIP SVDQuant W4A4 path from below bf16 matmul speed to 1.1-2.1x faster than it at Flux-sized shapes, by restructuring its three kernels around how RDNA hides latency.
The LoRA-down now runs on the WMMA GEMM core (
MmaBf16gains the core'sload, asMmaF16already has), so the quantized paths still never reach hipBLASLt; fp32 inputs, and GPUs without matrix cores, use a small LDS-tiled kernel. The quantizer uses one wave per row with two elements per lane, as the CUDA kernel does. The GEMM stages each tile's activation and weight scales into LDS as fp32 alongside the tile, so the per-group flush reads them from LDS, and the LoRA-up correction reads its operands from LDS in rank chunks.Measured on gfx1200, bf16, rank 32. Times are quantize plus GEMM.
The LoRA-down is within 10% of
torch.mm.Outputs match the previous kernels except for activation codes sitting on a rounding boundary, about 3 in 1e5 elements, where both are equally close to an fp64 reference.
test_svdquant_w4a4_beats_eager_against_fp32_truthgains a case with a multi-chunk rank, partial N tile and an odd group count. Compile-verified for gfx1030, gfx1100 and gfx1200. Run-verified on gfx1200 only.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.