b10545

ggml-org/llama.cppb10545Aug 21, 2026by github-actions[bot]same day as b10541

What changed since b10541

low risk

Metal Tensor API mat-mat kernel now clamps K extent, fixing out-of-bounds reads and NaN output for K not a multiple of 32.

Improvements

  • Metal matmul2d op switched from a static K=32 tile to a dynamic K extent derived from operand extents, with per-iteration clamping to the remaining valid K range.
  • K-aligned inputs keep the full 32-wide tile behavior, adding only a few integer edge-check operations per iteration.
  • New test-backend-ops MUL_MAT cases cover K dimensions that are not multiples of 32.

Bug fixes

  • Fixed undefined behavior in the Metal Tensor API mat-mat path where the final partial K tile read past the tensor's K extent.
  • Eliminated result corruption and NaN generation on Metal when the K dimension was not a multiple of 32.

Upgrade notes

This is a targeted Metal backend correctness fix with no CLI, config, or API changes; the --mmproj-device flag from the previous build remains available. Apple Silicon users running quantized or unaligned-K matmuls should upgrade to avoid silent NaN or corrupted outputs. No migration steps are required.

Analyzed Oct 27, 2026

Upgrading?

Release notes summary

Fixes a critical bug in the Metal Tensor API mat-mat kernel where reading out-of-bounds memory caused NaNs when the K dimension was not a multiple of 32.

Key Highlights

  • Metal K-extent clamping for unaligned dimensions
  • Fixes undefined behavior and NaN generation
  • Added tests for unaligned K dimension paths

New Features

  • Metal kernel stability fix

Release Notes (excerpt)

<details open> metal : clamp K extent in tensor API mat-mat kernel for K not a multiple of 32 (#27450) The Tensor API mat-mat path of kernel_mul_mm (GGML_METAL_HAS_TENSOR) fed a static K=32 tile to the matmul2d op on every iteration. On the last, partial K tile (ne00 % 32 != 0) the src1 slice extends past the K extent of the tensor, and the op reads those out-of-bounds elements (undefined behavior per the MSL specification, section 2.22.2). Depending on stale memory contents,…

Published by ggml-org on GitHub.

Read the full release notes

Related Repositories