mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #80] [CLOSED] Optimize quantize_int8_rowwise_convrot64 launch config (up to 4.9x on the generic path) #126
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#126
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/80
Author: @TheLegendOfKitty
Created: 7/20/2026
Status: ❌ Closed
Base:
main← Head:optimize-convrot64-quantize-launch📝 Commits (6)
c17a1dcRight-size convrot64 quantize launch; chunk 2048<K<=4096 to bound smemb41a280Add direct test coverage for quantize_int8_rowwise_convrot6438469feExtract shared load+rotate helper in chunked kernel; add K=2304 testa9f9ae2Trim comment density to match this file's/test suite's existing style4343fa9Add K=768/1280/1792 launch-config test coveragec957c76Trim stale comments; drop unneeded chunked-kernel smem attr and barrier📊 Changes
2 files changed (+373 additions, -1 deletions)
View changed files
📝
comfy_kitchen/backends/cuda/ops/int8_linear.cu(+214 -1)➕
tests/test_convrot64_quantize.py(+159 -0)📄 Description
The generic launch path of
quantize_int8_rowwise_convrot64used a fixed 1024-thread block and a full-row shared-memory buffer for every K, reaching only 9–35% of peak bandwidth on Ampere (75% of lanes idle at K=1024). This PR right-sizes the block to the actual group count for K≤2048 and adds a two-pass chunked kernel with bounded shared memory for 2048<K≤4096, while K>4096 keeps the existing path unchanged (chunking measured ~8% slower at K=8192 — the second pass's re-read loses L2 residency at high row counts — so it is gated off there). Outputs are bitwise-identical to the current kernel, verified against the shipped v0.2.22 wheel across K∈{1024, 2048, 2304, 3072, 3584, 4096, 8192}, fp32/fp16/bf16, and adversarial inputs (all-zero rows, near-dtype-max NaN cascades — preserving the overflow-clamp semantics from #66), and the kernel gains direct test coverage it previously lacked. Measured on an RTX 3090: 4.9x at K=1024, 2.5x at K=2048, 1.12x at K=4096 standalone; end-to-end on an int8 ConvRot checkpoint (Anima) at 1536x1536 this is 0.842→0.777 s/it eager and 0.797→0.729 s/it with torch.compile.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.