Repository navigation
[Solved] ComfyUI / PyTorch crashes with 0xc000001d (Illegal Instruction) on first matmul due to xsaveremovefeature in Windows BCD #17904
DogeRules6969
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Symptom
ComfyUI crashes immediately on the first sampling step (
0/4), and standalone PyTorch crashes on any GPU matrix multiplication (evena @ aon a 512x512 tensor):GPU memory allocation and elementwise operations work normally, which makes this look like a GPU driver or CUDA build issue, even though the fault happens on the host CPU.
Environment
2.7.1+cu128,2.11.0+cu128, and2.12.1+cu130What Did Not Help
621.24,617.42)cu128vs.cu130)cuBLASDLLs--lowvram,--force-fp32,--cpu-vae,--disable-dynamic-vram)Root Cause
Windows Logs > Application, Event ID1000) showed the faulting module wascublasLt64_12.dllinsidetorch\lib, not an NVIDIA display driver DLL.offset 0x1fb8a49) showed an AVX-512 instruction:XCR0viaxgetbv) returned0x7instead of0xe7, meaning Windows had disabled AVX-512 register state (ZMM) at boot even though the CPU supports it.bcdedit /enum {current}revealed the following entry in the Windows Boot Configuration Data:0xFFFFFFFFFFFFFFF8masks off all extended states above 256-bit AVX. This is not a Windows default and is commonly injected by VBS/hypervisor-disabling scripts such asVBS.CMDor system-tweaking utilities.)How to Check If You Have This Issue
Open Command Prompt and run:
If it outputs an
xsaveremovefeatureline, Windows is blocking AVX-512 state on your CPU. (If nothing prints, your0xc000001dcrash has a different cause.)Fix
bcdedit /export C:\bcd-backupxsaveremovefeatureboot entry:bcdedit /deletevalue {current} xsaveremovefeatureAfter rebooting,
XCR0reads0xe7, PyTorch GPUmatmul/F.linearruns cleanly, and ComfyUI generates normally without needing--lowvramor--force-fp32workarounds. (Note: Re-running VBS/hypervisor-disabling scripts may re-addxsaveremovefeature.)Technical Note
PyTorch's own CPU feature detection properly checks OS
XCR0state and falls back to AVX2, whereas NVIDIA'scublasLtheuristic dispatcher appears to checkCPUIDalone and executesZMMinstructions on the host CPU even when the OS has masked AVX-512 off. This can affect any Windows system with an AVX-512-capable CPU (such as AMD Ryzen 7000/8000/9000/200 series) whenxsaveremovefeatureis present.All reactions