mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #269] Fix singleton strides in CUDA flash decode #274
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#274
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/269
Author: @curealb
Created: 10/22/2026
Status: 🔄 Open
Base:
main← Head:fix/flash-decode-singleton-strides📝 Commits (1)
0632722Fix singleton strides in CUDA flash decode📊 Changes
2 files changed (+41 additions, -2 deletions)
View changed files
📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+3 -2)📝
tests/test_flash_attention.py(+38 -0)📄 Description
PyTorch 2.8.0 exports singleton dimensions through DLPack with stride 1. The CUDA GQA decode and tree-merge checks reject these valid output layouts, even though singleton dimensions are only indexed at zero.
Check GQA output row strides only when query_length > 1, batch strides only when batch > 1, and tree-merge output row strides only when rows > 1.
Last-dimension contiguity, Q/K/V validation, and existing error messages are preserved. Kernel code and launch arguments are unchanged. The step-merge API benefits through its existing delegation to tree merge.
Validation on Windows with an RTX 4090:
With the full patch applied,
tests/test_flash_attention.py:Both runs include all 8 new regression cases. The 20 skipped tests are HIP/ROCm-specific.
Separately, only the 8 new regression cases were run on PyTorch 2.8.0+cu128, rebuilding the CUDA extension and starting a fresh Python process for each stage:
Unsupported Flash Attention tensor strides, 2 passed.Unsupported tree merge strides, 4 passed.None of these 8 cases were skipped. The intermediate stage independently exercises the tree-merge stride check.
Refs Comfy-Org/ComfyUI#17278.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.