mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #266] [MERGED] Implement attention masking and deltanet for tree MTP #269
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#269
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/266
Author: @rattus128
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @comfyanonymous
Base:
main← Head:prs/adaptive-mtp📝 Commits (6)
3e0add8Expose non-causal prefix attention and log-sum-expa157d9cRename merge internals while preserving the causal Python APIbb1f24dUse explicit row masks in speculative attention mergeff4a65dAdd tree traversal and accepted-path replay to DeltaNet9e7e526Test tree attention and deferred DeltaNet replay7d2b9d6Consolidate deferred DeltaNet on fixed 1/4/8 tree kernels📊 Changes
14 files changed (+446 additions, -219 deletions)
View changed files
📝
comfy_kitchen/__init__.py(+2 -1)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+28 -24)📝
comfy_kitchen/backends/cuda/ops/flash_decode.cu(+16 -14)📝
comfy_kitchen/backends/cuda/ops/gated_delta.cu(+59 -33)📝
comfy_kitchen/backends/hip/__init__.py(+9 -6)📝
comfy_kitchen/backends/hip/dlpack_bindings.cpp(+31 -23)📝
comfy_kitchen/backends/hip/launchers.h(+5 -5)📝
comfy_kitchen/backends/hip/ops/flash_decode.hip(+14 -12)📝
comfy_kitchen/backends/hip/ops/gated_delta.hip(+46 -22)📝
comfy_kitchen/flash_attention.py(+46 -24)📝
comfy_kitchen/gated_delta.py(+42 -19)📝
comfy_kitchen/int8_decode.py(+1 -1)📝
tests/test_flash_attention.py(+48 -31)📝
tests/test_gated_delta_fused.py(+99 -4)📄 Description
Tree MTP is an MTP algorithm where each draft level also provides a number of sibling backups. The verification process for this needs a causal masking scheme that can do attention for multiple candidate in parallel as separate tokens but attention/deltanet needs an appropriate masking/divergeance such that they dont attend each other.
ComfyUI PR to follow
Regression tests:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.