chore: remove deprecated gpu_cache_clear node

This commit is contained in:
Alan Burns
2026-05-05 18:44:20 -05:00
parent 535b72a9a9
commit f926182aba
7 changed files with 5 additions and 200 deletions
+2 -7
View File
@@ -85,12 +85,7 @@ Updating is as simple as replacing this folder and restarting.
- **FilenameAppendSuffix**
Append suffixes without breaking multi-part extensions. [Guide](docs/FilenameAppendSuffix.md)
<div align="center"><img src="docs/screenshots/filename_append_suffix.png" alt="FilenameAppendSuffix screenshot" width="300" /></div>
- **GpuSyncCacheClear**
Flush CUDA caches mid-run to avoid VRAM creep. [Guide](docs/GpuSyncCacheClear.md)
<div align="center"><img src="docs/screenshots/gpu_sync_cache_clear.png" alt="GpuSyncCacheClear screenshot" width="300" /></div>
- **SeedVR2Prep**
Prep heavy SeedVR2 pipelines with cache priming and cleanup. [Guide](docs/SeedVR2Prep.md)
<div align="center"><img src="docs/screenshots/seedvr2_prep.png" alt="SeedVR2Prep screenshot" width="300" /></div>
Screenshots under `docs/screenshots/` match the ComfyUI widgets so you can confirm you grabbed the right node.
@@ -101,7 +96,7 @@ Screenshots under `docs/screenshots/` match the ComfyUI widgets so you can confi
- **Shared toggles** – drive multiple `AutoAdjustNode` blocks with one `AutoColorConfigNode` when branches need the same look.
- **Debug strings** – cropping utilities (`MQBBoxMin`, `FitAspectHeadSafe`, `FluxResolutionPrepare`) emit detailed notes; pipe them into log widgets while tuning.
- **JSON bundles** – `WorkflowConfig` emits a single string you can unpack in custom scripts to sync settings everywhere.
- **GPU switches** – nodes like `AutoCropBorders` and `GpuSyncCacheClear` expose `use_gpu`; flip them based on the machine you run on.
- **GPU switches** – nodes like `AutoCropBorders` expose `use_gpu`; flip them based on the machine you run on.
---
+3 -6
View File
@@ -29,10 +29,7 @@ from .intelligent_auto_crop import (
NODE_CLASS_MAPPINGS as INTELLIGENT_AUTO_CROP_CLASS_MAP,
NODE_DISPLAY_NAME_MAPPINGS as INTELLIGENT_AUTO_CROP_DISPLAY_MAP,
)
from .gpu_cache_clear import (
NODE_CLASS_MAPPINGS as GPU_CACHE_CLEAR_CLASS_MAP,
NODE_DISPLAY_NAME_MAPPINGS as GPU_CACHE_CLEAR_DISPLAY_MAP,
)
from .filename_append_suffix import (
NODE_CLASS_MAPPINGS as FILENAME_APPEND_SUFFIX_CLASS_MAP,
NODE_DISPLAY_NAME_MAPPINGS as FILENAME_APPEND_SUFFIX_DISPLAY_MAP,
@@ -88,7 +85,7 @@ NODE_CLASS_MAPPINGS.update(MULTIPROMPT_CLASS_MAP)
NODE_CLASS_MAPPINGS.update(STITCH_BY_MASK_CLASS_MAP)
NODE_CLASS_MAPPINGS.update(CROP_UTILS_CLASS_MAP)
NODE_CLASS_MAPPINGS.update(INTELLIGENT_AUTO_CROP_CLASS_MAP)
NODE_CLASS_MAPPINGS.update(GPU_CACHE_CLEAR_CLASS_MAP)
NODE_CLASS_MAPPINGS.update(FILENAME_APPEND_SUFFIX_CLASS_MAP)
NODE_CLASS_MAPPINGS.update(AUTO_COLOR_MATCH_CLASS_MAP)
@@ -108,7 +105,7 @@ NODE_DISPLAY_NAME_MAPPINGS.update(MULTIPROMPT_DISPLAY_MAP)
NODE_DISPLAY_NAME_MAPPINGS.update(STITCH_BY_MASK_DISPLAY_MAP)
NODE_DISPLAY_NAME_MAPPINGS.update(CROP_UTILS_DISPLAY_MAP)
NODE_DISPLAY_NAME_MAPPINGS.update(INTELLIGENT_AUTO_CROP_DISPLAY_MAP)
NODE_DISPLAY_NAME_MAPPINGS.update(GPU_CACHE_CLEAR_DISPLAY_MAP)
NODE_DISPLAY_NAME_MAPPINGS.update(FILENAME_APPEND_SUFFIX_DISPLAY_MAP)
NODE_DISPLAY_NAME_MAPPINGS.update(AUTO_COLOR_MATCH_DISPLAY_MAP)
-42
View File
@@ -1,42 +0,0 @@
# GpuSyncCacheClear
`GpuSyncCacheClear` forces a quick CUDA sync and clears selected GPU caches. It’s a maintenance node that helps recover VRAM between heavy steps so long pipelines stay stable.
---
## Inputs
- `sync_cuda` – When enabled, calls `torch.cuda.synchronize()` to finish outstanding GPU work before clearing memory.
- `empty_cache` – Clears PyTorch’s allocator cache so unused memory is released back to the driver.
- `collect_garbage` – Runs Python’s garbage collector to free objects that might still hold GPU references.
- `delay_ms` – Optional pause (in milliseconds) after the cleanup. Useful when the next node needs a short breather.
---
## Outputs
- `log` – Text summary of actions taken and how long each step required.
---
## Where It Fits
Insert this node between VRAM-heavy stages—e.g., after a large upscaler, before a memory-intensive diffusion pass, or while alternating between different models on a shared GPU.
---
## Tuning Tips
- Leave `sync_cuda` on when running asynchronous operations; it ensures everything finishes before cleaning.
- Use the delay only when you know a downstream node immediately restarts another heavy task.
- Pair with status logging (e.g., ComfyUI console or a text overlay) so you can confirm the cleanup is happening during long renders.
---
## Troubleshooting
- **No VRAM freed** – Some drivers hold onto memory until the next allocation; keep `empty_cache` and `collect_garbage` enabled for the best chance of recovery.
- **Pipeline slows down** – Reduce how often you call the node or disable the delay; each cleanup adds a small pause.
- **Unexpected errors** – Make sure the GPU is still initialised when the node runs; this helper assumes CUDA is available.
---
Screenshot: `docs/screenshots/gpu_sync_cache_clear.png`
-44
View File
@@ -1,44 +0,0 @@
# SeedVR2Prep
`SeedVR2Prep` prepares heavy SeedVR2 workflows by warming up caches, priming key models, and cleaning up afterward. Think of it as a one-button “get ready to render” helper for VRAM-intensive runs.
---
## Inputs
- `run_warmup` – Execute the warmup pass, loading and touching key models so the first real render doesn’t spike.
- `warmup_steps` – Number of dummy steps to run during warmup. Higher values build a larger cache but take longer.
- `clear_after` – Free caches once the main job finishes. Leave on if you’re about to switch projects.
- `log_only` – When `True`, print what would happen without actually running warmup or cleanup. Useful for testing.
- `notes` – Free-form text stored alongside the log output.
---
## Outputs
- `log` – Summary of warmup and cleanup actions.
- `status` – Simple text flag (`ready`, `skipped`, `cleared`) for downstream branching.
---
## Where It Fits
Drop SeedVR2Prep at the start of VRAM-heavy SeedVR2 graphs when you need stable runtimes or when the first render tends to hitch due to lazy model loading. Run it again at the end to clean up before switching to a different project or model set.
---
## Tuning Tips
- Start with a modest `warmup_steps` count (e.g., 5) and increase only if the first render still stutters.
- Leave `clear_after` enabled on shared machines so other users get a clean slate.
- Toggle `log_only` during setup to verify the node sees the right models before committing to a full warmup.
---
## Troubleshooting
- **Warmup takes too long** – Lower `warmup_steps` or limit which models participate in warmup within your workflow.
- **VRAM still spikes on first render** – Ensure `run_warmup` is enabled and the node executes before the main generation block.
- **Cleanup skipped** – Check that `clear_after` is toggled on and the node executes after your main render branch.
---
Screenshot: `docs/screenshots/seedvr2_prep.png`
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

-101
View File
@@ -1,101 +0,0 @@
import gc as _iutils_gc
import torch as _iutils_torch
def _iutils_ensure_bhwc_rgb(image):
t = image
if not isinstance(t, _iutils_torch.Tensor):
t = _iutils_torch.tensor(t)
t = t.to(_iutils_torch.float32)
if t.dim() == 3:
t = t.unsqueeze(0)
# Expect [B,H,W,C]
if t.shape[-1] == 3:
return t.clamp(0.0, 1.0)
elif t.shape[-1] > 3:
return t[..., :3].clamp(0.0, 1.0)
elif t.shape[-1] == 1:
return t.repeat(1, 1, 1, 3).clamp(0.0, 1.0)
else:
return t.clamp(0.0, 1.0)
class GpuSyncCacheClear:
@classmethod
def INPUT_TYPES(cls):
return {"required": {"image": ("IMAGE",)}}
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = "apply"
CATEGORY = "image/utils"
def apply(self, image):
try:
if _iutils_torch.cuda.is_available():
_iutils_torch.cuda.synchronize()
except Exception:
pass
_iutils_gc.collect()
try:
if _iutils_torch.cuda.is_available():
_iutils_torch.cuda.empty_cache()
except Exception:
pass
return (image,)
class SeedVR2Prep:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
"ensure_even_dims": ("BOOLEAN", {"default": True}),
"to_fp16_on_gpu": ("BOOLEAN", {"default": True}),
}
}
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = "apply"
CATEGORY = "image/utils"
def apply(self, image, ensure_even_dims=True, to_fp16_on_gpu=True):
x = _iutils_ensure_bhwc_rgb(image)
if ensure_even_dims:
H, W = x.shape[1], x.shape[2]
# Width
if (W % 2) == 1:
if W > 1:
x = x[:, :, : W - 1, :]
else:
# pad a column by repeating the last column
x = _iutils_torch.cat([x, x[:, :, -1:, :]], dim=2)
# Height
H, W = x.shape[1], x.shape[2]
if (H % 2) == 1:
if H > 1:
x = x[:, : H - 1, :, :]
else:
# pad a row by repeating last row
x = _iutils_torch.cat([x, x[:, -1:, :, :]], dim=1)
# fp16 conversion is independent of even-dim trimming — must live outside
# the ensure_even_dims block so that it executes when that toggle is off.
if to_fp16_on_gpu and _iutils_torch.cuda.is_available():
if x.device.type != "cuda":
x = x.to("cuda", non_blocking=True)
x = x.to(dtype=_iutils_torch.float16)
return (x,)
NODE_CLASS_MAPPINGS = {
"GpuSyncCacheClear": GpuSyncCacheClear,
"SeedVR2Prep": SeedVR2Prep,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"GpuSyncCacheClear": "GPU Sync & Cache Clear",
"SeedVR2Prep": "SeedVR2 Prep (sanitize)",
}