Hello everyone,
I have published a forked version of ComfyUI that introduces several low-level performance optimizations, specifically tailored for NVIDIA/CUDA Unified Memory Architecture (UMA) environments.
Repository Link: https://github.com/stardust7700/ComfyUI.git
Key Features
-
High-Performance mmap Loading: Implements native
mmapwithmadvisehints and page cache warmup (TLB touching) to maximize I/O throughput. -
CUDA UMA Optimizations: Prevents redundant weight backups to RAM that typically occur when LoRAs are applied. By disabling these backups and enabling direct weight assignment, we fix the “memory doubling” issue where extra copies were created in host memory, significantly reducing the total memory footprint.
-
Enhanced Memory Monitoring: Integrates direct
/proc/meminfotracking for accurate real-time reporting of allocatable memory in UMA systems.
How to Use
You can try these optimizations by cloning the forked repository and running ComfyUI with the following CLI arguments:
git clone https://github.com/stardust7700/ComfyUI.git
cd ComfyUI
python main.py --fast-mmap-load --cuda-uma --fast-unload-models
-
--fast-mmap-load: Enables the optimizedmmaploading logic. -
--cuda-uma: Activates UMA-specific memory management and zero-copy patching. -
--fast-unload-models: Immediately releases models from VRAM/cache.
Implementation Note
Regarding the --fast-unload-models flag: this implementation effectively clears the active model cache, but it does not return the system’s total available memory exactly to its pre-workflow baseline. Please consider this a known limitation of the implementation in its current state.
Best regards,