Comfy-Org/comfy-aimdo
A PyTorch allocator that keeps model weights on the GPU as VRAM allows
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
AIMDO is a native PyTorch allocator extension for ComfyUI integration, not a standalone inference engine. The application reserves a per-model Virtual Base Address Register (VBAR) and places weight tensors within that range. Address reservation does not allocate physical VRAM; the application must call fault() before touching a weight. A successful call makes the weight accessible, and a new or changed signature tells the caller to refresh its contents. After the layer finishes using the weight, unpin() makes it eligible for eviction.
The native CUDA backend uses cuMemAddressReserve, cuMemCreate, and cuMemMap; the AMD backend follows the same design with HIP equivalents. The primary PyTorch allocator plugin uses the same reserve/create/map sequence, so the weight allocator must be evaluated alongside the primary allocator. The Python package is comfy_aimdo, and examples/example.py illustrates the application-side integration.
Key Capabilities & Differentiators
AIMDO adapts weight residency to available VRAM rather than requiring the application to assign a fixed quota to each model. Newer VBARs and lower addresses within a VBAR take precedence, so the order in which the application lays out weights matters. A higher-priority fault can evict lower-priority weights. Eviction establishes a watermark within the affected VBAR, so weights above it fail fast on later calls instead of repeatedly trying to regain residency.
prioritize() promotes an existing VBAR and resets its watermark, which is useful when a workflow returns to a partially resident model. If fault() fails, the application copies the weight into a temporary regular GPU tensor for the current layer and lets PyTorch reclaim it afterward. Integration is at the tensor level; no specific model family or weight-file format is established as a compatibility requirement.
Trade-offs & Limitations
Compared with ordinary PyTorch caching allocation, AIMDO adds an explicit policy for which model weights stay resident. Compared with application-managed offloading at fixed model boundaries, it adapts to pressure without per-model quotas, but requires the caller to manage tensor access, copy refreshes, and pin lifetimes. The fallback still needs space for a temporary GPU tensor and can pay the copy cost again on subsequent layer executions; it does not guarantee that a workflow will fit.
The key operational caveat is fragmentation: while weights are being offloaded, the primary PyTorch cache can keep receiving successful allocations, and AIMDO cannot distinguish heavy usage from poor cache layout. Clear the PyTorch cache before each new model run so idle reservations do not take precedence over incoming weights. No commercial substitute is identified. A LICENSE file exists, but the license terms are unspecified in the available metadata and should be checked before redistribution.
Hardware & Deployment Guide
The package requires Python 3.9 or later and uses setuptools.build_meta, with build requirements setuptools>=61.0, setuptools-scm>=8, and wheel. The runtime requires PyTorch 2.8+ and either CUDA 12.8+ for NVIDIA or ROCm 7+ for AMD. Listed OS support is Windows 11+ and Linux within Python's manylinux support. Check the OS, PyTorch build, and GPU runtime together rather than assuming that every OS/backend pairing has a ready-to-install binary.
The package includes native .so and .dll files as package data; the v0.0.0 release entry dated December 27, 2025 covers AIMDO binary dependencies. That release entry does not establish a complete binary distribution matrix. AIMDO runs locally without a separate inference service. Start with examples/example.py, then validate the target workflow under realistic memory pressure, including model switches and the temporary-tensor fallback path.
fault() maps weights on demand, signatures guide refresh copies, and unpin() makes weights eligible for eviction.fault() routes the layer through a temporary regular GPU tensor rather than an unmapped weight.Local ComfyUI or PyTorch workflows where models compete for VRAM, the application can manage each weight's lifecycle, and temporary copies are an acceptable fallback.
You need drop-in deployment with no application changes, the model already fits comfortably, or repeated weight copies would violate your latency budget.
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/Comfy-Org/comfy-aimdo.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about comfy-aimdo
What must the PyTorch application do at each layer?
fault(). On success, copy the weight if the returned signature is new or has changed, then use it and call unpin() when finished. On failure, copy the weight into a temporary regular GPU tensor and use that instead. Never access an unmapped VBAR tensor.Can AIMDO make a workflow fit on a 16 GB GPU?
Can we run AIMDO locally and redistribute it commercially?
LICENSE file is present, but its terms are not identified here. Verify the applicable terms for both the source and distributed binaries before shipping AIMDO in a commercial product or container.When should we prefer AIMDO over standard allocation or explicit offloading?
fault()/unpin() lifecycle.Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy