mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[GH-ISSUE #169] [Bug] Triton rms_rope kernel exceeds CUDA gridDim.z limit (65535) when seq_len >= 65536 #52
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#52
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?
Originally created by @trojanGoat on GitHub (Sep 10, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/169
Summary
In
comfy_kitchen.backends.triton.rms_rope, the kernel launch grid is defined as:and maps
seq_idxtotl.program_id(2).In NVIDIA CUDA hardware specifications, the maximum grid dimensions are:
gridDim.x <= 2,147,483,647(2^31 - 1)gridDim.y <= 65,535gridDim.z <= 65,535Because
seq_lenis mapped togrid[2](gridDim.z), any sequence length >= 65,536 causes the CUDA driver to returncudaErrorInvalidValue(RuntimeError: Triton Error [CUDA]: invalid argument).Minimal Reproduction
This can be reproduced directly in Python:
Output:
Real-world ComfyUI Failure
When running LTX-Video 2.5 decoding with
VAEDecodeTiled(e.g.,tile_size: 512,temporal_size: 64):CausalDiffusionVAE(na_diffusion_decoder.py), tile dimensions reachH=64, W=64, \text{dim}=512.\text{chunk} = \lfloor 2^{25} / (64 \times 64 \times 512) \rfloor = 16.nt = 16 \times 64 \times 64 = 65,536.nodes.py:375/na_diffusion_decoder.py:157.Proposed Fix
Map
seq_idxtoprogram_id(0)(which supports up to 2.14 billion ongridDim.x) andbatch_idxtoprogram_id(2)(batch sizes are typically <= 8):We verified this fix:
nt \ge 100,000without error.