mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
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#185
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/158
Author: @0xDELUXA
Created: 9/5/2026
Status: ✅ Merged
Merged: 9/5/2026
Merged by: @comfyanonymous
Base:
main← Head:amd/hip-sol-token-aug📝 Commits (3)
3497a01HIP port of #156: Sol-Attn token routingbf180fdKeep the HIP RoPE fp16 rounding from being folded away by -ffast-mathb99d220Run the shared test suites against the HIP backend📊 Changes
20 files changed (+921 additions, -163 deletions)
View changed files
📝
comfy_kitchen/__init__.py(+2 -2)📝
comfy_kitchen/backends/cuda/__init__.py(+1 -2)📝
comfy_kitchen/backends/hip/CMakeLists.txt(+1 -0)📝
comfy_kitchen/backends/hip/__init__.py(+14 -21)📝
comfy_kitchen/backends/hip/dlpack_bindings.cpp(+34 -25)📝
comfy_kitchen/backends/hip/launchers.h(+5 -5)📝
comfy_kitchen/backends/hip/rope_math.h(+8 -3)📝
comfy_kitchen/backends/hip/sage_attention/sol_attn.hip(+104 -33)📝
comfy_kitchen/backends/hip/sage_attention/sol_attn_exact.hip(+75 -25)📝
comfy_kitchen/backends/hip/sage_attention/sol_attn_producer.hip(+13 -3)📝
comfy_kitchen/backends/hip/sage_attention/sol_attn_route.hip(+59 -7)➕
comfy_kitchen/backends/hip/sage_attention/sol_attn_token.hip(+518 -0)📝
comfy_kitchen/backends/hip/sage_attention/sol_attn_vtranspose.hip(+12 -5)📝
comfy_kitchen/backends/hip/sage_attention/sol_common.h(+12 -0)📝
tests/conftest.py(+2 -2)📝
tests/test_adaln.py(+9 -9)📝
tests/test_hip_wmma.py(+12 -3)📝
tests/test_int8_input_act.py(+2 -2)📝
tests/test_rope.py(+9 -9)📝
tests/test_sol_attn.py(+29 -7)📄 Description
Ports token routing from #156 to HIP, making
token_augwork on RDNA instead of warning and running without it.sage_attention/sol_attn_token.hipwith the five CUDA-equivalent kernels: centroids, tile list, two scoring passes, sort, and merge.routenow outputs the unrouted-block bitmap and best unrouted score.vtransposeand the chunked producer write the row-major int8 V copy consumed by gathered token tiles.sol_attn.cu, so Python uses one plan for both backends.This is a correctness port. RDNA WMMA already exposes a contiguous K slice, so token IDs index
ki/ksb/vRowdirectly without CUDA'ssol::perm_keypermutation.On a routing-adversarial synthetic case (T=16384, H=8, bf16),
token_aug=256improves dense-attention relative error from 0.648 -> 0.132 and DC bias from 0.165 -> 0.014, at 7.1 -> 8.1 ms. The selected tokens were independently re-derived from workspace centroid scores and verified sorted, within budget, candidate-only, and correctly cut at the histogram boundary.The second commit fixes HIP
round_fp16under-ffast-math. Clang was folding the float -> half -> float round away, causingapply_ropeto differ from eager by up to 9% of elements. Two inline-asm conversions restore exact rounding; fp16-freq cases are now bit-identical. The 2x24x4096x128 case goes 865 -> 1024 us; fp32/bf16 paths are unchanged and VGPR use drops by one.test_hip_wmma.py::test_rope_matches_eagernow covers fp16 freqs and checks bit identity.The third commit enables HIP in the test backend/device lists. This activates ~130 additional cases across AdaLN, RMS AdaLN, NA3D, FP8 quantization, int8 activations, and RoPE. All pass; non-HIP machines simply skip them.
test_rms_rope.pyremains unchanged because its existing tolerance bands are already exceeded by eager on some seeds, while HIP tracks eager within 0.001 percentage points. Coverage remains intest_hip_wmma.py.Suite result: 1483 passing vs 1349 before, with failures unchanged at 101 and none in HIP paths. Compile-verified on gfx1100/gfx1200 with no scratch spills; run-verified on gfx1200. All five
token_augtests intests/test_sol_attn.pynow run and pass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.