Repository navigation
moe-stream: prefetch on a worker thread, N layers ahead; ONEBIT_MOE_STATS - #20
Merged
bong-water-water-bong merged 2 commits intoSep 26, 2026
Merged
Conversation
…T_MOE_STATS The gate-ahead scoring ran scalar inside the remap op, on the decode path: about 0.15 ms per MoE layer, so prefetch lost (Qwen3-Coder-30B, 4608 slots: 28 tok/s against 40 without it). A worker thread now scores the next ONEBIT_MOE_PREFETCH layers (default 1), skipping any whose remap has started: 43.5-44.8 tok/s at depths 1-2 against 42.3 without. Perplexity unchanged (21.1029, batch 1). ONEBIT_MOE_STATS=1 prints the time split and cache counters at exit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Zamba v1's head count test-generate-models aborted on Zamba2 (head size n_embd/n_head, but its attention runs on the 2 * n_embd concat), then on BlackMamba (built dense, it has no experts; with n_ff on every layer no Mamba layer uses the recurrent state), and test-save-load-state on Zamba v1 (the saver wrote ssm_n_group, which Zamba v1 keeps at 0). The five tests after it never ran. ctest -L main on CPU: 52/52. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
merged commit Sep 26, 2026
a29be7f
into
1bit/vulkan-upstream
9 of 11 checks passed
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 gate-ahead scoring ran scalar inside the remap op, on the decode path. That cost about 0.15 ms per MoE layer, so prefetch made decode slower.
ONEBIT_MOE_PREFETCHlayers (default 1; 0 turns prefetch off) with an 8-lane dot. It skips any layer whose remap has already started.ONEBIT_MOE_STATS=1prints at exit: time in remap, time waiting for reads, time between remaps, and the cache counters.Qwen3-Coder-30B Q4_K_M, llama-bench
-n 64 -r 4, warm reps (tok/s):At 1536 slots, decode is bound by the drive: about 88 misses x 2.1 MB per token, ~2.4 GB/s effective. Prefetch cuts demand misses from 22.9% to 7%, but it adds wasted reads. The per-layer gap between remaps (0.37 ms, i.e. GPU work plus the host round trip) caps streamed decode at about 57 tok/s, against 80 resident.
Perplexity with prefetch 1 and 2 (1536 slots, batch 1): 21.1029, the same as all-Vulkan.
Also fixes the CI Test step, which was already red on
1bit/vulkan-upstream(PR #19 too), in a separate commit:test-generate-modelsaborted on Zamba2, because the test gave it head size n_embd/n_head while its attention runs on the 2 * n_embd concat.test-save-load-statethen failed on Zamba v1: the saver wrote ssm_n_group, which Zamba v1 keeps at 0. It now writes the head count from ssm_x.ctest -L mainon CPU: 52/52.🤖 Generated with Claude Code