Skip to content

[Apple M5 Max] Z-Image-Turbo (Metal): tensor-API path silently outputs blank white PNGs (exit 0) — GGML_METAL_TENSOR_DISABLE=1 restores correct output #1990

Description

@ziyu4huang

Summary

On Apple M5 Max (macOS, Xcode 26 SDK), generating with Z-Image-Turbo GGUF via the Metal backend produces completely blank white images when the Metal tensor API is active — with exit code 0, no errors, and normal-looking speed. Setting GGML_METAL_TENSOR_DISABLE=1 restores fully correct output.

Environment

  • stable-diffusion.cpp @ cc515a0 (master, 2026-09-17), ggml submodule = leejet/ggml @ e20c3a1 (branch sd.cpp)
  • Apple M5 Max, 128GB unified memory, macOS (Xcode 26 SDK)
  • Model: leejet/Z-Image-Turbo-GGUF (Q8_0 and Q4_K both affected), VAE ae.sft, TE Qwen3-4B-Instruct-2507

Repro

# (a) tensor API active → blank white PNG, rc=0, ~20s @ 864×480:
build/bin/sd-cli --diffusion-model weights/z_image_turbo-Q8_0.gguf \
  --vae weights/ae.sft --llm weights/Qwen3-4B-Instruct-2507-Q4_K_M.gguf \
  -p "a cinematic photo of a taxi driver at night" --cfg-scale 1.0 --steps 8 \
  --diffusion-fa -W 864 -H 480 -s 42 -o out.png -v

# (b) same command + GGML_METAL_TENSOR_DISABLE=1 → correct photoreal image (~28s):
GGML_METAL_TENSOR_DISABLE=1 build/bin/sd-cli ...
  • Verbose log (a) shows tensor API self-tests passing ("testing tensor API for f16/bfloat support", dummy kernels compile) — no error anywhere; the failure is silent.
  • --diffusion-fa on/off makes no difference (both blank without the env guard).
  • Same seed two runs are byte-identical (deterministically blank — so downstream checks on file size/dims won't catch it).

Notes

  • We initially suspected the MTLCompileOptions.languageVersion issue fixed upstream in llama.cpp PR #27461 and patched options.languageVersion = MTLLanguageVersion4_0 for tensor compiles — the patch changed nothing (still blank). So this looks like a compute-kernel correctness issue in the Metal tensor path on M5, not shader compilation.
  • MiniMax-H3 (vid_gen) is NOT affected — H3 runs fine with the tensor API enabled on the same machine/build (verified: correct frames + audio, 22f @ 864×480 in ~2 min with steps 20).
  • Evidence set (blank vs correct outputs, A/B logs, timings) can be provided on request.

Workaround

GGML_METAL_TENSOR_DISABLE=1 for Z-Image workloads on M5 until the tensor kernels are fixed.

Thanks for the great project — day-1 Z-Image and H3 support made this whole evaluation possible.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions