<details open> ggml : clean up FA bias API (#33178) * ggml : validate indexed bias at op construction only The indexed-bias check already runs in ggml_flash_attn_ext_add_indexed_bias(), so the backend checks were redundant. Make the validator static in ggml.c, drop the ggml-impl.h declaration, and remove the CPU supports_op case, the CPU compute assert, and the CUDA kernel-selection check. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : rename FA indexed bias to bias_indexed Add internal ggml_flash_attn_ext_has_bias() and ggml_flash_attn_ext_bias_is_indexed() helpers and derive the bias state from src[6]/src[7] instead of op_params[5]. Rename ggml_flash_attn_ext_add_indexed_bias() to ggml_flash_attn_ext_add_bias_indexed() and keep the old public names as deprecated wrappers. Rename the remaining indexed_bias identifiers to bias_indexed, including the CUDA kernel templates and the HIP metrics script. Reject non-indexed bias in the CPU, CUDA and Vulkan backends; backends without bias support reject any bias. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : rename FA indexed bias validator Name the static validator after the function it validates: ggml_flash_attn_ext_add_bias_indexed_validate(). Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : keep src order in FA bias validation Reorder the src tensor declarations in the indexed-bias validator to follow the src index order. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : mark FA bias wrappers as deprecated Add the deprecated marker above the old indexed-bias wrapper implementations. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : generalize FA bias API Rename ggml_flash_attn_ext_add_bias_indexed() to ggml_flash_attn_ext_add_bias() and rename its arguments to bias and bias_idxs. When bias_idxs is NULL, the bias is validated as a dense K*Q tensor with shape [n_kv, n_batch, n_head_kv, n_stream]; otherwise it remains an indexed bias table. Update the deprecated wrapper to stay indexed-only, and align the table/indices naming in llama-graph, CPU, CUDA, Vulkan and the tests. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : move FA bias args after kv_rows Reorder the bias and bias_idxs arguments of build_attn_mha() to follow kv_rows, and update all call sites. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : deduplicate FA kq_b and bias Remove the kq_b argument from build_attn_mha() and build_attn_iswa_impl() and pass the dense KQ bias through bias with bias_idxs == nullptr. The FA path now rejects a dense bias and adds an indexed bias without backend checks. The non-FA path adds a dense bias directly to kq. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : inline dense bias mask Inline the dense_bias_mask lambda into the non-FA path, now its only use. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : add FA bias to mask in non-FA path Add both indexed and dense FA biases to the mask in the non-FA path so they are scaled by the ALiBi slope, matching the FA path. Remove the kq-side addition for dense bias. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : remove redundant non-FA mask cast The non-FA path already implies soft_max_ext can consume an F32 mask, so drop the cparams.flash_attn check and the F16 cast. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : cast FA bias to mask type Compute the non-FA bias in F32 and cast it to the mask type before adding, instead of casting the mask to F32. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : remove FA bias TODO Remove the TODO after confirming that adding the bias to the mask is correct. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : guard FA dense bias in validation Add a CPU compute assert for the indexed-bias assumption, reject the dense bias in ggml_flash_attn_ext_add_bias_validate with a TODO, and update the backend comments to say bias. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : document FA bias scaling Note that the bias is added after the KQ scaling. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : rename FA add sinks/bias to set Rename ggml_flash_attn_ext_add_sinks to set_sinks and deprecate the old name. Rename ggml_flash_attn_ext_add_bias to set_bias. Allow set_sinks to override existing sinks. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : set FA bias unconditionally Call ggml_flash_attn_ext_set_bias() unconditionally and move it before ggml_flash_attn_ext_set_sinks(). Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml-cuda : fix sparse bias template names Rename the remaining indexed_bias references in the sparse FA code added by master. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) </details> **Website:** - <https://llama.app> **Attestations:** - <https://github.com/ggml-org/llama.cpp/attestations/74030619> **macOS/iOS:** - [macOS Apple Silicon (arm64)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-macos-arm64.tar.gz) - macOS Apple Silicon (arm64, KleidiAI enabled) [DISABLED](https://github.com/ggml-org/llama.cpp/pull/23780) - [macOS Intel (x64)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-macos-x64.tar.gz) - [iOS XCFramework](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-xcframework.zip) **Linux:** - [Ubuntu x64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-x64.tar.gz) - [Ubuntu arm64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-arm64.tar.gz) - [Ubuntu 24.04 s390x (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-s390x.tar.gz) - [Ubuntu 26.04 s390x (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-26.04-s390x.tar.gz) - [Ubuntu 26.04 s390x (zDNN)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-zdnn-s390x.tar.gz) - [Ubuntu x64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-vulkan-x64.tar.gz) - [Ubuntu arm64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-vulkan-arm64.tar.gz) - [Ubuntu x64 (CUDA 12)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-cuda-12.8-x64.tar.gz) - [CUDA 12.8 libraries](https://github.com/ggml-org/llama.cpp/releases/download/b12859/cudart-llama-b12859-bin-ubuntu-cuda-12.8-x64.tar.gz) - [Ubuntu x64 (CUDA 13)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-cuda-13.5-x64.tar.gz) - [CUDA 13.5 libraries](https://github.com/ggml-org/llama.cpp/releases/download/b12859/cudart-llama-b12859-bin-ubuntu-cuda-13.5-x64.tar.gz) - [Ubuntu arm64 (CUDA 13)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-cuda-13.5-arm64.tar.gz) - [CUDA 13.5 libraries](https://github.com/ggml-org/llama.cpp/releases/download/b12859/cudart-llama-b12859-bin-ubuntu-cuda-13.5-arm64.tar.gz) - [Ubuntu x64 (ROCm 10.0)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-rocm-10.0-x64.tar.gz) - [Ubuntu x64 (OpenVINO)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-openvino-2026.4.1-x64.tar.gz) - [Ubuntu x64 (SYCL FP32)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-sycl-fp32-x64.tar.gz) - [Ubuntu x64 (SYCL FP16)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-ubuntu-sycl-fp16-x64.tar.gz) - [Linux arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-linux-arm64-snapdragon.tar.gz) - [setup guide](https://github.com/ggml-org/llama.cpp/blob/master/docs/backend/snapdragon/linux.md) **Android:** - [Android arm64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-android-arm64.tar.gz) - [Android arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-android-arm64-snapdragon.tar.gz) - [setup guide](https://github.com/ggml-org/llama.cpp/blob/master/docs/backend/snapdragon/README.md) **Windows:** - [Windows x64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-cpu-x64.zip) - [Windows arm64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-cpu-arm64.zip) - [Windows arm64 (OpenCL Adreno)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-opencl-adreno-arm64.zip) - [Windows x64 (CUDA 12)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-cuda-12.4-x64.zip) - [CUDA 12.4 DLLs](https://github.com/ggml-org/llama.cpp/releases/download/b12859/cudart-llama-bin-win-cuda-12.4-x64.zip) - [Windows x64 (CUDA 13)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-cuda-13.5-x64.zip) - [CUDA 13.5 DLLs](https://github.com/ggml-org/llama.cpp/releases/download/b12859/cudart-llama-bin-win-cuda-13.5-x64.zip) - [Windows arm64 (CUDA 13)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-cuda-13.5-arm64.zip) - [CUDA 13.5 DLLs](https://github.com/ggml-org/llama.cpp/releases/download/b12859/cudart-llama-bin-win-cuda-13.5-arm64.zip) - [Windows x64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-vulkan-x64.zip) - [Windows arm64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-vulkan-arm64.zip) - [Windows x64 (OpenVINO)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-openvino-2026.4.1-x64.zip) - [Windows x64 (SYCL)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-sycl-x64.zip) - [Windows x64 (ROCm 10.0)](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-bin-win-rocm-10.0-x64.zip) **openEuler:** - [DISABLED](https://github.com/ggml-org/llama.cpp/pull/23705) - openEuler x86 (310p) - openEuler x86 (910b, ACL Graph) - openEuler aarch64 (310p) - openEuler aarch64 (910b, ACL Graph) **UI:** - [UI](https://github.com/ggml-org/llama.cpp/releases/download/b12859/llama-b12859-ui.tar.gz)
AI NEWS JOURNAL
llama.cpp releasesAI NEWS / JOURNAL
b12859
The ggml library has been updated to clean up the Flash Attention (FA) bias API by renaming functions, removing redundant checks, and generalizing the bias handling. The changes include renaming indexed-bias functions to use 'bias_indexed', introducing a unified 'ggml_flash_attn_ext_add_bias' function that handles both dense and indexed biases, marking old wrappers as deprecated, and ensuring consistent behavior across CPU, CUDA, Vulkan, and other backends. Additional improvements include fixing template names, improving validation order, and clarifying documentation on bias scaling.