mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #239] [MERGED] Performance improvements for qwen 3.x LLM (Part 1) #246
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#246
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/239
Author: @rattus128
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @comfyanonymous
Base:
main← Head:prs/qwen-3x-general📝 Commits (10+)
3075219Fuse scaled residuals into single-row INT8 GEMV86fc2faFactor out the single-row INT8 GEMV launch008b88eUse aligned 16-byte loads in single-row INT8 GEMV79458c4Factor out the ConvRot row quantizere74f445Fuse ConvRot input quantization into single-row INT8 GEMV6ee300eScope CUTLASS workspace to each stream-ordered launch016d15bAdd universal GQA decode with in-kernel split reduction7d7a691Merge causal step rows into prefix attention on CUDA HIP and torch1fe78e7Add bounded paged INT8 decode cachecce5e24Add deferred chain replay for DeltaNet decode📊 Changes
27 files changed (+3635 additions, -277 deletions)
View changed files
📝
comfy_kitchen/__init__.py(+16 -0)📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+2 -0)📝
comfy_kitchen/backends/cuda/__init__.py(+41 -10)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+405 -37)➕
comfy_kitchen/backends/cuda/int8_decode_bindings.cpp(+47 -0)📝
comfy_kitchen/backends/cuda/ops/cutlass_gemm_common.cuh(+9 -34)📝
comfy_kitchen/backends/cuda/ops/flash_decode.cu(+278 -20)📝
comfy_kitchen/backends/cuda/ops/gated_delta.cu(+418 -0)📝
comfy_kitchen/backends/cuda/ops/int8_linear.cu(+306 -69)➕
comfy_kitchen/backends/cuda/sage_attention/int8_decode.cu(+67 -0)📝
comfy_kitchen/backends/cuda/sage_attention/qk_int_sv_i8_cuda.cuh(+14 -14)📝
comfy_kitchen/backends/cuda/sage_attention/quant_qk_int8.cu(+33 -0)📝
comfy_kitchen/backends/cuda/sage_attention/quant_v_int8.cu(+23 -2)📝
comfy_kitchen/backends/hip/__init__.py(+134 -0)📝
comfy_kitchen/backends/hip/dlpack_bindings.cpp(+351 -2)📝
comfy_kitchen/backends/hip/launchers.h(+21 -8)📝
comfy_kitchen/backends/hip/ops/flash_decode.hip(+193 -78)📝
comfy_kitchen/backends/hip/ops/gated_delta.hip(+407 -0)📝
comfy_kitchen/flash_attention.py(+155 -1)📝
comfy_kitchen/gated_delta.py(+222 -0)...and 7 more files
📄 Description
Improve fusions and kernels for qwen 3.x LLM.
The bigger fish:
Deferred DeltaNet
Previously, MTP verification saved a full recurrent-state snapshot after each speculative token, then restored the accepted snapshot on rejection. Now it saves small token intermediates. The next call replays only the accepted updates and writes the committed state once. Each recurrent state is 64 KiB per head (128 × 128 FP32). Avoiding several snapshots per head, per layer, is substantial. On CUDA, it also moves the working state from shared memory into registers across four cooperating blocks, shortening reductions and reducing shared-memory traffic.
Before: verify → save full states → restore accepted state
After: verify → save token data → replay accepted updates next call
This trades extra arithmetic for fewer large memory transfers. With MTP off, the snapshot-saving benefit disappears; the CUDA register/reduction improvements remain.
GQA decode
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.