Repository navigation
Studio: size Inkling 2's banded relative-bias attention for the next llama.cpp prebuild - #18692
Merged
Merged
Conversation
…llama.cpp prebuild
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#18689 sized the Inkling 2 compute buffer for the dense relative-position bias (
512 * (8 * n_head + 4 + 2)bytes per context token at ub=512). The next llama.cpp prebuild replaces that path in the common case:--kv-unified, ub=512) takes this path.With the dense rate, Studio would overestimate the banded buffer by about 11x (77531 vs 7236 MiB at 800K) and pick a much shorter context than fits.
Fix
In
_compute_buffer_ctx_bytes, theinkling2branch now:[ub, ub, n_head]block;Verification
CUDA0 compute buffer of llama-server from the shipped mix source plus #385, #386 and #389 at
3b34f4f, on an RTX 6000 Ada, Inkling-2-Mini UD-Q4_K_XL,--kv-unified, compared with Studio's estimate:On the banded path the estimate is 0.1% to 2.3% above the measurement with 4 slots, and 16% above with 1. The dense fallback stays at or above the measurement, except at 32K without flash attention, where it is 14 MiB (0.3%) below. Above that it is 1.4x to 3.5x high. It only applies to non-default configurations.
Tests:
test_compute_buffer.pychecks the banded table (at or up to 20% above the measurement), the dense fallback staying above the chunked buffer, the two rates, which configurations take the dense path, and the layer-split delta on both paths.test_compute_buffer.pyandtest_kv_cache_estimation.pypass locally.