fix(ops): skip AIMDO cast path on non-CUDA/ROCm devices

comfy_aimdo.vbar_* is only registered for CUDA and ROCm backends. When
running on MPS (Apple Silicon) or CPU, cast_modules_with_vbar() raises
RuntimeError / NotImplementedError at runtime, breaking every model
load since CORE-111 (May 3 2026, commit 783782d5) which made the AIMDO
path the default for all devices.

This adds a device.type guard so the AIMDO fast path is skipped on
MPS/CPU, falling back to the plain resolve_cast_module_with_vbar() path
below it.

Verified on master (7f287b70) with PyTorch 2.11 / MPS backend — model
load completes successfully without AIMDO. No regression on CUDA
(path is unchanged for device.type == 'cuda').
This commit is contained in:
chinesewebman 2026-07-05 17:55:40 +08:00
parent 7f287b705e
commit b73dd32462

View File

@ -317,7 +317,10 @@ def cast_bias_weight(s, input=None, dtype=None, device=None, bias_dtype=None, of
prefetched = hasattr(s, "_prefetch")
offload_stream = None
offload_device = None
if not prefetched:
# comfy_aimdo is only registered for CUDA / ROCm backends. On MPS (and
# CPU) we have to skip the vbar fast path and fall back to the plain
# cast in resolve_cast_module_with_vbar below.
if not prefetched and device.type not in ("cpu", "mps"):
offload_stream = cast_modules_with_vbar([s], dtype, device, bias_dtype, non_blocking)
comfy.model_management.sync_stream(device, offload_stream)