Repository navigation
Conversation
…labs#339) A dflash GGUF with selector_hidden.weight (incoai/Inkling-2-Mini-DFlash2 as qwen.py converts it) runs as a DFlash2 drafter: two-tap dynamic grouped convolutions around attention and MLP, a fusion matrix over the four features, and a selector walk over the top 16 candidates of each mask row. It reuses DSpark's layer caches, feature capture, rope, attention and graph recording. DSpark files take the old path unchanged; Metal refuses a DFlash2 file. Compiles for HIP gfx1010. Not run: no card here holds Inkling 2 Mini with a drafter. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…lexai-labs#339) The drafter has its own attention: 32 query heads over 8 KV heads, while Inkling 2 Mini's target has 24. The engine checked the drafter's head count against the target's and refused the file, and it took the query width from the target too. Now the drafter's heads are read from its file (ds_heads_) for its weights, RoPE, attention and buffers. The attention kernel takes 32 query rows a KV head (4 heads of 8 block rows), up from 24. A DFlash2 file has no dflash.sample_from_anchor (a DSpark key), so absent means drafting from the mask rows. The converter: a DFlash2 file keeps target_layer_ids as they are. Its last id is the final state (48 of 48 layers), so the +1 the other DFlash drafters take would put it past the last layer. A target whose architecture the converter does not know (Inkling 2 Mini's loop model) gives the drafter its size and mask token only: the engine takes the tokenizer from the target's file. Measured on RTX 4060 (8 GB, sm_89), CUDA 13.4, Inkling-2-Mini-UD-Q4_K_XL, 8-token prompt, 64 new tokens, --window 4: the DFlash2 file loads, and with the drafter forced on (a test-only change, reverted) 7 of 13 guesses were accepted. Without forcing it, the drafter does not guess on this card: blocks are asked only when every routed expert is in VRAM (3072 experts; 758 fit here), so the output equals the no-drafter run at the same window. Not measured: the drafted output against the no-drafter output over longer runs (batched numerics differ at the window size), DSpark files (none here), and the Metal backend. Co-Authored-By: Claude Haiku 5.5 <[email protected]>
|
Thanks for the pull request. To keep the tracker readable, every item needs an area prefix in the title and the parts of the pull request template filled in. This one is missing:
Edit the pull request (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment Details: CONTRIBUTING.md |
simplexai-labs#339) ds2_topk() took the 16 best of the whole vocabulary in one block a mask row, so with 8 rows only 8 blocks ran. Now each row's vocabulary is cut into 32 ranges, one block each (ds2_topk_part_kernel), and a merge kernel takes the 16 best of the 512 partial candidates (ds2_topk_merge_kernel). Same ordering as before: value descending, a tie the lower id first. Measured on RTX 4060 (8 GB, sm_89), CUDA 13.4, Inkling-2-Mini-UD-Q4_K_XL, the 8-token prompt, 64 tokens, --window 4, drafter forced on (a test-only change, reverted): the output is byte-identical to the build before this commit; kernel time per round went from 193 us (ds2_topk) to 46 us (34 us split + 12 us merge); drafter kernels summed to 5.9 ms against 12.2 ms over the traced run. Acceptance counts differ between runs (25 of 67 and 25 of 65 guesses) because the guess policy reads wall-clock timings. DSpark files take no part in this: ds2_topk runs only on a DFlash2 file. Co-Authored-By: Claude Haiku 5.5 <[email protected]>
…e (refs simplexai-labs#339) The engine reads selector_predecessor and selector_successor as BF16. The generic q8_0 path would quantize them. Co-Authored-By: Claude Haiku 5.5 <[email protected]>
One conflict, in Inkling2::assign_scratch(). Upstream split the drafter's buffers by card (a call's features on every card; mixes and block scratch on the last). Kept that split, with the drafter's own query heads (ds_heads_) in its widths and DFlash2's buffers (ds2_cat_, ds2_enc_, ds2_dyn_, ds2_cv_, ds2_gate_, ds2_tki_, ds2_tkv_, ds2_ptki_, ds2_ptkv_) in the last card's block, where ds_commit2() and ds_block2() run. Checked: strata-poly builds for CUDA sm_86/sm_89 (CUDA 13.4); on an RTX 4060 (8 GB) with Inkling-2-Mini-UD-Q4_K_XL and --window 4, a run with no drafter, one with the BF16 DFlash2 file and one with the Q8_0 DFlash2 file give the same 64 tokens (the drafter does not guess there: not every expert is in VRAM). Not checked: HIP, SYCL, Metal, DSpark. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018j62UGHq9crCFFy7fHrCcW
…4_0 and other matrix types load (refs simplexai-labs#339) The DFlash2 drafter's head was one product of the target's whole output matrix (Q8_0, 469 MiB on Inkling 2 Mini), the largest part of its round. Now, where the output matrix is Q8_0 and the card holds every expert (STRATA_DS2_SCREEN=0 turns it off, =1 turns it on where the card does not), DSpark's 2-bit copies of the matrix score every token once for all the block's rows (ds_head_base()), the per-split best 16 of those scores are merged to the best 96 rows, which are scored exactly (Q8_0 row . q8_1 row, as the head's product does), and the exact 16 largest go to the selector as before (ds2_screen_topk()). The copy is about 144 MB of VRAM. The DFlash2 loader takes any matrix type the products take (Q8_0, Q4_0 ...), as the DSpark loader does since the last merge; before it took BF16 or Q8_0 only. Measured on an RTX 4060 (8 GB, sm_89), CUDA 13.4, Inkling-2-Mini-UD-Q4_K_XL, --window 4, the drafter forced into drafting (a test-only change, reverted: this card holds 790 of 3,072 experts), drafter GPU time a round from nsys: BF16 file 14.8 ms; Q8_0 file 3.8 ms; Q8_0 file with the screened head 2.5 ms (head 1.96 ms -> 0.67 ms). Against the exact head on two real prompts, 256 tokens (about 360 rows checked): the exact top 16's first entry found every time, 96 to 98% of its 16 entries found, the exact scores equal to 1e-5. Accepted guesses did not drop (code 119 of 214 against 116 of 238, prose 73 of 197 against 42 of 118). The drafter's extra GPU time over a 300-token prompt is about 3 ms with the Q8_0 file (the BF16 file's 320 ms was its slow products). Not checked: tokens a second against DSpark on a card that holds every expert; output equality with the undrafted run (two identical undrafted runs on this card already differ after 22 to 67 tokens, with and without --expert-swaps 0); HIP and SYCL builds; DSpark files. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018j62UGHq9crCFFy7fHrCcW
…ompt layout's (refs simplexai-labs#339) The target writes the drafter's feature taps with a stride of buf_rows_ rows (copy_rows(), ds_tap_ + k buf_rows_ E), and the DSpark commit reads them so. ds_commit2() read and wrote them with rows_. Where the engine keeps two scratch layouts (a card that does not hold every expert: one for a prompt batch, buf_rows_ = rows_, and one for a few tokens, buf_rows_ = 15), every call of a few tokens (decode, a window) then read taps 1 to 3 from offsets of 1,024 rows in a buffer of 15, and its final-state row was written 28 MB past the buffer: wrong features for the drafter, and a write outside its buffer, on every step of an answer whether or not the drafter guessed. A card that holds every expert has one layout (buf_rows_ = rows_), where the two strides are the same: nothing changes there. Measured on an RTX 4060 (8 GB, sm_89), CUDA 13.4, Inkling-2-Mini-UD-Q4_K_XL, DFlash2 Q8_0 file, --window 4 --lookup 0 (so every guess is the drafter's; the no-drafter run with lookup makes 10 of 30 and 2 of 9), 256 tokens, the drafter forced into drafting by a test-only change (reverted: this card holds 790 of 3,072 experts): code prompt: 113 of 220 guesses right, 40.4 tok/s -> 155 of 178 and 155 of 190 (two runs), 51.8 and 50.9 tok/s prose prompt: 40 of 121, 32.6 tok/s -> 115 of 165 and 118 of 209, 38.5 and 38.4 tok/s Not checked: a card that holds every expert (unchanged by construction, not run), HIP, SYCL, and Metal builds. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018j62UGHq9crCFFy7fHrCcW
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.
The title must start with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], for example "[Engine] fix decode stop on long prompts" or "[GUI] keep the model list after a tab switch".
Problem and result
Add Dflash2 support for inkling 2 (issue #330)
This is a WIP
Related discussion
Approach
Validation
Passed:
Failed:
Not run:
Limits