#4219·Fooocus

[错误]: 在 macOS 15.7.8/15.7.9 之后, Intel Mac + AMD eGPU 上出现垃圾/噪点图像 — Metal gemv 内核在 MPS 上默默破坏 F.linear(根本原因 + 已测试的解决方案)

作者: OoZe1911创建于 2026年8月15日更新于 2026年8月15日
标签bugtriage

I tracked down the root cause. A layer-by-layer bisection of the SDXL UNet (same inputs on MPS vs CPU) showed the first corrupted outputs are `time_embed` and `label_emb` (cosine similarity ~0.64 vs CPU) while the conv layers are exact — and those two MLPs are plain `nn.Linear` running at batch size 1–2. It reduces to pure PyTorch: on the affected system, `F.linear` and `torch.mv` silently return wrong values on MPS whenever the input has ≲ 12 rows, while `torch.matmul` and `torch.addmm` are always correct. In other words, the macOS 15.7.8 update broke the Metal **gemv** (matrix-vector) kernel, at least for AMD eGPUs. Since SDXL's time/label embeddings run at batch 1–2, their corruption propagates through every ResBlock and the whole image turns to noise — with no exception raised.

内容来源: lllyasviel/Fooocus