The new llama.cpp prerelease, a trial build distributed before a formal release, fixes incorrect attention mask reads during WebGPU model execution. Attention masks hide items from a calculation. It also fixes underestimates of shared memory, storage used by multiple tasks. For developers using this execution mode, the update addresses causes of both incorrect results and memory limit violations.

1. Read the correct mask slice for each head

Inkling 2 has one mask slice for each head, a unit that splits attention computation. The previous GPU shader did not account for the head index when locating mask data, producing incorrect results in operations with per-head masks. The operation test that added this case also failed on WebGPU.

PR #32394 changes mask position calculations to include the head index. When mask slices repeat across multiple heads, it uses the remainder of the head index divided by the number of slices. This follows the same broadcasting rule used by the CPU and other backends, repeating values from a smaller array to match.

The vector path also handles intermediate state separately for each mask head. This change allows per-head mask operations to run instead of being rejected as unsupported. The relevant shader dispatch mapping and mask head indexing are shown below.

    // Dispatch mapping:
    //  - x indexes KV blocks
    //  - y flattens (batch_idx, mask_head, q_blk) as y = (batch_idx * mask_ne2 + mask_head) * nblk1 + q_blk
    let kv_blk = wg_id.x;
    let y = wg_id.y;
    let q_blk = y % params.nblk1;
    let mask_head = (y / params.nblk1) % params.mask_ne2;
    let batch_idx = y / (params.nblk1 * params.mask_ne2);

2. Align key and value memory estimates with actual usage

WebGPU's Flash Attention implementation either loads keys and values into fast memory shared by a workgroup, a group of GPU tasks, or reads them directly. Previously, the estimate excluded shared memory for both if either keys or values were read directly. The shader excluded that space only when both were read directly.

This mismatch underestimated actual usage when keys were f16 and values were q8_0, exceeding the workgroup storage limit. The fix excludes that space from the estimate only when both keys and values are read directly. This keeps the shared space actually needed in the calculation even when different storage formats are combined.

3. Account for viable execution paths in support checks

Memory allocation size calculations and operation support checks now use the same memory rules as the actual execution path. Support checks also account for switching to another computation path when the matrix operation path does not fit in storage. This reduces cases where an operation is deemed unsupported solely because one path lacks memory.

Correctly handling per-head masks requires more auxiliary memory. The WebGPU parameter buffer grew from 128 bytes to 256 bytes as fields for mask information were added. Intermediate mask state storage in the vector path is also allocated according to the number of mask heads. The benefit is more accurate results and support checks; the cost is space to store additional information.

4. The author reported 3996 passing WebGPU operation tests

The PR author reported that running test-backend-ops -o FLASH_ATTN_EXT on NVIDIA WebGPU using Dawn in CI, the automated build and test environment, passed all 3996 tests. These included 48 per-head mask cases that had previously caused problems. This covers 3996 Flash Attention tests, including 48 per-head mask cases, not all operations. It is distinct from the separate report that ctest -L main passed.

The author also reported passing additional tests with the GGML_SCHED_NO_REALLOC environment variable set. The Apple runner tests the subgroup matrix path, which performs matrix calculations in small groups of tasks within the GPU.

The PR was merged on November 16, 2026, and the b12441 prerelease was published the same day. Binaries for multiple operating systems are available on the release page. This build is directly relevant for developers who encountered WebGPU issues involving per-head masks or combinations of key and value storage formats.

This build corrects WebGPU computation results and memory-based support checks, while increasing auxiliary storage needed for per-head mask handling.