mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #439] [CLOSED] prefill: a group's expert gathers in one launch (bit-identical, long prompts +4%) #2639
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2639
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/439
Author: @architectds
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:pr/prefill-gather-batch📝 Commits (2)
320d238prefill: a group's expert gathers in one launch (mmq::gather_native_batch) - long prompts +4%, bitwise the same772a810tests: prefill_gather_batch_test - the batched expert gather against one gather per expert, byte for byte📊 Changes
5 files changed (+206 additions, -10 deletions)
View changed files
📝
CMakeLists.txt(+7 -0)📝
include/strata/prefill/moe_mmq.hpp(+14 -0)📝
src/prefill/moe_mmq.cu(+24 -0)📝
src/prefill/prefill.cpp(+61 -10)➕
tests/cuda/prefill_gather_batch_test.cpp(+100 -0)📄 Description
What
The MMQ prompt path gathered every routed expert into its MMQ group buffer with its own launch: one
mmq::gather_nativeper expert, ~22,000 per chunk on IQ3_XXS. This change launches a group's gathers together.mmq::gather_native_batchcopies up to 16 experts (MMQ_GROUP) in one kernel(
blockIdx.y= expert). The same bytes land in the same places, so the products are bit-identical.usedevent, and on the streamed walk theissuer's
consumed.STRATA_PREFILL_GATHER_ONE=1restores one launch per expert.tests/cuda/prefill_gather_batch_test(ctest,STRATA_BUILD_TESTS) compares the batch with onegather_nativeper expert, byte for byte. It covers batches of 1-16 experts, group positions starting mid-group,and the unaligned / odd-size fallback.
What it speeds up, and what it does not
own work, and the per-expert launches were part of it.
chunks every non-resident expert streams, so a 1K-token prompt copies about as much as an 8K one. The launches were
hidden behind those copies.
STRATA_PREFILL_TIMING: its "dequant" phase (22-42% of the GPU timeline here) overstates the launchcost, because the timer adds events of its own per expert. The table below is uninstrumented.
Measured
Setup:
--vram-reserve-mib 1900: 4,560 expert slots),--prefill auto(8,192-token chunks).
reused.
Exactness:
STRATA_PREFILL_DUMP_R(the prompt path's final residuals at every 64th position) is byte-identical between thetwo modes for prompts of 128, 256, 512, 1,024, 2,048, 4,096, 8,192 and 9,200 tokens. That covers the staging
path, the streamed walk, and a two-chunk prompt.
prefill_gather_batch_testpasses.Not tested here:
uint4,dim3launches).Developed with an AI coding assistant; all numbers measured on the machine above.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.