Nodes/comfyui-gpu-resident-loader/Set Global Residency Policy
ComfyUI Node

Set Global Residency Policy

The master switch for how this pack treats VRAM

By xmarre·Created 5 months ago·Updated 5 months ago· 2
Set Global Residency Policy
    • active_policy
    policysticky_gpu

    Set Global Residency Policy is the one knob that controls everything else in the GPU Resident Loader pack. It picks which of four global policies the startup patcher uses for ingest and offload behavior, and returns the active policy as a string. If the residency nodes are the pack's body, this is the brain.

    The single required input, policy, has four options:

    • legacy - closest to stock ComfyUI. Registry tracking still happens, but the patcher doesn't aggressively steer loads toward the GPU path. This is the "make sure nothing surprising happens" setting.
    • balanced - tracking and diagnostics without aggressive GPU residency behavior. The safe middle.
    • prefer_gpu - the default when nothing else selects a policy. Prefers GPU ingest for tracked model-like loads and keeps the faster side of the device/offload policy for diffusion models, CLIP/text encoders, and ControlNets. Does not auto-pin anything.
    • sticky_gpu - the full experience. Everything prefer_gpu does, plus auto-pinning newly bound models and CLIPs, keeping VAE offload on the GPU side, patching free_memory() to protect sticky entries by priority, and the sticky-safe VAE encode/decode behavior. This is what you want for a big-GPU resident workflow.

    Output is active_policy, a STRING echoing the policy that ended up active - useful for confirmation and for wiring into the loader nodes' optional policy_override inputs.

    If you never touch this node, the pack still picks something: COMFYUI_GPU_RESIDENT_POLICY env var if set, otherwise sticky_gpu when ComfyUI starts with --gpu_only or --highvram, otherwise prefer_gpu. So on a default launch you're already in prefer_gpu, and the node exists to change that from inside a graph - or to force it back to a calmer mode.

    The common mistakes, both of which are easy to make. First, thinking this node is a per-load control - it's not, it sets the global policy; per-load overrides go on the loaders' policy_override inputs (the tooltip on that input says to connect Set Global Residency Policy there, which gives you a tidy pattern: one policy node, its string wired to several loaders' overrides). Second, forgetting that sticky_gpu's auto-pin behavior is a real commitment - it holds models and CLIPs in VRAM, which is great on a 24 GB card and counterproductive if you're tight on memory. If you're on a small card, prefer_gpu or balanced is usually the smarter home.

    One more honest note: the pack's own README frames the startup patches as the core of the repo, and this node is the steering wheel for them. Before you flip to sticky_gpu in a production graph, run one generation under balanced and read Registry Snapshot to see what's actually resident - that's the workflow this pack is designed around, and it's the fastest way to learn what the policy is doing.

    Install with the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/xmarre/ComfyUI-GPU-Resident-Loader
    cd ComfyUI-GPU-Resident-Loader
    pip install -r requirements.txt
    

    Restart ComfyUI, or search "comfyui-gpu-resident-loader" in ComfyUI Manager.

    CategoryGPU Resident Loader/residency

    Inputs (1)

    NameTypeDefaultDescription
    policyCOMBOsticky_gpuSelect the global ingest/offload policy used by the startup patcher.

    Outputs (1)

    NameTypeDescription
    active_policySTRING