[PR #2690] [Engine] verify: STRATA_VERIFY_DEFER_CPU=1, a layer's light CPU expert rows join at the next layer's FFN half (heavy rows on time, 0.1 by default; opt-in) #4214

Open
opened 2026-11-07 15:34:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2690
Author: @lask3802
Created: 10/15/2026
Status: 🔄 Open

Base: main ← Head: verify-defer-heavy


📝 Commits (9)

  • 19aede1 verify: STRATA_VERIFY_DEFER=1, a layer's CPU expert rows join the residual before the next layer's FFN-side read
  • 1a99ad3 verify: STRATA_VERIFY_DEFER, review: the zeroed rows by a kernel, the hits in the combine, a profile slot, docs
  • 1750313 verify: STRATA_VERIFY_DEFER_HEAVY=, a deferred layer keeps its CPU rows of routing weight >= w on time
  • d4deb0c verify: STRATA_VERIFY_DEFER is now STRATA_VERIFY_DEFER_CPU
  • f4ab7e7 verify: STRATA_VERIFY_DEFER_HEAVY is now STRATA_VERIFY_DEFER_CPU_BELOW, 0.1 by default
  • 53858fd verify: STRATA_VERIFY_DEFER_CPU_BELOW, review: start-up lines and docs
  • 0f15f75 verify: STRATA_VERIFY_DEFER_CPU on 0.2: off with STRATA_PCIE_BALANCE=1, docs for the cold overlap
  • a7b5c88 verify: STRATA_VERIFY_DEFER_CPU on 0.2.3: off while the DFlash2 taps run
  • 2e57231 verify: with the DFlash2 taps, deferral is off from the start

📊 Changes

10 files changed (+469 additions, -17 deletions)

View changed files

📝 docs/DETAILS.md (+63 -0)
📝 include/strata/core/expert_source.hpp (+6 -0)
📝 include/strata/core/peer_experts.hpp (+5 -0)
📝 include/strata/core/verify.hpp (+15 -0)
📝 include/strata/kernels/verify_kernels.hpp (+14 -0)
📝 src/core/expert_source.cpp (+45 -4)
📝 src/core/peer_experts.cpp (+3 -0)
📝 src/core/verify.cpp (+235 -13)
📝 src/kernels/cuda/verify_kernels.cu (+80 -0)
📝 src/program/generate.cpp (+3 -0)

📄 Description

Problem and result

On one GPU with experts in RAM, every decode layer waits for the CPU pool's expert rows before its combine, and the
GPU idles while the CPU computes. This PR adds an opt-in setting, STRATA_VERIFY_DEFER_CPU=1, that lets a layer go on
without the CPU's light expert rows and add them one step later, so the CPU computes them while the GPU runs the next
layer's mixer.

  • Before, and after with STRATA_VERIFY_DEFER_CPU unset or 0: unchanged. No allocation, no graph node, no kernel
    choice and no host step changes. (With STRATA_VERIFY_PROFILE or the #649 trace on, the profile has one more stamp
    at the end of the mixer's out-projection: "late rows", near 0 then.)
  • After, with STRATA_VERIFY_DEFER_CPU=1: the CPU rows of routing weight below 0.1 (STRATA_VERIFY_DEFER_CPU_BELOW)
    join layer l at layer l+1's FFN half; the heavier ones are waited for in their own layer. This changes the
    output.
    On 0.2.0-beta, on an RTX 2080 Ti alone, it is +15.4% decode tok/s at low context at a teacher-forced KL of
    0.098 against the default (Validation). On the same run the placement floor (the default with 6% more expert
    slots) is 0.030 and the shipped route tail skip's own KL is 0.064, so on this card the deferral costs about 1.5x the
    tail skip. On the earlier base of this PR (v0.1.44.1, an RTX 3080) it was +15.8% at a KL of 0.088, about the tail
    skip's 0.083 there.

This PR is now rebased on main (0.2.0-beta) after the tracker reset; the earlier description was for v0.1.44.1.

  • #2689 (deferring every CPU row) was folded into this PR and closed before the tracker reset.
  • No scope issue. The change is opt-in and changes no default.

Approach

With STRATA_VERIFY_DEFER_CPU=1:

  • post(l) combines without the CPU's light rows (routing weight below STRATA_VERIFY_DEFER_CPU_BELOW, 0.1 by default)
    and does not wait for them. It waits only for the heavy rows: the pool computes the experts of the CPU entries whose
    weight is >= w first, raises a new mapped flag (h_pflag_, to the layer's ring), then computes the rest. The rows
    come out as in one pass: the pool cuts its phases by output rows, so only the order of the jobs changes. post(l)
    combines the heavy rows with a new kernel copy_rows_by_weight (the plan's GPU rows zeroed as
    copy_rows_from_mapped does).
  • pre(l+1) runs its mixer (attention or GDN), then waits for layer l's flag, copies the light rows and adds them to the
    residual with layer l's own routing weights and pending-write coefficient, 2*sigmoid(inject/hc) (new kernel
    defer_add_rows), then does its FFN-side read as usual.
  • In a window that defers, the doorbell publishes the routing weights too (doorbell_publish, the variant
    --remote-expert-opt uses), and run / service hand the pool the weights and a partial hook for the deferred
    layers.

Nothing the late addition reads is overwritten before it: pre(l+1)'s attention-side read writes inj_ (not layer l's
inj2_), and its router (w_), the next plan (plan_, skip_) and its doorbell come after the addition. So the
host's next expert step never rewrites the doorbell payload or h_ymiss_ earlier than without deferral, and no buffer
is doubled.

Not deferred: the stage's last layer, and layer 0 when layer 1 runs the PLE block. Windows that run without deferral
(one line at the first capture says which and why): batch windows, --spec-split token groups, --remote-expert-opt,
STRATA_PCIE_BALANCE, the all-resident graph (no CPU rows), a stage with no layer to defer, a control vector on the
stage.

The split is turned off, and every CPU row joins late, when the verifier takes the device plan
(STRATA_VERIFY_DEVICE_PLAN=1) and with --peer-device or a helper cache (--expert-cache-device1..3), whose rows
land after the CPU's (one start-up line). run and service raise the partial flag after every pool call, so a layer
the pool did not split never leaves a GPU wait behind. The new flag is released with the others before the engine
ends (#267) and shows in the stall diagnostics.

STRATA_VERIFY_DEFER_CPU=check runs the same steps but adds the rows back right after layer l's own combine: no
deferral, the default's sums in another order.

What changed in the rebase on 0.2.0-beta (two places where 0.2's code meets the deferral):

  • STRATA_PCIE_BALANCE=1 times each layer's wait for the CPU rows in its GPU fit, and a deferred layer does not make
    that wait. With both set, init turns the deferral off with one line, and defer_ok refuses a window with balance
    stamps.
  • The 149-cold batches (STRATA_COLD_OVERLAP=1, 2 or 3) compute a layer's CPU experts in batches, inside the job
    loop, when some of their reads are still pending. Such a layer is not split: it waits for all its CPU rows (one
    line, said once). With mode 0 or 4 (4 is the Linux default for the GGUF read in place, which reads everything before
    the pool runs) nothing changes for the split.

Compatibility: SYCL (sycl/) has its own copies of every touched source and header except verify_kernels.hpp,
which only gains declarations, so nothing it compiles changes. On Metal the calls of the new entry points are
compiled out (#if !defined(STRATA_GPU_METAL)); the Metal window returns from init before the env is read. HIP
compiles the same CUDA sources.

Docs: a DETAILS.md section next to the route tail skip and the PCIe share.

Rebased onto 0.2.4.1 (2026-10-24)

This head is the branch rebased onto main 8183c6b6 (v0.2.4.1 and one docs commit, engine 0.1.49.1). The rebase applied
with no conflicts, and git range-diff against the 0.2.3 head (af16b23a) shows every commit as the same patch.

Checked on this head (Linux, the build of the runs below): the build and five CPU tests (conv_cache_test,
spec_prob_test, batch_rows_test, conversation_validation_test, conversation_transfer_test) passed. Not run
on this head:
the Windows build and ctest.

GPU runs on this head (2026-10-24). The same RTX 2080 Ti and runs as in the 0.2.3 section below (this head's
Linux build against main's, the same model, slices and prompts). The CI container on the host used 0 cores in
every arm. In the 0.2.3 section below, "this head" means the 0.2.3 head (af16b23a).

check 0.2.4.1 (this head) 0.2.3 (af16b23a)
default path (no variable) against main: top-20 logits, 15,175 positions byte-identical byte-identical
=1 against unset: KL mean ± sd / top-1 agreement 0.0962 ± 0.1676 / 93.83% 0.0962 ± 0.1676 / 93.83%
=check against unset 0.0187 ± 0.0219 / 97.64% 0.0187 ± 0.0219 / 97.64%
=1 with STRATA_VERIFY_DEFER_CPU_BELOW=1 against unset 0.4488 ± 0.8969 / 86.51% 0.4488 ± 0.8969 / 86.51%
low-context decode, unset / =1 (median of 3 rounds) 53.42 / 61.25 tok/s (+14.7%) 53.61 / 60.86 tok/s (+13.5%)
~32K decode, unset / =1 (median of 3 prompts) 45.85 / 47.60 tok/s (+3.8%) 45.75 / 51.15 tok/s (+11.8%)

The KL rows are the same as on 0.2.3 because the logits are: main's top-20 file and the =1 file of this head are
byte-identical to 0.2.3's (md5 of each run's file).

The speed rows are four arms in the order unset, =1, =1, unset, and each cell is the mean of its two arms. At low
context the two arms of each agree within 0.3 tok/s (unset 53.29 / 53.55, =1 61.13 / 61.37). At ~32K they spread
by about 2 tok/s (unset 46.9 / 44.8, =1 48.6 / 46.6), while on 0.2.3 they did not (unset 45.8 / 45.7, =1 50.8 /
51.5). Both =1 arms here are 2.2-4.9 tok/s below both of 0.2.3's, with unset about the same, so the smaller ~32K
gain on this head looks real; its cause is not known, and the ~32K arms were not run again.

Rebased onto 0.2.3 (2026-10-23)

This head is the branch rebased onto main 5c8dd322 (v0.2.3, engine 0.1.48), plus two commits for 0.2.3's DFlash2
drafter.

The conflict. Git stopped at one conflict, in record_window's post(l). Upstream's new tap block (the DFlash2
drafter's hidden states) and the =check late_add sit at the same spot. The late_add goes first, so in =check a
tapped layer output holds the layer's own CPU rows, as it does on the default path.

The two new commits. With =1, a deferred layer's light rows join only in pre(l+1). A tap copies layer l's
output in post(l), so it would miss those rows, and the drafter (--draft dflash2) or the STRATA_TAP_FILE dump
would read different hidden states. With the taps on, there is now no deferral:

  • init says so in one start-up line and clears the flags.
  • defer_ok says no for every window, as it does for STRATA_PCIE_BALANCE.

docs/DETAILS.md lists the taps among the cases that run without deferral. The drafter is CLI-only and opt-in, so
the default path and the --serve path are unchanged.

Checked on this head (Windows, MSVC 19.44 + CUDA 13.0):

check result
build (every target but hc_persist_parity) passed
ctest overall 80 of 85 passed

The other 5 fail the same way on v0.2.3 itself in the same environment:

  • hc_persist_parity and hc_persist_default_off: the test calls setenv, which MSVC does not have.
  • gemm_bf16_parity and gr_upmix_parity: the CUDA DLLs are not on ctest's PATH. With them on the PATH,
    gemm_bf16_parity passes and gr_upmix_parity fails 21 cases on both.
  • ple_parity: it needs a model file.

GPU runs on this head (2026-10-23). The same RTX 2080 Ti and runs as in Validation (this head's Linux build
against v0.2.3's, the same model, slices and prompts):

check 0.2.3 (this head) 0.2.0-beta (57cc1beb)
default path (no variable) against main: top-20 logits, 15,175 positions byte-identical byte-identical
=1 against unset: KL mean ± sd / top-1 agreement 0.0962 ± 0.1676 / 93.83% 0.0978 ± 0.1732 / 93.69%
=check against unset 0.0187 ± 0.0219 / 97.64% 0.0253 ± 0.0395 / 97.21%
=1 with STRATA_VERIFY_DEFER_CPU_BELOW=1 against unset 0.4488 ± 0.8969 / 86.51% 0.4597 ± 0.9270 / 86.27%
low-context decode, unset / =1 (median of 3 rounds) 53.61 / 60.86 tok/s (+13.5%) 53.98 / 62.27 tok/s (+15.4%)
~32K decode, unset / =1 45.75 / 51.15 tok/s (+11.8%) 47.25 / 50.60 tok/s (+7.1%)

The speed rows on this head are a second run: in the first, a build on the same host took 15-22 cores during both
=1 arms and none during the unset arms. In the second, the host was idle in all four arms.

Not run on this head: --draft dflash2 with STRATA_VERIFY_DEFER_CPU=1 (the refusal is read from the code only).
In the older sections below, "this branch" and "this head" mean the 0.2.0-beta head (57cc1beb).

Validation

Revision: this branch, built and tested at 57cc1beb on main e88ee39d (v0.2.0-beta + 12 commits); the tip
58c72607 differs from it only in three lines of docs/DETAILS.md. Baseline for the tests: e88ee39d itself, built
and run the same way.

Passed:

  • Linux CUDA build, all targets: Ubuntu 24.04 (a Proxmox container), GCC 13.3, CUDA 13.0.88, sm_75;86, Release,
    native experts, ninja -C build all (368 steps) rc=0, both for this branch and the baseline. The touched sources
    recompiled with their warnings shown: the three warnings (an unused variable in raise_flag, a #pragma clang
    and an unreferenced kernel in verify_kernels.cu) are all in code this change does not touch.

  • Windows CUDA build: MSVC 2022 (14.44) + CUDA 13.0, sm_86, Release, Ninja, ninja -k 0 all: strata.exe and
    every other target built; one target failed, under Failed.

  • CPU tests on Linux, CUDA_VISIBLE_DEVICES=-1 ctest --timeout 300 -j 4 (no GPU visible), this branch against the
    baseline:

    build passed skipped failed total
    main e88ee39d 26 5 54 85
    this branch 26 5 54 85

    Every test has the same outcome in both (compared by name). Among the passing ones file_expert_source_test,
    split_lend_complement_test and vmm_test link the engine library with the changed expert_source.cpp and
    verify.cpp; conv_cache_test, spec_prob_test, batch_rows_test, conversation_validation_test and
    conversation_transfer_test are the ones the earlier revision of this PR ran. No test exercises the deferral
    itself (it needs a GPU).

  • CPU tests on Windows, the same command on the Windows build (this branch only; the baseline was not built on
    Windows): 23 passed, 4 skipped, 56 failed of 83. The 23 are the Linux list's passing tests that Windows registers
    (conversation_transfer_test, pinned_shared_test and split_lend_complement_test are Linux only); the failures
    are the GPU tests.

  • GPU, this branch's Linux build against the baseline's, one RTX 2080 Ti 11 GB (PCIe 3.0 x16) + Ryzen 9 5900XT,
    Linux; GSQ-RCO IQ3_S (ISTA-DASLab), --serve with the setup's config, expert cache auto (1,917 slots in every arm),
    one fresh engine per arm, port and config the same for both builds:

    • Default path: the baseline and this branch with STRATA_VERIFY_DEFER_CPU unset, teacher-forced
      (STRATA_LOGPOS, top 20, --short-read 100000 --pcie-frac 0), 12 slices of plain text, 15,175 positions:
      the two dumps are byte-identical, and the branch's log has no STRATA_VERIFY_DEFER line.

    • Quality, the same 12 slices, against this branch unset; every =1 / =check run printed its
      STRATA_VERIFY_DEFER_CPU line and no window timeout or stall line. The two reference rows were run later the
      same day on the same card: their unset reference was run again and was byte-identical to the first (every
      position's top 20), so all rows share one reference. KL by position in tokens of each slice:

      run against unset (0.2.0-beta, 2080 Ti) KL mean ± sd over slices slice median KL 0-7 KL 8-63 KL 64-639 KL 640+ top-1 agreement
      unset with 6% more expert slots (--expert-cache: 2,032 against auto's 1,917; the placement floor) 0.030 ± 0.037 0.018 0.0010 0.0110 0.0289 0.0329 96.7%
      STRATA_ROUTE_TAIL_SKIP=0 (scale) 0.064 ± 0.080 0.032 0.0050 0.0372 0.0422 0.0842 95.2%
      =1 BELOW=1 (every CPU row) 0.460 ± 0.927 0.180 0.0057 0.2815 0.4186 0.5080 86.3%
      =1, the default 0.1 0.098 ± 0.173 0.054 0.0046 0.0430 0.0821 0.1160 93.7%
      =check, the default 0.1 0.025 ± 0.040 0.009 0.0011 0.0083 0.0241 0.0273 97.2%

      =1 sits above the tail skip's scale here (0.098 against 0.064; on v0.1.44.1 and the 3080 they were 0.088
      against 0.083), and one slice carries much of it (0.637; the floor's worst slice is 0.131). =check (the
      default's sums in another order, the same placement) stays at a quarter of =1 and below the placement floor.
      It is above the v0.1.44.1 figure (0.0134), which was 4 slices on another card; this run did not separate the two.

    • The other sizes, the same 12 slices, =1 (the default 0.1) against each size's own unset run, each with its own
      automatic cache (the same slot count in both arms of a size):

      size (0.2.0-beta, 2080 Ti) expert slots KL mean ± sd slice median top-1 agreement
      Q2_0 3,542 0.051 ± 0.096 0.016 96.6%
      IQ3_XXS 2,484 0.067 ± 0.099 0.034 94.9%
      IQ3_S 1,917 0.098 ± 0.173 0.054 93.7%
      Coder (IQ1_M) 1,973 0.089 ± 0.099 0.062 92.4%
      UD-IQ4_XS 1,329 0.111 ± 0.151 0.046 92.9%

      The order follows the earlier table's (v0.1.44.1, below) except Coder, which dropped from 0.149 to 0.089; its
      worst slice went from 0.795 to 0.380.

    • Speed: 12 prompts x 200 tokens, three rounds, the median of the three rounds' mean decode tok/s; then 3 prompts of
      ~32K tokens read from 0, 200 tokens each, the median. Order: unset, =1, =1, unset:

      arm low context decode, tok/s high context decode, tok/s
      unset 53.81 46.2
      STRATA_VERIFY_DEFER_CPU=1 62.62 50.1
      STRATA_VERIFY_DEFER_CPU=1 61.93 51.1
      unset 54.16 48.3

      Low context: +15.4% (the medians of the two arms each, 53.98 against 62.27; unset vs unset 0.35 apart, =1
      vs =1 0.69). At ~32K: +7.1% (47.25 against 50.60), with a wider spread between the two unset runs (2.1).

Failed:

  • The 54 GPU tests (*_parity, cuda_device_selftest) fail with no GPU visible, the same 54 on the baseline. Not
    caused by this change; they were run without a GPU on purpose. On Windows the GPU tests fail the same way.
  • Windows: the target hc_persist_parity does not compile (src/kernels/hc_persist_parity.cpp:55, setenv /
    unsetenv are POSIX). The file is not touched by this change, so its two tests are "Not Run" there.

Not run:

  • An RTX 3080 on 0.2.0-beta: the card is in another PC today and that PC holds only part of each model's bytes, so
    the RTX 3080 tables below stay those of v0.1.44.1.
  • The 4-slice table of the late addition's arithmetic (below) was not run again: the 12-slice =check row and the
    byte-identical repeat of unset above take its place on 0.2.0-beta.
  • HIP build (no ROCm toolchain here). The new kernels use only fmaf, __expf, float4 and plain launches, and
    copy_rows_by_weight is copy_rows_from_mapped_kernel with one more test.
  • SYCL build (no oneAPI toolchain here; none of its sources change). Metal build (no Mac).
  • STRATA_VERIFY_DEVICE_PLAN=1 with deferral, STRATA_COLD_OVERLAP=1/2/3 with the split, STRATA_PCIE_BALANCE=1
    with deferral (the line and the fallback), two GPUs, AMD.

Earlier measurements (v0.1.44.1, before this rebase)

Measured on the revision this PR had before the tracker reset (base 296b59d2, v0.1.44.1), not on 0.2.0-beta, on
another card (an RTX 3080), so they do not compare number for number with the 2080 Ti runs above.

Speed. GSQ-RCO IQ3_S (ISTA-DASLab), RTX 3080 10 GB alone (PCIe 4.0 x8, 13.0 GB/s) + Ryzen 9 5900XT, DDR4-3000,
Linux; --serve with the setup's config as it is (expert cache auto: 1,404 slots in every arm, the PCIe share
automatic), one fresh engine per arm. Low context: 12 prompts x 200 tokens, three rounds, mean decode tok/s per
round, the median of the three. High context: 3 prompts of ~29-30K tokens read from 0, 200 tokens each, the median of
the three.

arm (v0.1.44.1) low context decode, tok/s vs unset high context decode, tok/s vs unset
unset (two runs: 58.88, 58.49) 58.69 - 52.10 -
STRATA_VERIFY_DEFER_CPU=1 STRATA_VERIFY_DEFER_CPU_BELOW=1 (every CPU row) 67.74 +15.4% 61.00 +17.1%
STRATA_VERIFY_DEFER_CPU=1 (the default 0.1; two runs: 68.42, 67.52) 67.97 +15.8% 58.45 +12.2%

At ~30K the default 0.1 gives back part of the gain; the high-context medians are noisier (the first of the three
prompts was the slowest in every arm). Prompt reads are unchanged (deferral is decode only: 956-963 tok/s at ~30K).
A later run (2026-10-17, the same PC, --max-context 262144, 1,285 slots): unset 58.7, the default 67.6 (+15.2%).

Quality. Teacher-forced log-probabilities (STRATA_LOGPOS, top 20), read through the verify windows
(--short-read 100000) so every position takes the decode path, --pcie-frac 0; top-20 KL(reference || run) and
top-1 agreement. STRATA_ROUTE_TAIL_SKIP=0 is the scale: how far the shipped default (route tail skip on) is from the
engine without it. 12 slices of plain text, 15,175 positions (2026-10-17). The KL varies far more from one slice to
the next than between settings, so the table gives the mean over the 12 slices, its spread, and the median:

run against =0 (unset), v0.1.44.1 KL mean ± sd over slices slice median KL 0-7 KL 8-63 KL 64-639 KL 640+ top-1 agreement
=0 with 9% more expert slots (the placement floor) 0.022 ± 0.024 0.018 0.0008 0.0123 0.0228 0.0235 97.2%
STRATA_ROUTE_TAIL_SKIP=0 (scale) 0.083 ± 0.125 0.045 0.0070 0.0399 0.0574 0.1113 94.8%
=1 BELOW=1 (every CPU row) 0.370 ± 0.648 0.193 0.0104 0.3235 0.3867 0.3377 87.8%
=1, the default 0.1 0.088 ± 0.132 0.034 0.0023 0.0338 0.0784 0.0820 94.2%

The default 0.1 against =0, other sizes (one PC, 12 slices, v0.1.44.1):

size KL mean ± sd slice median top-1 agreement
Q2_0 0.045 ± 0.054 0.029 96.8%
IQ3_XXS 0.068 ± 0.066 0.035 94.9%
IQ3_S 0.088 ± 0.132 0.034 94.2%
Coder (IQ1_M) 0.149 ± 0.221 0.055 90.9%
UD-IQ4_XS 0.115 ± 0.118 0.077 92.8%

The late addition's arithmetic (4 slices, 5,257 positions, v0.1.44.1; reference unset, run twice for the floor).
=check is the same sums in another order:

run against unset, v0.1.44.1 KL all top-1 agreement
unset again (the floor, same binary and placement) 0.0005 99.81%
=check, every CPU row 0.0165 96.77%
=check, the default 0.1 0.0134 97.47%
STRATA_ROUTE_TAIL_SKIP=0 (scale) 0.0705 93.93%

Default path on v0.1.44.1: 296b59d2 and the PR's branch with the env unset, the same 4-slice run, were
byte-identical (5,257 positions, top 20).

Limits

  • =check adds the rows back in post(l), so it exercises the copy and the arithmetic of the late addition but not
    where the wait sits in pre(l+1). Nor does any check show that post(l) waits for the heavy rows and not later: a
    missing or late partial flag ends in a 20 s window timeout (the GPU waits for it), not in wrong rows; a flag raised
    too early would read rows the pool is still writing. The flag is raised only after the heavy jobs' pool call
    returned, with the same fences as the layer's own flag. Both rest on reading the code.
  • Two GPUs in one PC (layer split, --pipeline-windows, --peer-device, helper caches): checked by reading the code
    only, not run. Each stage is its own verifier with its own flags, plan and late rows, and defers its own layers but
    its last, so nothing is deferred across the hand-off between cards.
  • CUDA only so far. HIP compiles the same code but has not been built or run; SYCL and Metal do not have it.
  • Pre-existing, not changed here: with STRATA_VERIFY_DEVICE_PLAN=1, the PLE block and a stage starting at layer 0,
    pre(1) copies the PLE rows without waiting for flag 1 when post(0) skipped its wait through the device plan. This
    change never defers layer 0 under PLE, so it does not touch that path.

How to try it

STRATA_VERIFY_DEFER_CPU=1                                     # defer the CPU rows of routing weight below 0.1 (the default)
STRATA_VERIFY_DEFER_CPU=1 STRATA_VERIFY_DEFER_CPU_BELOW=1     # defer every CPU row
STRATA_VERIFY_DEFER_CPU=check                                 # the check, split at 0.1 too: should match the default within rounding
STRATA_VERIFY_DEFER_CPU=check STRATA_VERIFY_DEFER_CPU_BELOW=1 # the check of every CPU row's late addition
STRATA_VERIFY_PROFILE=1                                       # optional: "late rows" is the late wait and add, waitCPU the heavy rows

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2690 **Author:** [@lask3802](https://github.com/lask3802) **Created:** 10/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `verify-defer-heavy` --- ### 📝 Commits (9) - [`19aede1`](https://github.com/Niko1221/Strata/commit/19aede19f86b80f516f47a8c8bf266dcbb3b48bf) verify: STRATA_VERIFY_DEFER=1, a layer's CPU expert rows join the residual before the next layer's FFN-side read - [`1a99ad3`](https://github.com/Niko1221/Strata/commit/1a99ad3b477b24ef6b2e339e01e8be94ce280afc) verify: STRATA_VERIFY_DEFER, review: the zeroed rows by a kernel, the hits in the combine, a profile slot, docs - [`1750313`](https://github.com/Niko1221/Strata/commit/1750313eb20ce8a063d6217be6d3ff7792d40485) verify: STRATA_VERIFY_DEFER_HEAVY=<w>, a deferred layer keeps its CPU rows of routing weight >= w on time - [`d4deb0c`](https://github.com/Niko1221/Strata/commit/d4deb0ce2a7feb7282007aaad13934c7041720b3) verify: STRATA_VERIFY_DEFER is now STRATA_VERIFY_DEFER_CPU - [`f4ab7e7`](https://github.com/Niko1221/Strata/commit/f4ab7e72c885c0e9df61adb1ae10003e56f17637) verify: STRATA_VERIFY_DEFER_HEAVY is now STRATA_VERIFY_DEFER_CPU_BELOW, 0.1 by default - [`53858fd`](https://github.com/Niko1221/Strata/commit/53858fd4aa64998a39d3fb7028ca08762d43f0ca) verify: STRATA_VERIFY_DEFER_CPU_BELOW, review: start-up lines and docs - [`0f15f75`](https://github.com/Niko1221/Strata/commit/0f15f75b347a2f3c433ce5389d7e6c52f3ab0f69) verify: STRATA_VERIFY_DEFER_CPU on 0.2: off with STRATA_PCIE_BALANCE=1, docs for the cold overlap - [`a7b5c88`](https://github.com/Niko1221/Strata/commit/a7b5c88713f51fa6c0c2cdd0a103c192c27a534a) verify: STRATA_VERIFY_DEFER_CPU on 0.2.3: off while the DFlash2 taps run - [`2e57231`](https://github.com/Niko1221/Strata/commit/2e57231c067d50952a29e9b3dfc8ba221010608b) verify: with the DFlash2 taps, deferral is off from the start ### 📊 Changes **10 files changed** (+469 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+63 -0) 📝 `include/strata/core/expert_source.hpp` (+6 -0) 📝 `include/strata/core/peer_experts.hpp` (+5 -0) 📝 `include/strata/core/verify.hpp` (+15 -0) 📝 `include/strata/kernels/verify_kernels.hpp` (+14 -0) 📝 `src/core/expert_source.cpp` (+45 -4) 📝 `src/core/peer_experts.cpp` (+3 -0) 📝 `src/core/verify.cpp` (+235 -13) 📝 `src/kernels/cuda/verify_kernels.cu` (+80 -0) 📝 `src/program/generate.cpp` (+3 -0) </details> ### 📄 Description ## Problem and result On one GPU with experts in RAM, every decode layer waits for the CPU pool's expert rows before its combine, and the GPU idles while the CPU computes. This PR adds an opt-in setting, `STRATA_VERIFY_DEFER_CPU=1`, that lets a layer go on without the CPU's light expert rows and add them one step later, so the CPU computes them while the GPU runs the next layer's mixer. - Before, and after with `STRATA_VERIFY_DEFER_CPU` unset or `0`: unchanged. No allocation, no graph node, no kernel choice and no host step changes. (With `STRATA_VERIFY_PROFILE` or the #649 trace on, the profile has one more stamp at the end of the mixer's out-projection: "late rows", near 0 then.) - After, with `STRATA_VERIFY_DEFER_CPU=1`: the CPU rows of routing weight below 0.1 (`STRATA_VERIFY_DEFER_CPU_BELOW`) join layer l at layer l+1's FFN half; the heavier ones are waited for in their own layer. **This changes the output.** On 0.2.0-beta, on an RTX 2080 Ti alone, it is +15.4% decode tok/s at low context at a teacher-forced KL of 0.098 against the default (Validation). On the same run the placement floor (the default with 6% more expert slots) is 0.030 and the shipped route tail skip's own KL is 0.064, so on this card the deferral costs about 1.5x the tail skip. On the earlier base of this PR (v0.1.44.1, an RTX 3080) it was +15.8% at a KL of 0.088, about the tail skip's 0.083 there. This PR is now rebased on `main` (0.2.0-beta) after the tracker reset; the earlier description was for v0.1.44.1. ## Related discussion - #2689 (deferring every CPU row) was folded into this PR and closed before the tracker reset. - No scope issue. The change is opt-in and changes no default. ## Approach With `STRATA_VERIFY_DEFER_CPU=1`: - post(l) combines without the CPU's light rows (routing weight below `STRATA_VERIFY_DEFER_CPU_BELOW`, 0.1 by default) and does not wait for them. It waits only for the heavy rows: the pool computes the experts of the CPU entries whose weight is >= w first, raises a new mapped flag (`h_pflag_`, to the layer's ring), then computes the rest. The rows come out as in one pass: the pool cuts its phases by output rows, so only the order of the jobs changes. post(l) combines the heavy rows with a new kernel `copy_rows_by_weight` (the plan's GPU rows zeroed as `copy_rows_from_mapped` does). - pre(l+1) runs its mixer (attention or GDN), then waits for layer l's flag, copies the light rows and adds them to the residual with layer l's own routing weights and pending-write coefficient, `2*sigmoid(inject/hc)` (new kernel `defer_add_rows`), then does its FFN-side read as usual. - In a window that defers, the doorbell publishes the routing weights too (`doorbell_publish`, the variant `--remote-expert-opt` uses), and `run` / `service` hand the pool the weights and a partial hook for the deferred layers. Nothing the late addition reads is overwritten before it: pre(l+1)'s attention-side read writes `inj_` (not layer l's `inj2_`), and its router (`w_`), the next plan (`plan_`, `skip_`) and its doorbell come after the addition. So the host's next expert step never rewrites the doorbell payload or `h_ymiss_` earlier than without deferral, and no buffer is doubled. Not deferred: the stage's last layer, and layer 0 when layer 1 runs the PLE block. Windows that run without deferral (one line at the first capture says which and why): batch windows, `--spec-split` token groups, `--remote-expert-opt`, `STRATA_PCIE_BALANCE`, the all-resident graph (no CPU rows), a stage with no layer to defer, a control vector on the stage. The split is turned off, and every CPU row joins late, when the verifier takes the device plan (`STRATA_VERIFY_DEVICE_PLAN=1`) and with `--peer-device` or a helper cache (`--expert-cache-device1..3`), whose rows land after the CPU's (one start-up line). `run` and `service` raise the partial flag after every pool call, so a layer the pool did not split never leaves a GPU wait behind. The new flag is released with the others before the engine ends (#267) and shows in the stall diagnostics. `STRATA_VERIFY_DEFER_CPU=check` runs the same steps but adds the rows back right after layer l's own combine: no deferral, the default's sums in another order. What changed in the rebase on 0.2.0-beta (two places where 0.2's code meets the deferral): - `STRATA_PCIE_BALANCE=1` times each layer's wait for the CPU rows in its GPU fit, and a deferred layer does not make that wait. With both set, `init` turns the deferral off with one line, and `defer_ok` refuses a window with balance stamps. - The 149-cold batches (`STRATA_COLD_OVERLAP=1`, `2` or `3`) compute a layer's CPU experts in batches, inside the job loop, when some of their reads are still pending. Such a layer is not split: it waits for all its CPU rows (one line, said once). With mode 0 or 4 (4 is the Linux default for the GGUF read in place, which reads everything before the pool runs) nothing changes for the split. Compatibility: SYCL (`sycl/`) has its own copies of every touched source and header except `verify_kernels.hpp`, which only gains declarations, so nothing it compiles changes. On Metal the calls of the new entry points are compiled out (`#if !defined(STRATA_GPU_METAL)`); the Metal window returns from `init` before the env is read. HIP compiles the same CUDA sources. Docs: a DETAILS.md section next to the route tail skip and the PCIe share. ### Rebased onto 0.2.4.1 (2026-10-24) This head is the branch rebased onto `main` 8183c6b6 (v0.2.4.1 and one docs commit, engine 0.1.49.1). The rebase applied with no conflicts, and `git range-diff` against the 0.2.3 head (af16b23a) shows every commit as the same patch. Checked on this head (Linux, the build of the runs below): the build and five CPU tests (`conv_cache_test`, `spec_prob_test`, `batch_rows_test`, `conversation_validation_test`, `conversation_transfer_test`) passed. **Not run on this head:** the Windows build and ctest. **GPU runs on this head (2026-10-24).** The same RTX 2080 Ti and runs as in the 0.2.3 section below (this head's Linux build against `main`'s, the same model, slices and prompts). The CI container on the host used 0 cores in every arm. In the 0.2.3 section below, "this head" means the 0.2.3 head (af16b23a). | check | 0.2.4.1 (this head) | 0.2.3 (af16b23a) | |---|---|---| | default path (no variable) against `main`: top-20 logits, 15,175 positions | byte-identical | byte-identical | | `=1` against unset: KL mean ± sd / top-1 agreement | 0.0962 ± 0.1676 / 93.83% | 0.0962 ± 0.1676 / 93.83% | | `=check` against unset | 0.0187 ± 0.0219 / 97.64% | 0.0187 ± 0.0219 / 97.64% | | `=1` with `STRATA_VERIFY_DEFER_CPU_BELOW=1` against unset | 0.4488 ± 0.8969 / 86.51% | 0.4488 ± 0.8969 / 86.51% | | low-context decode, unset / `=1` (median of 3 rounds) | 53.42 / 61.25 tok/s (+14.7%) | 53.61 / 60.86 tok/s (+13.5%) | | ~32K decode, unset / `=1` (median of 3 prompts) | 45.85 / 47.60 tok/s (+3.8%) | 45.75 / 51.15 tok/s (+11.8%) | The KL rows are the same as on 0.2.3 because the logits are: `main`'s top-20 file and the `=1` file of this head are byte-identical to 0.2.3's (md5 of each run's file). The speed rows are four arms in the order unset, `=1`, `=1`, unset, and each cell is the mean of its two arms. At low context the two arms of each agree within 0.3 tok/s (unset 53.29 / 53.55, `=1` 61.13 / 61.37). At ~32K they spread by about 2 tok/s (unset 46.9 / 44.8, `=1` 48.6 / 46.6), while on 0.2.3 they did not (unset 45.8 / 45.7, `=1` 50.8 / 51.5). Both `=1` arms here are 2.2-4.9 tok/s below both of 0.2.3's, with unset about the same, so the smaller ~32K gain on this head looks real; its cause is not known, and the ~32K arms were not run again. ### Rebased onto 0.2.3 (2026-10-23) This head is the branch rebased onto `main` 5c8dd322 (v0.2.3, engine 0.1.48), plus two commits for 0.2.3's DFlash2 drafter. **The conflict.** Git stopped at one conflict, in `record_window`'s post(l). Upstream's new tap block (the DFlash2 drafter's hidden states) and the `=check` late_add sit at the same spot. The late_add goes first, so in `=check` a tapped layer output holds the layer's own CPU rows, as it does on the default path. **The two new commits.** With `=1`, a deferred layer's light rows join only in pre(l+1). A tap copies layer l's output in post(l), so it would miss those rows, and the drafter (`--draft dflash2`) or the `STRATA_TAP_FILE` dump would read different hidden states. With the taps on, there is now no deferral: - `init` says so in one start-up line and clears the flags. - `defer_ok` says no for every window, as it does for `STRATA_PCIE_BALANCE`. `docs/DETAILS.md` lists the taps among the cases that run without deferral. The drafter is CLI-only and opt-in, so the default path and the `--serve` path are unchanged. Checked on this head (Windows, MSVC 19.44 + CUDA 13.0): | check | result | |---|---| | build (every target but `hc_persist_parity`) | passed | | ctest overall | 80 of 85 passed | The other 5 fail the same way on v0.2.3 itself in the same environment: - `hc_persist_parity` and `hc_persist_default_off`: the test calls `setenv`, which MSVC does not have. - `gemm_bf16_parity` and `gr_upmix_parity`: the CUDA DLLs are not on ctest's PATH. With them on the PATH, `gemm_bf16_parity` passes and `gr_upmix_parity` fails 21 cases on both. - `ple_parity`: it needs a model file. **GPU runs on this head (2026-10-23).** The same RTX 2080 Ti and runs as in Validation (this head's Linux build against v0.2.3's, the same model, slices and prompts): | check | 0.2.3 (this head) | 0.2.0-beta (57cc1beb) | |---|---|---| | default path (no variable) against `main`: top-20 logits, 15,175 positions | byte-identical | byte-identical | | `=1` against unset: KL mean ± sd / top-1 agreement | 0.0962 ± 0.1676 / 93.83% | 0.0978 ± 0.1732 / 93.69% | | `=check` against unset | 0.0187 ± 0.0219 / 97.64% | 0.0253 ± 0.0395 / 97.21% | | `=1` with `STRATA_VERIFY_DEFER_CPU_BELOW=1` against unset | 0.4488 ± 0.8969 / 86.51% | 0.4597 ± 0.9270 / 86.27% | | low-context decode, unset / `=1` (median of 3 rounds) | 53.61 / 60.86 tok/s (+13.5%) | 53.98 / 62.27 tok/s (+15.4%) | | ~32K decode, unset / `=1` | 45.75 / 51.15 tok/s (+11.8%) | 47.25 / 50.60 tok/s (+7.1%) | The speed rows on this head are a second run: in the first, a build on the same host took 15-22 cores during both `=1` arms and none during the unset arms. In the second, the host was idle in all four arms. **Not run on this head:** `--draft dflash2` with `STRATA_VERIFY_DEFER_CPU=1` (the refusal is read from the code only). In the older sections below, "this branch" and "this head" mean the 0.2.0-beta head (57cc1beb). ## Validation Revision: this branch, built and tested at `57cc1beb` on `main` `e88ee39d` (v0.2.0-beta + 12 commits); the tip `58c72607` differs from it only in three lines of `docs/DETAILS.md`. Baseline for the tests: `e88ee39d` itself, built and run the same way. **Passed:** - Linux CUDA build, all targets: Ubuntu 24.04 (a Proxmox container), GCC 13.3, CUDA 13.0.88, sm_75;86, Release, native experts, `ninja -C build all` (368 steps) rc=0, both for this branch and the baseline. The touched sources recompiled with their warnings shown: the three warnings (an unused variable in `raise_flag`, a `#pragma clang` and an unreferenced kernel in `verify_kernels.cu`) are all in code this change does not touch. - Windows CUDA build: MSVC 2022 (14.44) + CUDA 13.0, sm_86, Release, Ninja, `ninja -k 0 all`: `strata.exe` and every other target built; one target failed, under Failed. - CPU tests on Linux, `CUDA_VISIBLE_DEVICES=-1 ctest --timeout 300 -j 4` (no GPU visible), this branch against the baseline: | build | passed | skipped | failed | total | |---|---:|---:|---:|---:| | `main` e88ee39d | 26 | 5 | 54 | 85 | | this branch | 26 | 5 | 54 | 85 | Every test has the same outcome in both (compared by name). Among the passing ones `file_expert_source_test`, `split_lend_complement_test` and `vmm_test` link the engine library with the changed `expert_source.cpp` and `verify.cpp`; `conv_cache_test`, `spec_prob_test`, `batch_rows_test`, `conversation_validation_test` and `conversation_transfer_test` are the ones the earlier revision of this PR ran. No test exercises the deferral itself (it needs a GPU). - CPU tests on Windows, the same command on the Windows build (this branch only; the baseline was not built on Windows): 23 passed, 4 skipped, 56 failed of 83. The 23 are the Linux list's passing tests that Windows registers (`conversation_transfer_test`, `pinned_shared_test` and `split_lend_complement_test` are Linux only); the failures are the GPU tests. - GPU, this branch's Linux build against the baseline's, one RTX 2080 Ti 11 GB (PCIe 3.0 x16) + Ryzen 9 5900XT, Linux; GSQ-RCO IQ3_S (ISTA-DASLab), `--serve` with the setup's config, expert cache auto (1,917 slots in every arm), one fresh engine per arm, port and config the same for both builds: - Default path: the baseline and this branch with `STRATA_VERIFY_DEFER_CPU` unset, teacher-forced (`STRATA_LOGPOS`, top 20, `--short-read 100000 --pcie-frac 0`), 12 slices of plain text, 15,175 positions: the two dumps are byte-identical, and the branch's log has no `STRATA_VERIFY_DEFER` line. - Quality, the same 12 slices, against this branch unset; every `=1` / `=check` run printed its `STRATA_VERIFY_DEFER_CPU` line and no window timeout or stall line. The two reference rows were run later the same day on the same card: their unset reference was run again and was byte-identical to the first (every position's top 20), so all rows share one reference. KL by position in tokens of each slice: | run against unset (0.2.0-beta, 2080 Ti) | KL mean ± sd over slices | slice median | KL 0-7 | KL 8-63 | KL 64-639 | KL 640+ | top-1 agreement | |---|---:|---:|---:|---:|---:|---:|---:| | unset with 6% more expert slots (`--expert-cache`: 2,032 against auto's 1,917; the placement floor) | 0.030 ± 0.037 | 0.018 | 0.0010 | 0.0110 | 0.0289 | 0.0329 | 96.7% | | `STRATA_ROUTE_TAIL_SKIP=0` (scale) | 0.064 ± 0.080 | 0.032 | 0.0050 | 0.0372 | 0.0422 | 0.0842 | 95.2% | | `=1 BELOW=1` (every CPU row) | 0.460 ± 0.927 | 0.180 | 0.0057 | 0.2815 | 0.4186 | 0.5080 | 86.3% | | `=1`, the default 0.1 | 0.098 ± 0.173 | 0.054 | 0.0046 | 0.0430 | 0.0821 | 0.1160 | 93.7% | | `=check`, the default 0.1 | 0.025 ± 0.040 | 0.009 | 0.0011 | 0.0083 | 0.0241 | 0.0273 | 97.2% | `=1` sits above the tail skip's scale here (0.098 against 0.064; on v0.1.44.1 and the 3080 they were 0.088 against 0.083), and one slice carries much of it (0.637; the floor's worst slice is 0.131). `=check` (the default's sums in another order, the same placement) stays at a quarter of `=1` and below the placement floor. It is above the v0.1.44.1 figure (0.0134), which was 4 slices on another card; this run did not separate the two. - The other sizes, the same 12 slices, `=1` (the default 0.1) against each size's own unset run, each with its own automatic cache (the same slot count in both arms of a size): | size (0.2.0-beta, 2080 Ti) | expert slots | KL mean ± sd | slice median | top-1 agreement | |---|---:|---:|---:|---:| | Q2_0 | 3,542 | 0.051 ± 0.096 | 0.016 | 96.6% | | IQ3_XXS | 2,484 | 0.067 ± 0.099 | 0.034 | 94.9% | | IQ3_S | 1,917 | 0.098 ± 0.173 | 0.054 | 93.7% | | Coder (IQ1_M) | 1,973 | 0.089 ± 0.099 | 0.062 | 92.4% | | UD-IQ4_XS | 1,329 | 0.111 ± 0.151 | 0.046 | 92.9% | The order follows the earlier table's (v0.1.44.1, below) except Coder, which dropped from 0.149 to 0.089; its worst slice went from 0.795 to 0.380. - Speed: 12 prompts x 200 tokens, three rounds, the median of the three rounds' mean decode tok/s; then 3 prompts of ~32K tokens read from 0, 200 tokens each, the median. Order: unset, `=1`, `=1`, unset: | arm | low context decode, tok/s | high context decode, tok/s | |---|---:|---:| | unset | 53.81 | 46.2 | | `STRATA_VERIFY_DEFER_CPU=1` | 62.62 | 50.1 | | `STRATA_VERIFY_DEFER_CPU=1` | 61.93 | 51.1 | | unset | 54.16 | 48.3 | Low context: +15.4% (the medians of the two arms each, 53.98 against 62.27; unset vs unset 0.35 apart, `=1` vs `=1` 0.69). At ~32K: +7.1% (47.25 against 50.60), with a wider spread between the two unset runs (2.1). **Failed:** - The 54 GPU tests (`*_parity`, `cuda_device_selftest`) fail with no GPU visible, the same 54 on the baseline. Not caused by this change; they were run without a GPU on purpose. On Windows the GPU tests fail the same way. - Windows: the target `hc_persist_parity` does not compile (`src/kernels/hc_persist_parity.cpp:55`, `setenv` / `unsetenv` are POSIX). The file is not touched by this change, so its two tests are "Not Run" there. **Not run:** - An RTX 3080 on 0.2.0-beta: the card is in another PC today and that PC holds only part of each model's bytes, so the RTX 3080 tables below stay those of v0.1.44.1. - The 4-slice table of the late addition's arithmetic (below) was not run again: the 12-slice `=check` row and the byte-identical repeat of unset above take its place on 0.2.0-beta. - HIP build (no ROCm toolchain here). The new kernels use only `fmaf`, `__expf`, `float4` and plain launches, and `copy_rows_by_weight` is `copy_rows_from_mapped_kernel` with one more test. - SYCL build (no oneAPI toolchain here; none of its sources change). Metal build (no Mac). - `STRATA_VERIFY_DEVICE_PLAN=1` with deferral, `STRATA_COLD_OVERLAP=1`/`2`/`3` with the split, `STRATA_PCIE_BALANCE=1` with deferral (the line and the fallback), two GPUs, AMD. ### Earlier measurements (v0.1.44.1, before this rebase) Measured on the revision this PR had before the tracker reset (base `296b59d2`, v0.1.44.1), not on 0.2.0-beta, on another card (an RTX 3080), so they do not compare number for number with the 2080 Ti runs above. Speed. GSQ-RCO IQ3_S (ISTA-DASLab), RTX 3080 10 GB alone (PCIe 4.0 x8, 13.0 GB/s) + Ryzen 9 5900XT, DDR4-3000, Linux; `--serve` with the setup's config as it is (expert cache auto: 1,404 slots in every arm, the PCIe share automatic), one fresh engine per arm. Low context: 12 prompts x 200 tokens, three rounds, mean decode tok/s per round, the median of the three. High context: 3 prompts of ~29-30K tokens read from 0, 200 tokens each, the median of the three. | arm (v0.1.44.1) | low context decode, tok/s | vs unset | high context decode, tok/s | vs unset | |---|---:|---:|---:|---:| | unset (two runs: 58.88, 58.49) | 58.69 | - | 52.10 | - | | `STRATA_VERIFY_DEFER_CPU=1 STRATA_VERIFY_DEFER_CPU_BELOW=1` (every CPU row) | 67.74 | +15.4% | 61.00 | +17.1% | | `STRATA_VERIFY_DEFER_CPU=1` (the default 0.1; two runs: 68.42, 67.52) | 67.97 | +15.8% | 58.45 | +12.2% | At ~30K the default 0.1 gives back part of the gain; the high-context medians are noisier (the first of the three prompts was the slowest in every arm). Prompt reads are unchanged (deferral is decode only: 956-963 tok/s at ~30K). A later run (2026-10-17, the same PC, `--max-context 262144`, 1,285 slots): unset 58.7, the default 67.6 (+15.2%). Quality. Teacher-forced log-probabilities (`STRATA_LOGPOS`, top 20), read through the verify windows (`--short-read 100000`) so every position takes the decode path, `--pcie-frac 0`; top-20 KL(reference || run) and top-1 agreement. `STRATA_ROUTE_TAIL_SKIP=0` is the scale: how far the shipped default (route tail skip on) is from the engine without it. 12 slices of plain text, 15,175 positions (2026-10-17). The KL varies far more from one slice to the next than between settings, so the table gives the mean over the 12 slices, its spread, and the median: | run against `=0` (unset), v0.1.44.1 | KL mean ± sd over slices | slice median | KL 0-7 | KL 8-63 | KL 64-639 | KL 640+ | top-1 agreement | |---|---:|---:|---:|---:|---:|---:|---:| | `=0` with 9% more expert slots (the placement floor) | 0.022 ± 0.024 | 0.018 | 0.0008 | 0.0123 | 0.0228 | 0.0235 | 97.2% | | `STRATA_ROUTE_TAIL_SKIP=0` (scale) | 0.083 ± 0.125 | 0.045 | 0.0070 | 0.0399 | 0.0574 | 0.1113 | 94.8% | | `=1 BELOW=1` (every CPU row) | 0.370 ± 0.648 | 0.193 | 0.0104 | 0.3235 | 0.3867 | 0.3377 | 87.8% | | `=1`, the default 0.1 | 0.088 ± 0.132 | 0.034 | 0.0023 | 0.0338 | 0.0784 | 0.0820 | 94.2% | The default 0.1 against `=0`, other sizes (one PC, 12 slices, v0.1.44.1): | size | KL mean ± sd | slice median | top-1 agreement | |---|---:|---:|---:| | Q2_0 | 0.045 ± 0.054 | 0.029 | 96.8% | | IQ3_XXS | 0.068 ± 0.066 | 0.035 | 94.9% | | IQ3_S | 0.088 ± 0.132 | 0.034 | 94.2% | | Coder (IQ1_M) | 0.149 ± 0.221 | 0.055 | 90.9% | | UD-IQ4_XS | 0.115 ± 0.118 | 0.077 | 92.8% | The late addition's arithmetic (4 slices, 5,257 positions, v0.1.44.1; reference unset, run twice for the floor). `=check` is the same sums in another order: | run against unset, v0.1.44.1 | KL all | top-1 agreement | |---|---:|---:| | unset again (the floor, same binary and placement) | 0.0005 | 99.81% | | `=check`, every CPU row | 0.0165 | 96.77% | | `=check`, the default 0.1 | 0.0134 | 97.47% | | `STRATA_ROUTE_TAIL_SKIP=0` (scale) | 0.0705 | 93.93% | Default path on v0.1.44.1: `296b59d2` and the PR's branch with the env unset, the same 4-slice run, were byte-identical (5,257 positions, top 20). ## Limits - `=check` adds the rows back in post(l), so it exercises the copy and the arithmetic of the late addition but not where the wait sits in pre(l+1). Nor does any check show that post(l) waits for the heavy rows and not later: a missing or late partial flag ends in a 20 s window timeout (the GPU waits for it), not in wrong rows; a flag raised too early would read rows the pool is still writing. The flag is raised only after the heavy jobs' pool call returned, with the same fences as the layer's own flag. Both rest on reading the code. - Two GPUs in one PC (layer split, `--pipeline-windows`, `--peer-device`, helper caches): checked by reading the code only, not run. Each stage is its own verifier with its own flags, plan and late rows, and defers its own layers but its last, so nothing is deferred across the hand-off between cards. - CUDA only so far. HIP compiles the same code but has not been built or run; SYCL and Metal do not have it. - Pre-existing, not changed here: with `STRATA_VERIFY_DEVICE_PLAN=1`, the PLE block and a stage starting at layer 0, pre(1) copies the PLE rows without waiting for flag 1 when post(0) skipped its wait through the device plan. This change never defers layer 0 under PLE, so it does not touch that path. ### How to try it ``` STRATA_VERIFY_DEFER_CPU=1 # defer the CPU rows of routing weight below 0.1 (the default) STRATA_VERIFY_DEFER_CPU=1 STRATA_VERIFY_DEFER_CPU_BELOW=1 # defer every CPU row STRATA_VERIFY_DEFER_CPU=check # the check, split at 0.1 too: should match the default within rounding STRATA_VERIFY_DEFER_CPU=check STRATA_VERIFY_DEFER_CPU_BELOW=1 # the check of every CPU row's late addition STRATA_VERIFY_PROFILE=1 # optional: "late rows" is the late wait and add, waitCPU the heavy rows ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4214
No description provided.