mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #221] Fuse indexed modulation, RMSNorm and ConvRot INT8 quantization #231
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#231
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/221
Author: @Tokha233
Created: 9/30/2026
Status: 🔄 Open
Base:
main← Head:cuda/indexed-norm-convrot📝 Commits (3)
c058e49Fuse indexed modulation with RMSNorm and ConvRot quantizationf66dda5Release unused fallback buffers and verify native benchmark dispatch34394a5Merge main and retain indexed operator exports📊 Changes
12 files changed (+1008 additions, -0 deletions)
View changed files
📝
NOTICE(+8 -0)📝
comfy_kitchen/__init__.py(+2 -0)📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+1 -0)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+41 -0)➕
comfy_kitchen/backends/cuda/ops/indexed_norm_convrot.cu(+287 -0)➕
comfy_kitchen/indexed_norm.py(+116 -0)➕
comfy_kitchen/licenses/PYTORCH_LICENSE.txt(+84 -0)➕
docs/benchmarks/norm-benchmark.json(+210 -0)➕
docs/benchmarks/norm.md(+34 -0)📝
pyproject.toml(+1 -0)➕
tests/benchmark_norm.py(+94 -0)➕
tests/test_indexed_norm.py(+130 -0)📄 Description
Fuses weighted RMSNorm, compact indexed BF16 scale/shift modulation, ConvRot256 and rowwise INT8 quantization. This removes the materialized norm/mod intermediates. The new opt-in
indexed_norm_convrotAPI returns INT8 data + FP32 row scales; existingrms_adalnis unchanged.Initial native scope is SM120/K5376 and the tested PyTorch RMSNorm reduction (git 7661cd9). Other Torch revisions, devices and layouts use their native RMSNorm/modulation/quantization chain. Each intermediate BF16 rounding is preserved. Invalid indices select zero shift/scale without host synchronization. Inputs are not modified; fake/custom-op support Inductor and CUDA Graphs. PyTorch BSD license is packaged.
RTX 5090 D v2 / Torch 2.12.0+cu130: 34 tests passed (CPU/CUDA, empty tables, invalid INT32 indices, strides, magnitude extremes, direct native dispatch, streams, Graphs, real Inductor). Full CUDA extension rebuilt. Benchmark baseline is native RMSNorm + six actual contiguous modulation segments + Kitchen ConvRot256, not a large indexed-gather baseline.
All Q bytes and FP32 scale values match. Eight alternating groups / ten CUDA Graph replays per sample. These are preparation-chain timings; they are not full DiT speedups. Raw samples and reproduction:
docs/benchmarks/norm.md,tests/benchmark_norm.py. An explicit INT8 consumer was also exercised in the combined full-sampler validation linked below. The generic ComfyUI consumer is not part of this PR; no isolated whole-model speedup is claimed for this operation.Ready for API/reduction-compatibility review as a standalone opt-in library operation. The narrow Torch gate is intentional until additional reductions are qualified. Prepared with AI assistance; measurements were executed on the stated hardware. DCO signed off.
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.