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#36
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?
Originally created by @YAY-3M-TA3 on GitHub (Aug 12, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/110
ck-attention STILL crashes on AMD after #104 fix.
My system:
win 11, gfx 1151 (AMD Radeon 8060s), python 3.12, using AMD pytorch from https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/
PYPI package hadn't updated yet, so I grabbed the windows 3.12 amd whl from the build artifact: https://github.com/Comfy-Org/comfy-kitchen/actions/runs/31491146906/artifacts/9101500506
Steps to reproduce:
I did a force reinstall of the new whl
python -m pip install --no-cache-dir --force-reinstall comfy_kitchen-0.2.30-cp312-abi3-win_amd64.whlthen ran comfyui
python main.py --listen 127.0.0.1 --port 8188 --use-ck-attentionThen just loaded the comfy WF templates for minimax h3 Image-to-video and text-to-video - no modifications, I just ran each.
Note: I did notice in the start up log
I thought it should only show one attention not both?
anyways, after models load up and sampler starts processing, here is the error:
**(NOTE - I ran this test for these test combinations and got the same error
)**
error:
@0xDELUXA
@coderabbitai[bot] commented on GitHub (Aug 12, 2026):
🔗 Related PRs
Comfy-Org/comfy-kitchen#103 - Implement optimized int8 attention. [merged]
Comfy-Org/comfy-kitchen#104 - HIP port of
#103: optimized int8 attention [merged]🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
@0xDELUXA commented on GitHub (Aug 12, 2026):
#104 wasn't a "fix".
Issues won't be solved any faster if you write things like it "STILL" crashes.
@0xDELUXA commented on GitHub (Aug 12, 2026):
The message you hit is a precondition the quantizer needs, not an AMD-specific one. The quantizers load four elements at a time from every row, so the Q/K base pointer and the B/H/N strides all have to keep that group aligned. The CUDA backend enforces the identical predicate in quant_qk_int8.cu:725, reached from its own sage_sdpa_quantize, so the same tensors would raise the same error on an NVIDIA card.
I ran the MiniMax H3 template here on RDNA4 (gfx1200, ComfyUI 0.32.0, comfy-kitchen 0.2.30,
--use-ck-attention, "Using Comfy Kitchen attention" in the log) and it completed. The layout comfy/ldm/minimax/model.py builds is heads=56, head_dim=128, which gives Q/K strides (7168, 128, 21504, 1) - every term a multiple of 128, so stock H3 cannot fail this check. I confirmed separately that the guard does fire on a row stride of 130 and on an odd base pointer, so something is handing attention differently strided Q/K on your setup.To pin it down, add this to comfy/ldm/modules/attention.py in _attention_comfy_kitchen_int8_containers, right before the "quantized = comfy_kitchen.prequantize_int8_attention(" line:
and post the line it prints, together with a run using
--disable-all-custom-nodesand the name of the exact MiniMax H3 checkpoint file you loaded.@YAY-3M-TA3 commented on GitHub (Aug 12, 2026):
Ok - I just did another test with --disable-all-custom-nodes - same error shows up.
In terms of my run -
I tried to do this test with the standard comfyui (Not using the patientx-rocm). Only difference I can think of is that I am using the whls from amd https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/
"torch==2.9.1+rocm7.2.1"
"torchvision==0.24.1+rocm7.2.1""torchaudio==2.9.1+rocm7.2.1"
the specific install instructions are from the amd blog 7/25/2026 - link https://rocm.blogs.amd.com/artificial-intelligence/comfyui-windows/README.html
I'll make the mods to attention.py and post the results again with the --disable-all-custom-nodes flag. along with the exact minimax h3 checkpoint - (I'm using the just the standard ones for the comfy native WF)
@0xDELUXA commented on GitHub (Aug 12, 2026):
If your strides do come back misaligned from stock core code, the fix belongs in the shared Python (
comfy_kitchen/sage_attention.py): fall back toq.contiguous()/k.contiguous()when the precondition fails, which fixes the issue for both CUDA and HIP. This should be proposed upstream rather than widening the HIP guard alone, since that would make HIP accept inputs that CUDA rejects.@YAY-3M-TA3 commented on GitHub (Aug 12, 2026):
The bad(q) and bad (k) values returned zero, so I printed out a breakdown in-case that is useful...
The MiniMax H3 checkpoints used:
Here is the full run using --disable-all-custom-nodes and using the image-to-video native WF template:
@0xDELUXA commented on GitHub (Aug 12, 2026):
Turns out Torch 2.9.1's DLPack export rewrites strides for size-1 dimensions. Could you update ROCm/Torch (with nightly wheels built by ROCm/TheRock) and then test again?
@archangelttn-lang commented on GitHub (Aug 12, 2026):
Environment
GPU: AMD RX 9070 XT (gfx1201, RDNA4), Windows 10
torch 2.12.0+rocm7.15.0a20260724 (HIP 7.15.26294)
comfy-kitchen 0.2.30 (PyPI release wheel)
ComfyUI 0.32.0
What I see
With --use-ck-attention, MiniMax H3 fails immediately at the start of SamplerCustomAdvanced:
sage_sdpa_quantize(): incompatible function arguments. The following argument types are supported:
Invoked with types: PyCapsule, PyCapsule, PyCapsule, PyCapsule, PyCapsule,
PyCapsule, PyCapsule, PyCapsule, PyCapsule, int, int, int, int
Wan 2.2 workflows run without this error using the same launcher. Memory usage is nowhere near the limit when it fails, so this is not OOM.
I understand now this is expected on a release wheel: #103 (merged) is NVIDIA-only and #104 (AMD) is still a draft. In the 0.2.30 PyPI wheel, sage_attention.py imports only from .backends import cuda as _cuda_backend, so int8_attention / prequantize_int8_attention never reach the hip-priority registry that init.py sets up. Posting this mainly so other AMD users searching for sage_sdpa_quantize + PyCapsule find the explanation.
Offer to test
If useful, I can test the #104 draft on a newer stack than the one in this thread: gfx1201 / ROCm 7.15 / torch 2.12.0, which should not exhibit the torch 2.9.1 DLPack size-1-stride rewriting you identified. I can run both MiniMax H3 (which takes the _attention_comfy_kitchen_int8_containers / prequantize_int8_attention path) and Wan 2.2 (plain int8_attention) and report back. Just point me at a wheel or artifact.
@YAY-3M-TA3 commented on GitHub (Aug 12, 2026):
That did the trick! Updated to nightly
pip install --no-cache-dir --force-reinstall "torch[device-gfx1151]" "torchvision[device-gfx1151]" torchaudio rocm-sdk-devel --index-url https://rocm.nightlies.amd.com/whl-multi-arch/near 2x speed improvement!
I also tested with Spectrum and 600 EMA 8-step Lora - went from 35 minutes (pytorch attention , no lora, no spectrum) to 4 minutes
Great work people!
@0xDELUXA commented on GitHub (Aug 12, 2026):
The fix has been merged. Can you try the wheel from https://github.com/Comfy-Org/comfy-kitchen/actions/runs/31639877736 with PyTorch 2.9 again?
@YAY-3M-TA3 commented on GitHub (Aug 13, 2026):
Ok - it all works - no issue
Details...
I forced re-installed 2.9.1 / 7.2.1
pip install --no-cache-dir --force-reinstall -f https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/ "torch==2.9.1+rocm7.2.1" "torchvision==0.24.1+rocm7.2.1" "torchaudio==2.9.1+rocm7.2.1" numpy pillowthen verified the version
Then I grabbed the whl from your link and forced -reinstalled
python -m pip install --no-cache-dir --force-reinstall comfy_kitchen-0.2.30-cp312-abi3-win_amd64.whlThen ran comfy:
python main.py --listen 127.0.0.1 --port 8188I ran the native WF for image to video with an added backend node set to comfy-kitchen attention
Generation time is as fast as with nightly py/rocm
@0xDELUXA commented on GitHub (Aug 13, 2026):
Great! The fix is already in ComfyUI as of
github.com/Comfy-Org/comfy-kitchen@7c6ca3a5b6, so this issue can be closed.@YAY-3M-TA3 commented on GitHub (Aug 13, 2026):
good job! I am very impressed with the 2X speed up on gfx1151
@0xDELUXA commented on GitHub (Aug 19, 2026):
@YAY-3M-TA3 Is there anything in this issue that should prevent it from being closed?