perf(draft): batch append projections across lanes - #656
Draft
Graffioh wants to merge 19 commits into
Draft
Conversation
Restore the paged-attention C ABI through a separate tree entry point. Reject unsupported GDN variants, initialize root-only chain trees, and size draft metadata from graph capacity.
Keep GDN journals inside the result buffer, restore the 10-source tensor layout, validate every tree destination before mutation, and allow selector widths that use the CPU top-k fallback.
Validate singleton selector vocabularies and token IDs before codebook gathers. Reject unsupported GDN output layouts on Vulkan, and use overflow-safe ceil division in paged attention.
Preserve paged-KV allocation order across rollback and destroy draft graphs before park frees their weights. Reject invalid GDN replay layouts and malformed SWA metadata. Exercise both grouped and scalar GDN dispatch paths.
Add fixed-width DFlash2 concurrent decoding for Qwen3.8 and batch the shared dense draft projections across active lanes. Keep convolution, cache updates, RoPE, masks, and attention lane-local. Preserve transactional state promotion and fixed-chain validation through C6.
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.
Depends on #651. While #651 is open, this draft includes its commits. The diff collapses to this follow-up when #651 lands.
Profiling campaign and rerunnable evidence: Luce-Org/luce_box#69.
Summary
Batches the fixed-width draft append projections across active lanes. The graph packs each lane's append feature columns before the shared
fc,wk, andwvmatrix multiplications. It slices the projected columns before lane-local normalization, RoPE, destination rows, and KV-cache writes.build_draft_kv_appends()a_stepfixed, so padded rows still target only each lane's trash slotbuild_draft_kv_steps(), dynamic-convolution history and apply, attention, masks, and selector ownership unchangedIsolated draft result on R9700
Qwen3.8-27B-UD-IQ4_XS, DFlash2 Q8 width 8, Q8 K/V cache, ten fixed-width HumanEval code-only waves, 256 forced tokens, temperature 0:
The dispatch reduction is exact. Eleven append projections each avoid one Q8 quantize and one MMQ launch per additional lane. The remaining block-16 Q8 launches belong to lane-local dynamic convolution and remain out of scope.
End-to-end code-prompt result
This reruns the PR #651 HumanEval-style protocol on the current #651 head and this candidate. Each cell uses a fresh server, a same-C eight-token warmup, temperature 0, natural EOS after
DFLASH_MIN_TOKENS=8, a 256-token cap, five server slots, K8 prefill admission, and two measured repetitions. C1-C4 use disjoint slices of the same ten checked-in raw prompts. llama.cpp was not rerun.The published #651 column is context. The causal comparison uses a fresh build of current #651 at
22b65ba0because the published table came from the earlier8ba84d3drestack.Radeon AI PRO R9700
Ryzen AI Max+ 395 / Strix Halo
The end-to-end goodput gain is marginal. This change remains worthwhile because the production implementation is net +29 lines, deletes the singular runtime path, removes 66 append-projection dispatches at C4, and cuts isolated C4 draft compute by 14.38%. TTFT is not a general justification because the Strix C1-C3 result regressed slightly.
All published, current-baseline, candidate, and repeat output sets have identical completion-token counts and output digests at C1-C4.
Correctness
The multilane qualification compares three independent single-lane reference graphs with one packed graph at append counts 0, 9, and 18 for
a_step=18. It checks all five K/V cache layers and explicitly verifies padded trash-row writes.Verified locally:
dflash_serverandtest_draft_swa_multilaneforgfx1151;gfx1201test_draft_swa_multilane ... dflash2-q8_0.gguf 0 --append-onlytest_qwen35_roctxtest_seq_engine_contracttest_inference_profiletest_observabilitygit diff --checkDynamic-convolution coefficient packing and the device-resident selector handoff remain separate measured PRs.