mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #139] [ROCm] Add gfx12 INT8 WMMA GEMM schedule and fused INT8 ops for Z-Image #167
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#167
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/139
Author: @tvukovic-amd
Created: 8/27/2026
Status: 🔄 Open
Base:
main← Head:hip-gfx12x-native-attention📝 Commits (10+)
6a94830Add native gfx12 HIP attention and Z-Image INT8 fusionsf8ef6fcAddress review feedback for gfx12 HIP kernelseb6270freslve code rabbit review commentse70bc08Merge branch 'main' into hip-gfx12x-native-attention638e94cUse atomic WMMA state snapshots, scope ConvRot capability checks to the input device, and preserve float32 validation for HIP attention scales.99ff431Fix WMMA races and validate attention scales8f0b518Fix WMMA races and validate attention scalesba44363Fix Ruff lint71c5a34hip: enable native gfx1170 attention and GEMM schedules9518b7eMerge branch 'main' into hip-gfx12x-native-attention📊 Changes
25 files changed (+4133 additions, -96 deletions)
View changed files
📝
comfy_kitchen/__init__.py(+228 -0)📝
comfy_kitchen/backends/eager/__init__.py(+79 -0)📝
comfy_kitchen/backends/eager/quantization.py(+150 -0)➕
comfy_kitchen/backends/eager/residual.py(+18 -0)📝
comfy_kitchen/backends/hip/CMakeLists.txt(+2 -0)📝
comfy_kitchen/backends/hip/__init__.py(+727 -36)➕
comfy_kitchen/backends/hip/device_arch.h(+45 -0)📝
comfy_kitchen/backends/hip/dlpack_bindings.cpp(+279 -14)📝
comfy_kitchen/backends/hip/epilogue.h(+14 -0)📝
comfy_kitchen/backends/hip/gemm_wmma.h(+518 -10)📝
comfy_kitchen/backends/hip/hadamard.h(+491 -1)📝
comfy_kitchen/backends/hip/launchers.h(+21 -0)📝
comfy_kitchen/backends/hip/mma.h(+1 -1)📝
comfy_kitchen/backends/hip/ops/gemm_int8.hip(+169 -1)📝
comfy_kitchen/backends/hip/ops/quantize_int8.hip(+91 -10)➕
comfy_kitchen/backends/hip/ops/rms_convrot_quant.hip(+35 -0)➕
comfy_kitchen/backends/hip/ops/rms_gated_residual.hip(+180 -0)📝
comfy_kitchen/backends/hip/ops/rms_rope.hip(+215 -6)📝
comfy_kitchen/backends/hip/rope_math.h(+23 -0)➕
comfy_kitchen/backends/hip/swiglu_bf16.h(+41 -0)...and 5 more files
📄 Description
Summary
Adds INT8 WMMA GEMM optimizations for gfx12 and fused INT8 operations for accelerated Z-Image Turbo inference.
Key changes
Fused INT8 operations (new public APIs)
int8_linear_modulatedandint8_linear_rms_modulated: ConvRot quantization fused with modulation (and RMSNorm), then an INT8 GEMM.int8_linear_pair,int8_linear_pair_modulatedandint8_linear_pair_rms_modulated: two projections that share one quantized activation.int8_linear_swiglu_split: SwiGLU fused with quantization for the FFN down projection.rms_gated_residual: RMSNorm, gate and residual add in one kernel.fused_rms_modulatedandfused_swiglu_ffnon the INT8 quantized-tensor layout, used by the ComfyUI integration.INT8 GEMM and quantization
device_arch.h) that checks for the non-duplicated WMMA layout.Compatibility
launch_gemm_wmmatile selection. Unsupported devices, batched modulation and modulation without a norm returnNotImplementedand use the existing fallbacks.Required ComfyUI integration
This PR pairs with https://github.com/Comfy-Org/ComfyUI/pull/16674, which adds the Z-Image fusion integration, the attention command-line options and Dynamic VRAM handling. Both are needed to reproduce the benchmark below.
Testing
Tested on AMD Radeon RX 9070 XT (Navi 48, gfx1201, 16 GB), Ubuntu 24.04.2 LTS with https://github.com/Comfy-Org/ComfyUI/pull/16674's head.
Result: 751 passed, 47 skipped, 3 failed. The three failures (
test_rope_matches_eager[freqs_dtype1-True],test_rope_matches_eager[freqs_dtype2-True],test_int8_linear_correctness[hip]) also fail on the base branch, so this PR doesn't introduce them.Z-Image Turbo benchmark (gfx1201)
Protocol: 1024×1024, 8 steps, batch size 1, Dynamic VRAM on. One warmup and five timed runs per row. Values are the median end-to-end workflow throughput over the five runs. The baseline is BF16 + AOTriton.
Big thanks to @jammm for contribution!
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.