prefill: a layer split's idle card streams a share of a one-chunk prompt's experts
A prompt that fits one chunk runs a layer split's stages one after the other, so while one card reads its layers the other idles. --peer-device already has the mechanism for this (PeerPrefill's peer streaming: a share of the experts the primary streams goes over the peer's own PCIe link and is computed there), but it needs P2P and is refused with --layer-split. This makes PeerPrefill usable as a stream-only peer between the stages: - set_stage_helper: each stage's prompt path gets the next stage's (the last one the first's); a stream-only PeerPrefill holds no experts (peer == null), so every use of the peer tier is guarded - per prompt, bind_stage_helper points it at the idle stage's own lent prompt buffers (mixed, Xq, GU, H, Hq, Dm, ring, MMQ context): no VRAM of its own - without P2P the activations, the row table, the group bounds and the result rows go through mapped host memory, read by copy kernels on the device that needs them. Copy-engine uploads queued behind the ring's expert blobs (the grouping tables' reason for mapped memory), which cost ~20 ms per layer and ate the whole gain; cudaMemcpyPeerAsync without P2P is staged by the driver - only for one-chunk prompts on the MMQ path (not the fused kernels, not with --peer-device), with a share that falls with the chunk: min(0.45, 0.5 - T/16384), off below 0.3 (~3.3K tokens) - measured, below - STRATA_PREFILL_HELP=0 turns it off, STRATA_PREFILL_HELP_FRAC fixes the share 2x RTX 3090 (no P2P), UD-Q4_K_XL, layer split auto, 262K context, --adapt-swaps 0, prompt tok/s without / with: 1.1K 496 / 723, 1.5K 674 / 833, 2K 878 / 1128, 2.5K 1017 / 1296, 3K 1260 / 1440, 4K 1605 / 1607, 8K 2215 / 2221; decode unchanged. The output is repeatable (same prompt, same answer) but not bit-identical to STRATA_PREFILL_HELP=0's: the helped rows are computed in another MMQ grouping. 0.1.39b (Niko1221): opt-in (STRATA_PREFILL_HELP=1), since the helped rows round differently from the default; merged with #598 (run_impl / next_run_).
This commit is contained in:
1 parent
c3f2a5e63b
commit
4175cbcb5b
6 files changed
+272
-15
No files matched your search
@@ -4714,6 +4714,19 @@ int main(int argc, char** argv) {
|
||||
err.clear();
|
||||
}
|
||||
}
|
||||
// a layer split: a one-chunk prompt runs the stages one after the other, so each stage's prompt path gets the
|
||||
// next stage's GPU (the last one the first's) to stream and compute a share of its experts meanwhile
|
||||
if (multi_gpu && !stages.empty()) {
|
||||
std::vector<std::pair<strata::prefill::Prefill*, int>> paths{{&sp, 0}};
|
||||
for (const auto& st : stages) paths.emplace_back(&st->sp, st->dev);
|
||||
for (size_t i = 0; i < paths.size(); ++i) {
|
||||
const strata::core::OnDevice on(paths[i].second);
|
||||
if (!paths[i].first->set_stage_helper(paths[(i + 1) % paths.size()].first, err)) {
|
||||
std::fprintf(stderr, "strata serve: %s - stage %zu reads its prompts alone\n", err.c_str(), i);
|
||||
err.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
mem_mark("the head and the prompt path");
|
||||
// #340: STRATA_SPLIT_SMALL_OWN=S (tokens): on a layer split, every stage that borrows keeps the slots for an
|
||||
// S-token chunk's buffers for the whole session (0.1.29's own buffers, carved from the tail of its cache):
|
||||
|
||||
Reference in new issue
Block a user