[PR #162] [MERGED] Manage persistent RoPE allocations #187

Closed
opened 2026-10-26 22:21:22 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/162
Author: @rattus128
Created: 9/7/2026
Status: ✅ Merged
Merged: 9/7/2026
Merged by: @comfyanonymous

Base: main ← Head: prs/cache-lifecycles


📝 Commits (1)

  • fe791da Manage persistent RoPE allocations

📊 Changes

4 files changed (+31 additions, -12 deletions)

View changed files

📝 comfy_kitchen/__init__.py (+2 -0)
➕ comfy_kitchen/allocation.py (+15 -0)
📝 comfy_kitchen/backends/cuda/__init__.py (+7 -6)
📝 comfy_kitchen/backends/hip/__init__.py (+7 -6)

📄 Description

Comfy Kitchen has long lived caches of the RoPE artifacts for the new sparse attention implementation.

These force the comfy memory compiler to register rogue allocations / graph breaks which is non ideal.

Firstly demote the strong ref of the original RoPE to a weakref so that can just be freed by the caller (inside the graph).

Secondly we add an API that lets comfy register a context that will be with:ed when kitchen does stray caching allocations that exceed the lifetime of the CK call.

This gets the comfy-compiler for minamax H3 down to 0 graph breaks in al sparse attention modes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-kitchen/pull/162 **Author:** [@rattus128](https://github.com/rattus128) **Created:** 9/7/2026 **Status:** ✅ Merged **Merged:** 9/7/2026 **Merged by:** [@comfyanonymous](https://github.com/comfyanonymous) **Base:** `main` ← **Head:** `prs/cache-lifecycles` --- ### 📝 Commits (1) - [`fe791da`](https://github.com/Comfy-Org/comfy-kitchen/commit/fe791da0f5e50feb1f12be889d45deb736b4f3b3) Manage persistent RoPE allocations ### 📊 Changes **4 files changed** (+31 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `comfy_kitchen/__init__.py` (+2 -0) ➕ `comfy_kitchen/allocation.py` (+15 -0) 📝 `comfy_kitchen/backends/cuda/__init__.py` (+7 -6) 📝 `comfy_kitchen/backends/hip/__init__.py` (+7 -6) </details> ### 📄 Description Comfy Kitchen has long lived caches of the RoPE artifacts for the new sparse attention implementation. These force the comfy memory compiler to register rogue allocations / graph breaks which is non ideal. Firstly demote the strong ref of the original RoPE to a weakref so that can just be freed by the caller (inside the graph). Secondly we add an API that lets comfy register a context that will be with:ed when kitchen does stray caching allocations that exceed the lifetime of the CK call. This gets the comfy-compiler for minamax H3 down to 0 graph breaks in al sparse attention modes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:21:22 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-kitchen#187
No description provided.