FastMetal-14B-QAD hangs before first denoise step on M4 Max (1.3B/5B fine; GPU command buffer never completes)
Describe the bug
FastMetal-14B-QAD hangs indefinitely on Apple M4 Max (128 GB, macOS 27.0.1) when running the documented MLX text-to-video example. The process never reaches the first denoise step. Reproduced twice, including with OMP_NUM_THREADS=1 MKL_NUM_THREADS=1.
FastMetal-1.3B-QAD and FastMetal-5B-QAD work perfectly on the same machine, same script, same environment (1.3B: 3.87 GiB peak, matching the published baseline exactly; 5B 720p: 9.337 GiB peak / 122.1 s denoise, both matching the published numbers).
Command
.venv/bin/python examples/inference/basic/mlx_wan_prompt_to_video.py \
--model-root /Users/yanyu/models/FastMetal-14B-QAD \
--mlx-checkpoint /Users/yanyu/models/FastMetal-14B-QAD \
--height 480 --width 832 --num-frames 81 \
--output-path video14b.mp4 \
--prompt "A fox runs through a misty pine forest, leaves kicking up behind it."
Last log line: Loading weights: 100%|██| 242/242 — then silence (no denoise step 1/3 ever).
Environment
- MacBook Pro, Apple M4 Max (40-core GPU), 128 GB unified memory
- macOS 27.0.1 (build 26A434)
- Python 3.13, FastVideo installed via
pip install -e '.[mlx]' - mlx 0.32.4 / mlx-lm 0.32.2 / mlx-metal 0.32.4
- Model downloaded via
hf download FastVideo/FastMetal-14B-QAD(39 GB on disk, all 8 safetensors open cleanly)
Evidence that the hang is in the 14B DiT load / first step (not text encoding)
- Text encoding completed on the first attempt: FastVideo wrote the prompt-embeds cache at
~/.cache/fastvideo/prompt_embeds/04cc776e*.npy(its.npy.jsonfingerprint points at the 14Btext_encoderroot) before the hang. Subsequent runs hit this cache instantly and still hang — so the hang is strictly after prompt encoding. sample <pid>stack (macOS): main thread parked in_PySemaphore_Wait; all libmlx ThreadPool workers idle incondition_variable::wait; one MetalCommandQueueDispatchthread is live insideIOGPUCommandQueueSubmitCommandBuffers— i.e. a GPU command buffer was submitted and never completes (kernel-level hang/livelock signature), while the CPU side is doing nothing.- CPU time frozen:
pscpu_time stops advancing (~15 s total after 10+ min wall); process sits at 0.0–0.3% CPU. - Partial residency: at hang, system-wide wired memory is only ~12.7 GiB (baseline ~7 GiB) while process RSS is ~14.8 GiB — the 14.4 GB DiT checkpoint is not fully resident on the GPU when it stalls.
- Not shader compilation:
MTLCompilerServiceidle, Metal shader cache byte-identical over 5 minutes of waiting.
What we ruled out
- Missing
--mlx-checkpoint(the classic silent-online-fetch hang): both args passed on every attempt. - libomp/OpenMP deadlock:
OMP_NUM_THREADS=1changes nothing; 1.3B/5B run fine in the same env. - Network wait: zero TCP connections on the hung process.
- Memory pressure: Metal budget 107.5 GiB; the published 14B peak is 21.68 GiB. System had >60 GiB free at hang.
Suspicion
Given mlx issue #3797 (NAX split-K GEMM NaN/livelock family on Apple GPUs for specific feed-forward shapes) already affected Qwen-Image-Flash at 4096-token sequences, the 14B Wan DiT may hit a related kernel path on M4 Max at this size. The 1.3B/5B models don't reach that regime.
Happy to run any diagnostics or test a fixed checkpoint/runtime build on this machine.
Full local dossier
We keep a Chinese dossier with raw sample output and a reproducible timeline at: yyc3-22:~/models/apple-silicon-stack/results/fastmetal-14b-hang-dossier.md.
I'll be taking this
Assigned to @Ishxn20. Link a PR with Fixes #2016; ask here if you need pointers.
— fv-superagent · one hang, one owner · run by aryan5v