mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #41] [MERGED] Nibble Swizzle #98
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#98
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/41
Author: @contentis
Created: 5/20/2026
Status: ✅ Merged
Merged: 5/26/2026
Merged by: @comfyanonymous
Base:
main← Head:nibble_packing📝 Commits (3)
bf16787Add hi_first parameter to control FP4 nibble packing order4572ab0remove sage artefactdf2b48fMerge branch 'main' into nibble_packing📊 Changes
10 files changed (+314 additions, -96 deletions)
View changed files
📝
.gitignore(+1 -0)📝
comfy_kitchen/__init__.py(+33 -18)📝
comfy_kitchen/backends/cuda/__init__.py(+4 -0)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+8 -0)📝
comfy_kitchen/backends/cuda/float_utils.cuh(+10 -5)📝
comfy_kitchen/backends/cuda/ops/quantize_nvfp4.cu(+60 -52)📝
comfy_kitchen/backends/eager/quantization.py(+17 -6)📝
comfy_kitchen/backends/triton/quantization.py(+22 -6)📝
comfy_kitchen/float_utils.py(+29 -9)📝
tests/test_qdq.py(+130 -0)📄 Description
NVFP4 requires two 4-bit values to be packed into an 8-bit container. When doing this there is ambiguity on the order of packing two values A,B in physical memory as either [A|B] or [B|A].
This PR adds the functionality to control this behaviour when running the Q/DQ and adds helpers to change the layout.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.