generate: STRATA_PIPE_BYIELD_NODRAIN=1 drops a BYIELD without draining the pipelined groups
A pipelined read never gives way (batch_read_piece returns 0 when piped), so a BYIELD that reaches the main loop is for a read that has ended and is dropped. The main loop still drained the groups for it first, as for a request, unless STRATA_PIPE_OVERLAP was set. With the switch the BYIELD is dropped as it comes. A BYIELD the server sends during the read is queued and taken right after BADM, before any group is restarted, so that drain costs nothing today (0 groups in flight, 0.0 ms). Only a BYIELD that arrives once the groups run again (the server reads the control lines late) paid for it: measured with one sent 60 ms after BADM, drain 26 ms with 4 groups in flight and the first rows 50 ms after it, a 23.5 ms gap in the slots' rows and about 14 rows lost (at 576 rows/s). With the switch the longest gap is 7.1 ms, as in plain decode. Off by default: the same path as before. Tokens: batch_overlap_test (a BYIELD during B's read) on vs off token- and RESUME-identical, batch_interleave_test output byte-identical, batch_test16 16/16, and 41 sampled requests of the admission driver (8 with a BYIELD while 4 groups were in flight) equal.
This commit is contained in:
1 parent
bc761d06b1
commit
a62bd38eba
1 file changed
+14
-1
@@ -164,6 +164,17 @@ std::string vram_free_note() {
|
||||
return buf;
|
||||
}
|
||||
|
||||
// STRATA_PIPE_BYIELD_NODRAIN=1 (read once; off by default): with the pipelined groups, a BYIELD that reaches the main
|
||||
// loop is dropped without draining the groups first. A pipelined read never gives way (batch_read_piece), so the
|
||||
// BYIELD is for a read that has ended, and the drain (and the refill after it) did nothing for it
|
||||
bool pipe_byield_nodrain_env() {
|
||||
static const bool on = [] {
|
||||
const char* v = std::getenv("STRATA_PIPE_BYIELD_NODRAIN");
|
||||
return v && v[0] != '0';
|
||||
}();
|
||||
return on;
|
||||
}
|
||||
|
||||
// perf-review D-4: the lent slots are refilled with queued copies and one wait; STRATA_REFILL_BLOCKING=1 waits on each
|
||||
// A file-backed arena on AMD (STRATA_ARENA_MMAP; the engine raises ROCclr's pin-in-place threshold, see main): an
|
||||
// adaptive swap copies one expert straight from the mapped file. Through ROCclr's staging that copy blocks the host
|
||||
@@ -10466,7 +10477,9 @@ int main(int argc, char** argv) {
|
||||
continue;
|
||||
}
|
||||
// a request reads its prompt through every stage: the groups in flight finish first
|
||||
if (piped && line.rfind("BSTOP ", 0) != 0) {
|
||||
// (STRATA_PIPE_BYIELD_NODRAIN: not for a BYIELD, which is dropped below)
|
||||
if (piped && line.rfind("BSTOP ", 0) != 0 &&
|
||||
!(pipe_byield_nodrain_env() && line.rfind("BYIELD", 0) == 0)) {
|
||||
const int in_flight = trace ? (int) std::count_if(pg.begin(), pg.end(), [](const PGroup& G) {
|
||||
return G.inflight; }) : 0;
|
||||
const auto td = Clock::now();
|
||||
|
||||
Reference in new issue
Block a user