Repository navigation
[Engine] prefill: STRATA_PREFILL_LM_FORCE=1 also asks for the layer-major walk with a peer GPU - #269
Merged
Merged
Conversation
… with a peer GPU (CUDA; HIP keeps the gate)
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.
Problem and result: with
--peer-device, the layer-major prompt walk is never taken.Prefill::lm_prepareturns it down with "a peer GPU" beforeSTRATA_PREFILL_LM_FORCEis looked at, so a long prompt is read chunk by chunk and every chunk streams its experts again. After this changeSTRATA_PREFILL_LAYER_MAJOR=1 STRATA_PREFILL_LM_FORCE=1asks for the walk with a peer GPU too. On the PC below, a 32,767-token prompt is read in 33.2 s instead of 111.7 s. Nothing changes without the two variables.Related discussion: a port of my PR Niko1221/Strata#6303. The gate here keeps every case it had (a stage helper, a peer share, a peer that is configured); only the two peer cases open when the force variable is set.
Approach: the original condition is split in two, and the peer one is skipped under
STRATA_PREFILL_LM_FORCE=1. Under HIP the preprocessor keeps the line as it is on main, because the walk with a peer GPU has not been run on an AMD card.engine/sycl/src/prefill/prefill.cpphas no layer-major walk and is not touched.Validation: Windows 11, RTX 5080 16 GB with an RTX 4060 Ti 16 GB as
--peer-device 1, 31 GB of RAM, CUDA 13.4, MSVC 19.51.strata.exewas built here from main f0ab63a and from this branch (1d87af6) with the same toolchain, for sm_89 and sm_120. Model: Swift 1.5 IQ2_XS as setup installs it (the low-RAM mode:--mmap-experts, most experts read from the files, MTP drafter). CLI mode, a 32,767-token prompt of source code, 32 new tokens, one prompt a process. Time to the first token, from the engine's lastprefillline.Passed:
STRATA_PREFILL_LAYER_MAJOR=1 STRATA_PREFILL_LM_FORCE=1 STRATA_PREFILL_LM_TOKENS=32768: 33.2 s. The log saysstrata prefill: layer-major (layers 0..48): 32767 tokens in 1 super-chunk(s) of up to 32768 (R in pinned RAM ...), and 21,574 blobs were streamed.STRATA_PREFILL_LM_TOKENSchanged nothing (116.2 s against 119.3 s): the super-chunk stayed at the chunk size, 8192.strata prefill: layer-major off for this prompt: a peer GPUand 119.3 s: the variables alone do not open the walk.Failed: none observed. Every run exited 0.
Not run:
Prefill::lm_prepare, which needs a loaded model and two cards.Limits: the gain comes from reading each expert once per super-chunk instead of once per chunk, so it needs
STRATA_PREFILL_LM_TOKENSabove the chunk size. With the default size nothing changes. On this PC the walk keeps the super-chunk's rows in pinned RAM (R in pinned RAMin the log). Decode is not what this change is about; only the 32 generated tokens were compared.