Overview
After replacing ComfyUI-master with the 0.19.3 branch, WebUI startup stopped with:
Exception: ModuleNotFoundError: No module named 'comfy_aimdo.host_buffer'
Failing import site: ComfyUI-master/comfy/pinned_memory.py
This document explains:
The immediate cause
The root cause
Files that were changed
What each code change means
1) Immediate Cause
The startup traceback shows this import chain:
comfy/ldm/modules/attention.py -> import comfy.ops
comfy/ops.py -> import comfy.pinned_memory
comfy/pinned_memory.py -> import comfy_aimdo.host_buffer (fails)
So the direct failure is simple: the runtime could not import comfy_aimdo.host_buffer.
2) Root Cause
2-1. Dependency model changed in ComfyUI 0.19.3In this ComfyUI version, multiple modules now directly reference comfy_aimdo:
comfy/pinned_memory.py (host_buffer, torch)
comfy/ops.py (model_vbar, torch)
comfy/model_patcher.py (model_vbar)
comfy/utils.py (model_mmap)
main.py / execution.py / comfy/windows.py (control, model_vbar)
In short: newer ComfyUI code assumes AIMDO-related modules are importable.
2-2. sys.path resolution order trapEven if stubs exist under ComfyUI-master/comfy_aimdo, import may still fail if Python resolves comfy_aimdo from the project root first.
That is exactly what happened:
Resolved package path:
d:/USERFILES/GitHub/sd-webui-forge-classic-neo/comfy_aimdo/init.py
So, placing stubs only in ComfyUI-master/comfy_aimdo was not enough.
The root-level comfy_aimdo package also had to provide all required submodules.
3) Files Modified
A) Root-level comfy_aimdo (the actually resolved package)comfy_aimdo/host_buffer.py (added)
comfy_aimdo/model_mmap.py (added)
comfy_aimdo/torch.py (updated)
comfy_aimdo/model_vbar.py (updated)
ComfyUI-master/comfy_aimdo/init.py (added)
ComfyUI-master/comfy_aimdo/control.py (added)
ComfyUI-master/comfy_aimdo/model_vbar.py (added)
ComfyUI-master/comfy_aimdo/host_buffer.py (added)
ComfyUI-master/comfy_aimdo/torch.py (added)
ComfyUI-master/comfy_aimdo/model_mmap.py (added)
4) Code Changes and Their Meaning
4-1. host_buffer.pyAdded: HostBuffer(size)
Why: Required by comfy/pinned_memory.py
Meaning: Minimal host-buffer stub to satisfy import and basic API calls
Added/updated:
hostbuf_to_tensor(hostbuf)
safer fallback behavior in aimdo_to_tensor(v_handle, device)
Why:
pinned_memory.py expects hostbuf_to_tensor(...)
ops.py may call aimdo_to_tensor(...)
Meaning: Minimal tensor bridge using torch.empty(...), not full AIMDO transfer logic
Added/updated:
functions: vbars_analyze, vbar_fault, vbar_signature_compare, vbar_unpin, vbars_reset_watermark_limits
class methods: prioritize, alloc, free_memory, loaded_size
Why: Symbol compatibility for comfy/model_patcher.py, comfy/ops.py, execution.py
Meaning:
vbar_fault returns None to keep execution on non-AIMDO-safe paths
memory-analysis style APIs return safe no-op values
Added: ModelMMAP(path) and get()
Why: Used by comfy/utils.py safetensors path
Meaning: Lightweight wrapper built on Python mmap
Added: init, init_device, set_log_*, analyze, get_total_vram_usage
Why: Referenced by main.py, windows.py, and related runtime paths
Meaning: no-op/safe-return compatibility API
5) Why This Fix Works
The crash happened before model execution logic, at import time.
Therefore, the top priority was to make all required symbols importable.
This fix does exactly that:
defines missing modules/functions/classes,
returns conservative values for non-essential AIMDO operations,
avoids disrupting Forge’s existing runtime memory flow.
6) Validation Results
In the same venv, these imports were verified:
import comfy_aimdo.host_buffer
import comfy_aimdo.model_mmap
import comfy_aimdo.torch
import comfy_aimdo.model_vbar
import comfy.pinned_memory
import comfy.ops
import comfy.model_patcher
7) Remaining Caveat
This is a compatibility layer to prevent startup failure without the real AIMDO runtime.
AIMDO-specific performance optimizations/features are not enabled by these stubs.
For the stated goal (fixing the 0.19.3 startup break), this is sufficient.
8) Summary
Immediate cause: missing comfy_aimdo.host_buffer
Root cause: increased AIMDO assumptions in 0.19.3 + path resolution priority
Fix: complete root-level comfy_aimdo compatibility stubs
Result: import chain proceeds instead of stopping during startup
9) Full Traceback (Recorded)
Below is the full startup traceback as captured:
env "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\venv\Scripts\Python.exe"
Python 3.13.12 (tags/v3.13.12:1cbe481, Feb 3 2026, 18:22:25) [MSC v.1944 64 bit (AMD64)]
Version: nunchaku
[-] ADetailer: Checking for YOLOv8 models...
[-] ADetailer: YOLOv8 model check complete
[-] ADetailer: Checking for YOLOv11 models...
[-] ADetailer: face_yolo11n.pt already exists
[-] ADetailer: face_yolo11s.pt already exists
[-] ADetailer: YOLOv11 model check complete
[-] ADetailer: InsightFace already installed
Installing requirements
Launching Web UI with arguments: --flash --sage --pin-shared-memory --cuda-malloc --cuda-stream '--ckpt-dir=D:\USERFILES\ComfyUI\ComfyUI\models\unet' '--lora-dir=D:\USERFILES\StableDiffusion\models\Lora' '--embeddings-dir=D:\USERFILES\StableDiffusion\embeddings' '--vae-dir=D:\USERFILES\StableDiffusion\models\VAE' --skip-python-version-check --disable-gpu-warning
Using cudaMallocAsync backend.
Total VRAM 16311 MB, total RAM 63092 MB
pytorch version: 2.11.0+cu130
Set vram state to: NORMAL_VRAM
Always pin shared GPU memory
Device: cuda:0 NVIDIA GeForce RTX 5060 Ti : cudaMallocAsync
VAE dtype preferences: [torch.bfloat16, torch.float32] -> torch.bfloat16
CUDA Using Stream: True
Traceback (most recent call last):
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\launch.py", line 129, in <module>
main()
~~~~^^
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\launch.py", line 125, in main
start()
~~~~~^^
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules\launch_utils.py", line 591, in start
import webui
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\webui.py", line 25, in <module>
initialize.imports()
~~~~~~~~~~~~~~~~~~^^
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules\initialize.py", line 52, in imports
from modules import gradio_extensions, processing, ui # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules\processing.py", line 22, in <module>
import modules.sd_models as sd_models
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules\sd_models.py", line 11, in <module>
from backend.loader import forge_loader
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\backend\loader.py", line 12, in <module>
from backend.diffusion_engine.chroma import Chroma
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\backend\diffusion_engine\chroma.py", line 8, in <module>
from backend.patcher.unet import UnetPatcher
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\backend\patcher\unet.py", line 5, in <module>
from backend.modules.k_model import KModel
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\backend\modules\k_model.py", line 10, in <module>
import comfy.ldm.lumina.model # For NextDiT check in apply_model
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\ComfyUI-master\comfy\ldm\lumina\model.py", line 11, in <module>
from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\ComfyUI-master\comfy\ldm\modules\diffusionmodules\mmdit.py", line 7, in <module>
from ..attention import optimized_attention
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\ComfyUI-master\comfy\ldm\modules\attention.py", line 68, in <module>
import comfy.ops
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\ComfyUI-master\comfy\ops.py", line 26, in <module>
import comfy.pinned_memory
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\ComfyUI-master\comfy\pinned_memory.py", line 3, in <module>
import comfy_aimdo.host_buffer
File "D:\USERFILES\GitHub\sd-webui-forge-classic-neo\modules_forge\transformers_cache_compat.py", line 95, in _hooked_import
mod = _original_import(name, *args, kwargs)
ModuleNotFoundError: No module named 'comfy_aimdo.host_buffer'
続行するには何かキーを押してください . . .
10) Sequence Diagrams (Import Flow Before/After)
10-1. Before Fix (Error Path)sequenceDiagram
participant L as launch.py
participant W as webui/imports
participant K as backend/modules/k_model.py
participant A as comfy/ldm/modules/attention.py
participant O as comfy/ops.py
participant P as comfy/pinned_memory.py
participant S as sys.path resolver
participant R as root comfy_aimdo
L->>W: import webui
W->>K: import backend.modules.k_model
K->>A: import comfy.ldm.lumina.model ... attention
A->>O: import comfy.ops
O->>P: import comfy.pinned_memory
P->>S: import comfy_aimdo.host_buffer
S->>R: resolve comfy_aimdo (project root first)
R-->>S: host_buffer.py missing
S-->>P: ModuleNotFoundError
P-->>L: startup abortedsequenceDiagram
participant L as launch.py
participant W as webui/imports
participant K as backend/modules/k_model.py
participant A as comfy/ldm/modules/attention.py
participant O as comfy/ops.py
participant P as comfy/pinned_memory.py
participant S as sys.path resolver
participant R as root comfy_aimdo (stub)
L->>W: import webui
W->>K: import backend.modules.k_model
K->>A: import comfy.ldm.lumina.model ... attention
A->>O: import comfy.ops
O->>P: import comfy.pinned_memory
P->>S: import comfy_aimdo.host_buffer
S->>R: resolve comfy_aimdo (project root first)
R-->>S: provides host_buffer.py / torch.py / model_vbar.py / model_mmap.py
S-->>P: import success
P-->>O: pin_memory API available
O-->>L: import chain continuesFailure point: missing comfy_aimdo.host_buffer
Critical detail: stub location must match actual sys.path resolution order
After the fix, startup no longer stops at the import chain