mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #90] [MERGED] Add optimized w4a8 with int8 codebook #136
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#136
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/90
Author: @kijai
Created: 8/1/2026
Status: ✅ Merged
Merged: 8/6/2026
Merged by: @comfyanonymous
Base:
main← Head:w4a8-int8-codebook📝 Commits (10+)
1c50520a4a89e8c323w4a8543a89dtriton/eager69620dfFixesd0d968evalidate quant contracts + fix transpose fallback orientationeaff9a7fixesf9d2565harden W4A8: capsule reuse, CUDA/ROCm detection, binding + addmm/scale contracts7440c2evalidate int8 scale/bias lengths + exact output dtype3580635reject unsupported out_dtype_code before dtype matchd908d58cast fallback weight to x.dtype in CUDA path📊 Changes
12 files changed (+1744 additions, -4 deletions)
View changed files
📝
comfy_kitchen/__init__.py(+8 -0)📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+1 -0)📝
comfy_kitchen/backends/cuda/__init__.py(+354 -4)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+261 -0)➕
comfy_kitchen/backends/cuda/ops/w4a8_gemm.cu(+165 -0)📝
comfy_kitchen/backends/eager/__init__.py(+56 -0)📝
comfy_kitchen/backends/eager/quantization.py(+6 -0)➕
comfy_kitchen/backends/eager/w4a8_int8.py(+369 -0)📝
comfy_kitchen/backends/triton/__init__.py(+18 -0)➕
comfy_kitchen/backends/triton/w4a8_int8.py(+143 -0)📝
comfy_kitchen/tensor/__init__.py(+11 -0)➕
comfy_kitchen/tensor/w4a8_int8.py(+352 -0)📄 Description
Calibration-free 4-bit weight storage that runs on int8 gemm with convrot activations.
AsymW4A8Int8Layout: ConvRot-rotated int4 weights + a per-tensor Lloyd-Maxcodebook + fp8 group scales, dequantized to grouped int8 and fed to the int8
CUTLASS GEMM. ~0.073 weight relL2 on real DiT weights (NVFP4 ~0.094), ~0.56
B/elem, ~1.09× int8 speed, no calibration.
Backends:
Core PR:
https://github.com/Comfy-Org/ComfyUI/pull/15308
Test model:
https://huggingface.co/Kijai/MiniMax-H3-experimental/blob/main/minimax_h3_fl2va_pruned_w4a8_mixed.safetensors
Example result on a 5090 (nvfp4 is not accelerated here):
https://github.com/user-attachments/assets/3ab99015-300a-4ef2-9051-2701347afac5
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.