Skip to content

[Engine] prefill: STRATA_PREFILL_LM_FORCE=1 also asks for the layer-major walk with a peer GPU - #269

Merged
VecSzn merged 1 commit into
simplexai-labs:mainfrom
cobra91:pr6303-port
Nov 23, 2026
Merged

VecSzn merged 1 commit into
simplexai-labs:mainfrom
cobra91:pr6303-port

Conversation

@cobra91

@cobra91 cobra91 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Problem and result: with --peer-device, the layer-major prompt walk is never taken. Prefill::lm_prepare turns it down with "a peer GPU" before STRATA_PREFILL_LM_FORCE is looked at, so a long prompt is read chunk by chunk and every chunk streams its experts again. After this change STRATA_PREFILL_LAYER_MAJOR=1 STRATA_PREFILL_LM_FORCE=1 asks 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.cpp has 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.exe was 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 last prefill line.

Passed:

  • main, peer GPU, no variables: 111.7 s, 87,764 expert blobs streamed.
  • this branch, peer GPU, no variables: 108.7 s, the same 87,764 blobs, no layer-major line in the log, and the same 32 generated tokens as main.
  • this branch, peer GPU, STRATA_PREFILL_LAYER_MAJOR=1 STRATA_PREFILL_LM_FORCE=1 STRATA_PREFILL_LM_TOKENS=32768: 33.2 s. The log says strata 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.
  • The same change on the main of this morning (2afe585, before the last 115 commits; none of them touches this file), three runs: 30.6, 31.7 and 32.8 s, against 120.2 s on that main. On that main, the two variables without STRATA_PREFILL_LM_TOKENS changed nothing (116.2 s against 119.3 s): the super-chunk stayed at the chunk size, 8192.
  • On that main, the two variables with a peer GPU give strata prefill: layer-major off for this prompt: a peer GPU and 119.3 s: the variables alone do not open the walk.
  • The 32 tokens of the forced run are the same as those of main on one GPU with the same three variables (37.9 s, one run). They differ from the chunk-major runs from token 30 on (two different comment lines at the start of a new section), so that difference belongs to the walk with a 32K super-chunk, not to the peer GPU.

Failed: none observed. Every run exited 0.

Not run:

  • The HIP build: I have no AMD card and no ROCm here. Under HIP this branch compiles main's line.
  • The engine's unit tests: the install builds with the tests off. There is no new unit test, because the gate is inside Prefill::lm_prepare, which needs a loaded model and two cards.
  • A PC with more RAM, a model other than Swift 1.5 IQ2_XS, and a prompt shorter than two chunks.

Limits: the gain comes from reading each expert once per super-chunk instead of once per chunk, so it needs STRATA_PREFILL_LM_TOKENS above 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 RAM in the log). Decode is not what this change is about; only the 32 generated tokens were compared.

@VecSzn
VecSzn merged commit 4fe46f9 into simplexai-labs:main Nov 23, 2026
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants