mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #222] Add SM120 H3 QKV RMS RoPE and attention preparation fusion #233
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#233
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/222
Author: @Tokha233
Created: 9/30/2026
Status: 🔄 Open
Base:
main← Head:cuda/h3-qkv-quant📝 Commits (5)
5304d03Add SM120 H3 QKV RMS RoPE and attention preparation fusione070b2aRelease H3 QKV scratch before declined native fallback240e76aRetain quantization source attribution and updated test countbbfee43Fix H3 QKV fallback memory and source buildsc8e9ad7Merge main and retain indexed operator exports📊 Changes
18 files changed (+1913 additions, -1 deletions)
View changed files
📝
MANIFEST.in(+2 -0)📝
comfy_kitchen/__init__.py(+2 -0)📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+3 -0)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+112 -0)➕
comfy_kitchen/backends/cuda/ops/h3_qkv/anchor_v.cu(+210 -0)➕
comfy_kitchen/backends/cuda/ops/h3_qkv/mma.cuh(+94 -0)➕
comfy_kitchen/backends/cuda/ops/h3_qkv/qkv_quant.cu(+386 -0)➕
comfy_kitchen/backends/cuda/ops/h3_qkv/runtime.cuh(+21 -0)➕
comfy_kitchen/backends/cuda/ops/h3_qkv/sample_k.cu(+198 -0)➕
comfy_kitchen/h3_qkv.py(+176 -0)➕
docs/benchmarks/h3-qkv-benchmark.json(+272 -0)➕
docs/benchmarks/h3-qkv-image-probes.json(+10 -0)➕
docs/benchmarks/h3-qkv-sampler.json(+148 -0)➕
docs/benchmarks/h3-qkv-sdist-check.json(+5 -0)➕
docs/benchmarks/h3-qkv.md(+50 -0)📝
pyproject.toml(+1 -1)➕
tests/benchmark_h3_qkv.py(+51 -0)➕
tests/test_h3_qkv.py(+172 -0)📄 Description
H3 currently writes the full BF16 QKV projection, then rereads it for RMS/RoPE and INT8 attention preparation. This adds an opt-in
h3_qkv_prequantizeoperation combining the projection and preparation while retaining the current BF16 rounding, nine-current-key anchor selection, and all Q/K/V tokens.The initial fused path targets SM120, H3 hidden 5376, 56×128 heads, partial RoPE 96, and 8192–200000 packed rows. Smaller/strided/other CUDA inputs use the existing chain. The result is the existing
PrequantizedInt8Attentioncontainer; dense attention is unchanged. No cache or sparse approximation.Validation on RTX 5090 D v2 / Torch 2.12.0+cu130 / CUDA 13.0.88:
docs/benchmarks/h3-qkv.md.Ready for review of the standalone model-specific API and integration boundary. The measured consumer explicitly selects Kitchen INT8 attention; it is not a generic ComfyUI dispatch implementation. The single-operation percentage above covers sampling only. The later combined validation also checked decoded RGB/PCM; no continuous-service throughput claim. These percentages cannot be added to other overlapping fusions.
Prepared with AI assistance, manually exercised on the stated GPU; DCO signed off. Source notices retained.
Latest combined validation and per-PR fixes: https://github.com/Tokha233/ComfyUI-H3-SpeedKit/blob/main/docs/UPSTREAM-RECOVERY-TESTS-20261001.zh-CN.md . Combined gains overlap and must not be added to the single-operation timings above.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.