Repository navigation
Prompt path: an MMQ group's experts gathered in one launch, after one wait, released by one event (-9% on a 32K prompt, same output) - #372
Conversation
8822093 to
b28f806
Compare
|
Rebased on 0.1.32 (c499bd1), no conflicts. Checked on 0.1.32: IQ2_XS (ISTA), RTX 5090, a fixed The gain on 0.1.32, the same runs (prompt reading, one run each):
0.1.32's 32 stager threads and 128-deep ring (a GGUF read in place) need nothing here: the group follows 🤖 Generated with Claude Code |
|
Tested this on the R9700. It clearly wins here too, and the per-phase timings show exactly why. Setup
Kernel launches (rocprofv3
GPU prefill timeline (
Wall clock (needle bench, fresh prompts, needle found in every arm):
Bit-identical output we didn't re-verify (only needle recall + parity through ctest), but your own logit check plus these numbers make this an easy yes for us — we're promoting it locally. Thanks for the clean change. |
|
Data point from Windows (WDDM): RTX 4080 SUPER 32 GB (sm_89, 80 SMs), Ryzen 7 5800X3D, PCIe 3.0, Windows 11, CUDA 13.3; IQ3_S at
The 8 greedy tokens after each prompt are the same with and without. A short piece is not affected: the 64K prompt is read here as 63035 + 923 tokens, and the 923-token piece waits 980-990 ms for copies either way, half of its 1.9 s. For agent turns, which add a few thousand tokens to a cached prefix, this copy wait is a large part of the time to first token on this PCIe 3.0 machine. |
|
@bsorensen110 @BlueKingMuch thank you both for testing this on your hardware (R9700 on Linux, RTX 4080 SUPER on Windows) and for the detailed numbers. 🤖 Generated with Claude Code |
… wait, released by one event In the streamed walk every expert put a cross-stream wait (its copy) and an event record (its ring slot back) on the compute stream around a ~3 us gather. Under WDDM each pair left ~10 us of GPU idle even when the copy had long landed: an nsys trace of a 32K prompt showed 226 ms of idle between back-to-back gathers while the host was 3-11 ms ahead of the GPU. Now a group of 16 is gathered by one launch (copy16_group_kernel) after one wait on its last streamed copy - the copy stream is in order - and one event releases all of its ring slots: the issuer waits on used[used_of[slot]]. A ring entry the routing skipped inside an open group first gathers what the group holds so far, so no more than a group's entries are ever held back from the issuer. The same bytes in the same group slots. STRATA_PREFILL_GROUP_GATHER=0: one at a time, as before. IQ2_XS, RTX 5090, 262K context: 32K prompt -8.6%, 8K -10%, 2K -12.6%; first-token logits bit-identical at 2K, 8K, 16K and 32K and with a 96-slot ring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
b28f806 to
936fc67
Compare
|
Rebased on 0.1.36 (936fc67).
🤖 Generated with Claude Code |
|
Released in 0.1.38 as is: a group's experts gathered in one launch, one wait, one event. Same bits here too (the prompt path's residuals at 4K and 20K are byte-identical with |
…iko1221#452 Niko1221#453, Niko1221#439 as Niko1221#372) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream v0.1.38: faster prompts (one gather per expert group Niko1221#372, the first chunk's PLE rows beside layer 0 Niko1221#374, DeltaNet three heads per thread Niko1221#413), --kv q4_0 prompts on tensor cores Niko1221#452, Q5_0 experts on the GPU Niko1221#473, IQ4_XS on AVX-2 Niko1221#415, unbuffered expert loading on Windows Niko1221#357/Niko1221#362, the --peer-device second-GPU expert tier Niko1221#531, a 6 GB card starts Niko1221#496, the Host header / DNS-rebinding checks, PR batch. Our side: the AVX1 floor (STRATA_ISA_FLOOR, cpu_avx1_ok, the relaxed gate, the scalar router fallback), the AVX1 router kernel (kq_avx1.cpp), the retune patch + setup hooks.
…iko1221#452), Q5_0 experts on the GPU (Niko1221#473), IQ4_XS on AVX-2 (Niko1221#415), unbuffered loads on Windows (Niko1221#357 Niko1221#362), --peer-device (Niko1221#531), a 6 GB card starts (Niko1221#496), PR batch; setup requires it
…iko1221#452), Q5_0 experts on the GPU (Niko1221#473), IQ4_XS on AVX-2 (Niko1221#415), unbuffered loads on Windows (Niko1221#357 Niko1221#362), --peer-device (Niko1221#531), a 6 GB card starts (Niko1221#496), PR batch; setup requires it Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0154bwiad8gY7wRehCXy27pN
The fork rebuilt on upstream 0.1.36: the conflicts (the host grouping now in prefill.cpp's non-fused branch, Niko1221#477's routing heat beside --adapt-decay, the fused sources beside NVFP4's in strata_mmq), two additions (the no-MMQ stubs matching the NVFP4 signatures; the fused path resetting Niko1221#372's used_of), the images fix through Claude Code's Read, the checks (the same logits and greedy tokens as 0.1.35-nvfp4.1 on both packs; with the fork's defaults off, upstream 0.1.36 + Niko1221#353 byte for byte) and the speed (18.96 against 18.78 ms a round, 7 runs each). README.upstream.md is 0.1.36's README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
Every prompt chunk on a native pack runs the streamed walk: for each expert the compute stream waits for its copy, gathers it into the MMQ group buffer and records an event that gives its ring slot back. The gather takes ~3 us. Under WDDM, each wait and record also leaves ~10 us of GPU idle, even when the copy landed long before.
An nsys trace of a 32K prompt shows:
What changes:
gather_native_group/copy16_group_kernelcopy a group's 16 experts in one launch, the same bytes to the same slots.used[used_of[slot]], whereused_ofmaps each slot to the event that released it. A later record of that event only waits longer.STRATA_PREFILL_GROUP_GATHER=0gathers, waits and releases one expert at a time.Same output
First-token logits are bit-identical with the switch on and off at 2K, 8K, 16K and 32K, and with a 96-slot ring (
STRATA_PREFILL_RING=96) at 8K:STRATA_DUMP_FIRST_LOGITSin a test build.--expert-cache 14900. Withautothe slot count moves by ~100 from run to run with the desktop's free VRAM, and that alone changes a first token now and then, on main too.Speed
Setup: IQ2_XS (ISTA), RTX 5090, 9950X3D, 128 GB, Windows 11,
--max-context 262144 --kv int8 --prefill auto --vram-reserve-mib 1500, cache auto. The runs alternated between the switch off and on.On an NVFP4 pack (our fork, larger experts): 32K -5.2%, 16K -7.9%, 8K -11.1%.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio