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>