﻿# llama.cpp Adreno scalar attention: a register-spill cliff can become a GPU timeout

The b12246 Adreno row cap targets register spilling for large heads; record kernel resource use and completion before generalizing timing gains.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-adreno-scalar-attention-register-spill-timeout/
Language: en

llama.cpp b12246 caps scalar Flash Attention workgroup rows for large heads on Qualcomm Adreno. The upstream analysis links the former configuration to register spills, dramatically longer dispatches and a Windows GPU timeout in a backend test. The row cap is therefore an architecture-sensitive resource intervention with a correctness-of-completion consequence.

## More rows can exceed a resource sweet spot

A configuration that processes more rows per workgroup can increase live state enough to spill registers. The PR reports this on specific Adreno paths and keeps smaller-head behaviour distinct. A proposed test varies head dimension and KV length around the affected regime while confirming the selected scalar implementation. A generic attention benchmark that selects another kernel does not test the row-cap mechanism.

## A timeout is not a numerical oracle

A dispatch that exceeds a platform timeout may never produce a result, so there is no valid output baseline from that failed case. After the fix completes, compare with a trusted reference rather than merely celebrating termination. Keep a smaller completing control on both builds. This separates a completion repair from a possible arithmetic regression introduced by changing work partitioning.

## The head-size distinction is intentional

The release limits the change to a large-head regime on Qualcomm. It does not say every Adreno shape benefits from the smaller row configuration. Preserve small-head controls and the actual device generation when testing. A tuning choice that avoids a spill cliff on one path can lose useful reuse on another, so a blanket override would test a different policy from the merged heuristic.

## Keep the dramatic upstream ratio scoped

The PR gives attributed operation and model observations on named devices. They are not a promise that all application latency improves by the worst-case kernel ratio. This article reports the resource-to-timeout mechanism and proposed tests without independent measurements. A useful result names head shape, KV extent, row configuration and completion status, then separately reports whatever prompt or generation change the full model demonstrates. Preserve the timeout policy with a reproducer, because the same slow dispatch can complete on one system and be terminated on another. That difference changes the visible failure signal without proving different arithmetic or eliminating the underlying register-pressure problem.

## Sources

- [llama.cpp b12246 release](https://github.com/ggml-org/llama.cpp/releases/tag/b12246)
- [llama.cpp pull request #30829](https://github.com/ggml-org/llama.cpp/pull/30829)

## Related reading

- [CUDA events and request time: different measurement boundaries](/journal/gpu-cuda-events-wall-time/)
- [CUDA errors: separate launch status from asynchronous execution failure](/journal/fg2-cuda-asynchronous-error-attribution-boundary/)
