ComfyUI/comfy/ldm/modules
Emiliooooo 93510fde17 fix(directml): guard opaque tensor storage and zero VRAM edge cases
Two runtime crashes affect AMD GPU users on Windows using torch-directml:

1. NotImplementedError in module_mmap_residency / cast_to_gathered
   DirectML tensors are opaque (OpaqueTensorImpl) and do not support
   untyped_storage(). Wrap both call sites in try/except so mmap
   tracking is skipped for DirectML tensors instead of crashing.

2. ZeroDivisionError in attention_split
   DirectML does not expose free VRAM via the standard query path,
   leaving mem_free_total as 0. Guard the math.log() call with a
   floor of 4 GB so split-attention steps are computed safely.

Tested on AMD RX 5600 XT (6 GB VRAM), Windows 11, torch-directml 0.2.5,
ComfyUI 0.21.1, DreamShaper 8 (SD 1.5).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-14 19:20:09 -04:00
..
diffusionmodules Fix typos (#10986) 2026-05-08 17:14:45 +08:00
distributions Small optimizations. 2024-12-18 18:23:28 -05:00
encoders Remove dead code. (#13251) 2026-04-01 20:22:06 -04:00
attention.py fix(directml): guard opaque tensor storage and zero VRAM edge cases 2026-05-14 19:20:09 -04:00
ema.py New Year ruff cleanup. (#11595) 2026-01-01 22:06:14 -05:00
sdpose.py SDPose: resize input always (#13349) 2026-04-10 11:26:55 -10:00
sub_quadratic_attention.py Widen OOM_EXCEPTION to AcceleratorError form (#12835) 2026-03-10 00:41:02 -04:00
temporal_ae.py Basic Hunyuan Video model support. 2024-12-16 19:35:40 -05:00