Skip to content

pr-set: pin #385 and #386 (Inkling 2 relative-bias memory) - #392

Merged
danielhanchen merged 1 commit into
masterfrom
pinset/pin-385-386
Nov 20, 2026
Merged

danielhanchen merged 1 commit into
masterfrom
pinset/pin-385-386

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Pins #385 and #386 right after #390. Together they stop Inkling 2 from building the dense relative-position bias for the whole cache on every ubatch, which is what makes a long-context load run out of memory.

On the current set, a looped Inkling 2 Q4_K_XL GGUF with -c 1048576 -np 4 -kvu -ub 512 -fa on tries to allocate a 101,563 MiB compute buffer and the load fails (cudaMalloc failed: out of memory). The bias is gathered as F32 for every cached token x ubatch row x head, about 99 KiB per context token. With both pins the same load reserves 9,421 MiB and starts.

pin change state
#385 dense relative bias attended in chunks of query rows once a full cache passes 2^29 bias elements; below that the graph is unchanged unchanged at 8825dc242d
#386 banded flash attention for the relative bias (#378's GGML_OP_FLASH_ATTN_EXT_BANDED, plus per-query sinks, split-KV decode and a tensor-core prefill kernel), dense fallback through #385 523e46559b

#386 did not merge on top of the current set: its stacked base still had #385 from before the comment trim, so the trimmed lines in inkling2.cpp conflicted with #386's rewrite of the same block. The branch now merges #385 at 8825dc242d (the inkling2.cpp resolution keeps #386's side; the tree differs from the old head only by #385's trimmed comment in llama-graph.h) and #378 at e65c374cbe (clean). #386 is now based on base/upstream-8bf88ba93, the same upstream commit #378 uses, so its PR diff is diff(merge-base, pin). That diff includes the #378 and #385 code it builds on, at their pinned SHAs. Upstream has neither the banded op nor the chunking.

Evidence

  • sim --tags window, b12569 to b12590 (10 tags): every tag ok. model : chunk the Inkling 2 relative-bias attention over query rows #385 merges additively, model : banded flash attention for the Inkling 2 relative bias #386 cleanly, all 30 pins pass the pin contract, merge checks clean.
  • verify --cuda on b12569 (aged) and b12590 (newest): CPU gate, full CUDA build and test-chat all ok. test-backend-ops: MUL_MAT 2829/2829, MUL_MAT_ID 1177/1177, PAD 37/37, GET_ROWS 361/361. Features 17/17 on CPU and GPU, including inkling FLASH_ATTN_EXT_BANDED 53/53 and inkling2 arch rows.
  • CUDA (B200): FLASH_ATTN_EXT_BANDED 53/53 (39/39 with per-query sinks), FLASH_ATTN_EXT 4430/4430. test-llama-archs -a inkling2: 4/4.
  • audit --pr-set: 30/30 pins clean, feature-checks coverage ok.

Inkling-2-Small UD-IQ1_S, wikitext-2 -c 512 --chunks 20, --cpu-moe -fa on, this set vs current master on the same b12569 tree:

batch path PPL master PPL this set mean KLD same top
-b 2048 (4 sequences) dense, unchanged 4.253700 4.253700 0.000000 100%
-b 512 (1 sequence) banded 4.261041 4.259809 0.005825 97.098%
master -b 512 vs master -b 2048 batch-layout noise 0.005332 97.471%

The banded delta is the same size as the batch-layout noise of the existing kernels.

Looped Inkling 2 Q4_K_XL, same trees:

  • -c 512 --chunks 20: -b 2048 PPL 7.662897 on both, KLD 0. -b 512 banded KLD 0.002594, top 97.745%; layout noise 0.002372 / 97.804%.
  • -c 65536 --chunks 1: -fa off (chunked dense) PPL 6.121145 on both, KLD 0. -fa on (banded) KLD 0.002081, top 98.105%.
  • The 64K compute-buffer projection shows both paths engage: 9,659 vs 5,147 MiB with -fa off, 6,513 vs 787 MiB with -fa on.
  • llama-server compute buffer, -np 4 -kvu -ub 512 -fa on:
context master this set
262,144 25,531 MiB 2,509 MiB
1,048,576 101,563 MiB, load fails 9,421 MiB
  • DSpark draft (--spec-type draft-dspark), 4 greedy prompts x 256 tokens: output text identical, 643/1120 drafted tokens accepted on both. Target compute buffers are the same as without the draft.

Order

#386 needs #378 and #385 in the tree. Both come before it in this list.

Not covered

ROCm, Vulkan, macOS, Windows and ARM legs (nightly only). Tags after b12590. Real-weight long-context quality past 64K. No throughput A/B: the GPUs were shared.

@danielhanchen
danielhanchen merged commit d20fe00 into master Nov 20, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T20:42:23.660140Z 8f22e2e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant