mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-05 07:47:40 +00:00
[PR #138] [CLOSED] HIP native BF16/INT8 attention and gfx12 INT8 inference stack for AMD ROCm #170
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#170
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/138
Author: @tvukovic-amd
Created: 8/25/2026
Status: ❌ Closed
Base:
main← Head:hip-gfx117x-gfx12x-native-attention📝 Commits (6)
44fa296Expose Kitchen HIP BF16/INT8 attention flags so AMD ROCm can select native gfx12 kernels without Sage or Flashec33fa2Gate gfx12 long-BF16 SDPA off WMMA and pack INT8 attention into one workspace38273d9Enable gfx12 long-seq HIP BF16 attention without an SDPA support gate6dcf2c2Restore row-major INT8 projection packing policy.95a0f93Remove unused HIP attention launches and a dead INT8 tile_k arm.96aeebcKeep branch INT8 GEMM tile selection for Navi 4 perf after upstream rebase📊 Changes
29 files changed (+8149 additions, -122 deletions)
View changed files
📝
comfy_kitchen/__init__.py(+273 -0)📝
comfy_kitchen/backends/eager/__init__.py(+95 -0)📝
comfy_kitchen/backends/eager/quantization.py(+282 -0)➕
comfy_kitchen/backends/eager/residual.py(+18 -0)📝
comfy_kitchen/backends/hip/CMakeLists.txt(+9 -0)📝
comfy_kitchen/backends/hip/__init__.py(+1342 -23)📝
comfy_kitchen/backends/hip/dlpack_bindings.cpp(+722 -3)📝
comfy_kitchen/backends/hip/epilogue.h(+45 -0)📝
comfy_kitchen/backends/hip/gemm_wmma.h(+723 -23)📝
comfy_kitchen/backends/hip/hadamard.h(+688 -8)📝
comfy_kitchen/backends/hip/launchers.h(+95 -0)📝
comfy_kitchen/backends/hip/mma.h(+5 -4)➕
comfy_kitchen/backends/hip/ops/attention_bf16.hip(+499 -0)📝
comfy_kitchen/backends/hip/ops/gemm_int8.hip(+358 -1)📝
comfy_kitchen/backends/hip/ops/quantize_int8.hip(+157 -19)➕
comfy_kitchen/backends/hip/ops/rms_convrot_quant.hip(+43 -0)➕
comfy_kitchen/backends/hip/ops/rms_gated_residual.hip(+183 -0)📝
comfy_kitchen/backends/hip/ops/rms_rope.hip(+215 -6)📝
comfy_kitchen/backends/hip/sage_attention/int8_attn.hip(+413 -0)📝
comfy_kitchen/backends/hip/sage_attention/quant_qk_int8.hip(+423 -16)...and 9 more files
📄 Description
Summary
Adds native HIP attention and a gfx12 INT8+BF16 inference stack for AMD ROCm (RDNA4 / non-duplicated WMMA), so diffusion models can use Comfy Kitchen on gfx12 without SageAttention or FlashAttention.
Attention
attention_bf16.hipand Python exports:hip_attention,hip_attention_is_supportedhip_int8_attention/hip_int8_attention_is_supportedINT8 linear / GEMM (Navi 4 perf)
launch_int8()with shape-specific paths (dual-M for Z-Image projection shapes, cooperative staging, BKB=64 defaults)#122; INT8 does not use upstreamlaunch_gemm_wmma()— that helper remains for fp8 onlygemm_wmma.hmerges upstream#122infra (device_wgp_count, fp8 launcher) with branch epilogues and dual-M kernelsSupporting inference ops
tensor/int8.py), sage Q/K/V quant updates, eager fallbacksTests
tests/test_int8_attention.py, updates totest_hip_wmma.py,test_int8.py,test_hip_dispatch.pyThe diff is large because HIP kernels and the full gfx12 dispatch surface are verbose by nature; this is the perf-validated stack, not unrelated refactors.
Pair PR (ComfyUI): Adds
--use-kitchen-bf16-attentionand--use-kitchen-int8-attentionrouting to these APIs.Target hardware
Test plan
pytest tests/test_int8_attention.py(gfx12 markers) on ROCmpytest tests/test_hip_wmma.py -k gfx12— dual-M, modulated QKV exactness--use-kitchen-bf16-attention/--use-kitchen-int8-attentionNotes for reviewers
launch_int8()keeps explicit gfx12 tile selection (including dual-M for512 × 3840 × {3840,11520,10240}) rather than delegating to upstreamlaunch_gemm_wmma().main(includes#122); conflict resolution preserved Navi 4 INT8 paths while keeping fp8 on shared upstream launcher.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.