Repository navigation
ggml: compact bias on the existing FLASH_ATTN_EXT - #32740
Conversation
Assisted-by: Codex
… Vulkan Assisted-by: Codex
… Vulkan Assisted-by: Codex
|
Aight, changed it to the standard way of doing things. |
|
They're complementary, but this one is far more important I think because it removes the quadracity. |
|
I guess the change is OK. Would have been useful to have some description of the reasoning for making it in the PR instead of trying to figure out everything from the code. Later on, I think we might still want to add support for |
|
The discussion around Inkling 2 memory/perf has ended up spread over several issues and PRs, which makes it hard to follow. Several of them started from benchmarks before the architecture question (does FA support the bias natively, or do we materialize a per-head mask?) was settled, and a good part of that work became moot once it was. Indexed bias directly in FLASH_ATTN_EXT, with no per-head mask, is the ideal direction though. Looking forward to the backend implementations. |
|
@pwilkin @0cc4m a question about the graph side that was moved out of this PR in 9cd1953 ("move the CUDA/HIP and Inkling 2 graph changes out of this PR"). With #33016 merged and #32898 passing on RDNA2, the piece still missing for Inkling 2 to actually use the indexed bias is Setup: RX 6900 XT (RADV NAVI21, no coopmat, Mesa 25.2.8, 16 GB),
For comparison, earlier numbers with ce1e246 are in #32898 (comment). Without the graph side:
Assisted-by: Claude Opus 5.5 |
|
@Clarck1 https://github.com/ggml-org/llama.cpp/tree/pwilkin/inkling-fattn-bias-cuda is waiting for #32901 to get merged. |
|
@pwilkin But the question isn't about CUDA, why are the graph changes waiting for a CUDA PR? |
|
@0cc4m because without support, instead of going on the non-FA GPU path, the model would go on the FA CPU path, which is arguably worse. |
|
But that applies to all backends, not just CUDA. It could still fall back to non-FA, I suppose. |
|
Yup, which is why it's falling back to non-FA right now :) |
| struct ggml_tensor * a, | ||
| struct ggml_tensor * sinks); | ||
|
|
||
| GGML_API bool ggml_flash_attn_ext_has_indexed_bias(const struct ggml_tensor * a); |
There was a problem hiding this comment.
This should not be a public function - it's used only by the internal implementaiton.
|
@ggerganov the FA version is the correct one: |
Overview
This implements the compact bias needed to support the full Flash Attention for Inkling 2 models.
Additional information
Without this patch, even when FA was on, the model effectively ran a non-FA route, materializing all the intermediate activation tensors, which read to enormous amounts of VRAM usage. This patch adds support via a minimal route by adding an extra FATTN parameter, without requiring a new attention operator. Per maintainer request, this is the pure GGML contract ONLY.
Requirements