Skip to content

model: use the indexed bias in the Inkling 2 graph - #33053

Merged
pwilkin merged 3 commits into
masterfrom
pwilkin/inkling2-graph-fattn-bias
Nov 25, 2026
Merged

pwilkin merged 3 commits into
masterfrom
pwilkin/inkling2-graph-fattn-bias

Conversation

@pwilkin

@pwilkin pwilkin commented Nov 25, 2026

Copy link
Copy Markdown
Member

Overview

Enables the efficient indexed bias FATTN path in the Inkling 2 graph so that backends can start enabling it.

Additional information

Currently, no backends support it, so it will fall back to the dense path, requiring large amounts of VRAM for context. Backend support will be added gradually.

Requirements

@pwilkin
pwilkin requested review from a team and CISC as code owners November 25, 2026 17:00
Comment thread ggml/src/ggml-rpc/ggml-rpc.cpp Resolved
@github-actions github-actions Bot added model Model specific ggml changes relating to the ggml tensor library for machine learning labels Nov 25, 2026
@CISC

CISC commented Nov 25, 2026

Copy link
Copy Markdown
Member

@pwilkin Mind reviewing RAON-1 PR so it can proceed (fix your notifications)? :)

@pwilkin
pwilkin merged commit 2d5b3dd into master Nov 25, 2026
21 of 22 checks passed
ljedrz added a commit to ljedrz/llama.cpp that referenced this pull request Nov 26, 2026
The gathered bias was made contiguous in the mask layout before the add; the add now takes the permuted gather and writes the contiguous mask itself. This is the layout the SYCL fusion of the gather and the add (GET_ROWS, RESHAPE, PERMUTE, ADD) matches.

Port of a707963 ("model : inkling2 gathers the relative bias without two CONTs") onto the indexed bias of ggml-org#33053: the table layout is now the one flash attention takes, so the CONT of the table for the gather stays.

Assisted-by: Claude Opus 5.5
ljedrz added a commit to ljedrz/llama.cpp that referenced this pull request Nov 26, 2026
The relative-position bias without flash attention is added to the mask as a new n_kv x n_tokens x n_head tensor. Built after KQ, the gathered bias, the sum and KQ were all alive at once. Expanded before KQ, the gathered bias is freed first, so two such tensors are the peak instead of three.

Inkling 2 Mini, Arc Pro B70, llama-server with --flash-attn off (measured before the rebase onto ggml-org#33053, whose non-FA path also makes the table contiguous for the gather: not re-measured): compute buffer at 65536 ctx / -ub 512 9652 -> 6584 MiB. With --spec-draft-n-ubatch 64 the server starts with ctx 131072 at -ub 256 (was 73728 at -ub 512 / -ub 64 for 262144) and runs a 124K token prompt: 670 s at -ub 64 -> 530 s at -ub 256. KLD over 6 chunks of wikitext-2: 0.0024 (-ub 64), 0.0019 (-ub 256), 0.0022 (-ub 4), at the noise of the backend.

Assisted-by: Claude Opus 5.5
ljedrz added a commit to ljedrz/llama.cpp that referenced this pull request Nov 26, 2026
The table product took R as [n_relative, n_head, n_tokens], so the 2D bias table was broadcast over the tokens and the SYCL backend ran it as one small GEMM per token (49152 oneMKL calls per 1024-token step). R is now reshaped to [n_relative, n_head*n_tokens] for one GEMM and the table back to [n_dist, n_head, n_tokens], as before ggml-org#33053.

Inkling 2 Mini, Arc Pro B70, -fa 1 -ub 1024: pp4096 2027 -> 2352 t/s, pp1024 @ d32768 1757 -> 2008, tg64 unchanged; KLD on the 4096 chunk unchanged (0.001432).

Assisted-by: Claude Opus 5.5
Mr-J-369 pushed a commit to Mr-J-369/llama.cpp-Android that referenced this pull request Nov 26, 2026
* use the indexed bias in the Inkling 2 graph
* Remove RPC check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning model Model specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants