﻿# Why test Metal graph fusion at several microbatch sizes?

llama.cpp b12840 makes a Metal ADD fusion check independent of microbatch size. Exercise graph reuse while changing the shape of work.

Author: Retrivium editorial team
Updated: 2026-11-29
Canonical URL: https://retrivium.ai/journal/daily-20261129-compute-llama-metal-fusion-ubatch/
Language: en

On November 28, llama.cpp published b12840 with a change to the Metal ADD fusion rule. The note explains that bias and residual addends could share a layout for a single-token microbatch while belonging to different buffers. Changing the microbatch could change how nodes were packed and ordered. A scheduler reservation built for another ordering could then require an unexpected reallocation. The update requires the addends in a fused chain to share a backend buffer.

## Keep the model and allocation mode constant

Run the same model revision, backend and memory settings for the full comparison. Start with a small decode step and follow it with a larger unit of work in the same process. The order matters because exercising independent processes can hide a reuse issue. Include a repeated small step after the larger workload to observe whether returning to the usual decode path is stable.

## Test normal generation and draft verification

A static configuration can still see different microbatch shapes during interactive generation or speculative verification. The maintainers report tests with several verification sizes and a Nemotron graph. Treat those as the project's reported coverage. Choose representative inputs from the specific model family and scheduling mode in your deployment, then check generation succeeds through each transition.

## Observe memory and output together

Track graph reservations and unexpected allocations in staging. Record the peak resident memory and compare deterministic outputs or agreed numerical tolerances. An allocation warning can precede poor reliability, and a run that merely stays alive can still produce different results. Check the compiler, Metal device and source build along with settings for each test.

## Evaluate performance after the correctness gate

Use a fixed input and add repeated mixed workloads to characterize latency distribution. Compare throughput within the same microbatch configuration before generalizing across configurations. This approach separates an improvement in graph reuse reliability from the decision to use bigger batches for throughput.

## Sources

- [Primary source · llama.cpp b12840](https://github.com/ggml-org/llama.cpp/releases/tag/b12840)
- [Primary source · llama.cpp #33217](https://github.com/ggml-org/llama.cpp/pull/33217)

## Related reading

- [Related guide · News llamacpp metal flash attention scratch guard](/journal/news-llamacpp-metal-flash-attention-scratch-guard/)
- [Related guide · M5 macbook air sustained mlx metal owner tests](/journal/m5-macbook-air-sustained-mlx-metal-owner-tests/)
