[PR #2836] [CLOSED] Add ComfyUI Pipeline Memory Barrier node #2817

Closed
opened 2026-10-28 21:12:54 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/ComfyUI-Manager/pull/2836
Author: @brosequist
Created: 4/29/2026
Status: ❌ Closed

Base: main ← Head: add-pipeline-barrier


📝 Commits (1)

  • 44e9dc7 Add ComfyUI Pipeline Memory Barrier node

📊 Changes

1 file changed (+46760 additions, -46440 deletions)

View changed files

📝 custom-node-list.json (+46760 -46440)

📄 Description

New custom node: ComfyUI Pipeline Memory Barrier

Repo: https://github.com/brosequist/ComfyUI-PipelineBarrier

What it does

Inserts an explicit GPU cache flush between pipeline stages in a ComfyUI workflow. The node calls:

  1. comfy.model_management.soft_empty_cache(force=True)
  2. gc.collect()
  3. torch.cuda.empty_cache() + torch.cuda.synchronize() on every visible GPU

then logs GPU allocated/reserved and system RAM before and after.

Why it's needed

Multi-stage workflows (e.g. WanVideo two-pass I2V with ComfyUI-MultiGPU and BlockSwap) can OOM-kill the process at the start of the next stage even after model offload completes. PyTorch's CUDA allocator caches freed blocks rather than returning them to the OS immediately. This node flushes those caches so the OS sees the free memory before the next stage loads its models.

Usage

Wire it on any latent (or any typed) connection between pipeline stages. The input passes through unchanged. Works with any wire type via the _AnyType sentinel.

[Pass 1 Sampler] → [Pipeline Memory Barrier] → [Pass 2 Sampler]
[Pass 2 Sampler] → [Pipeline Memory Barrier] → [VAE Decode]

No additional pip dependencies (uses psutil which is already in the base ComfyUI environment).


🔄 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/ComfyUI-Manager/pull/2836 **Author:** [@brosequist](https://github.com/brosequist) **Created:** 4/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `add-pipeline-barrier` --- ### 📝 Commits (1) - [`44e9dc7`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/44e9dc7bc0b06b146e7fb89bd6bec0ea7c92bbf2) Add ComfyUI Pipeline Memory Barrier node ### 📊 Changes **1 file changed** (+46760 additions, -46440 deletions) <details> <summary>View changed files</summary> 📝 `custom-node-list.json` (+46760 -46440) </details> ### 📄 Description ## New custom node: ComfyUI Pipeline Memory Barrier **Repo:** https://github.com/brosequist/ComfyUI-PipelineBarrier ### What it does Inserts an explicit GPU cache flush between pipeline stages in a ComfyUI workflow. The node calls: 1. `comfy.model_management.soft_empty_cache(force=True)` 2. `gc.collect()` 3. `torch.cuda.empty_cache()` + `torch.cuda.synchronize()` on every visible GPU then logs GPU allocated/reserved and system RAM before and after. ### Why it's needed Multi-stage workflows (e.g. WanVideo two-pass I2V with ComfyUI-MultiGPU and BlockSwap) can OOM-kill the process at the start of the next stage even after model offload completes. PyTorch's CUDA allocator caches freed blocks rather than returning them to the OS immediately. This node flushes those caches so the OS sees the free memory before the next stage loads its models. ### Usage Wire it on any latent (or any typed) connection between pipeline stages. The input passes through unchanged. Works with any wire type via the `_AnyType` sentinel. ``` [Pass 1 Sampler] → [Pipeline Memory Barrier] → [Pass 2 Sampler] [Pass 2 Sampler] → [Pipeline Memory Barrier] → [VAE Decode] ``` No additional pip dependencies (uses `psutil` which is already in the base ComfyUI environment). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-28 21:12:54 +00:00
Sign in to join this conversation.
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/ComfyUI-Manager#2817
No description provided.