strata-q36 hybrid: the whole-layer prompt copy when fewer than half the experts are resident

Many small copies were slower than the one whole-layer copy on a 12 GB card
(RTX 3060, UD-Q4_K_XL at 37 of 256 resident: pp2048 1540 in runs, 1974
whole). gfx1201 UD-Q6_K_XL (205/256) and Q8_0 (176/256) keep the per-expert
copies: pp4096 3504-3588 and 3015-3079.
This commit is contained in:
Niko1221 committed 2026-10-13 07:39:25 +02:00
1 parent 577abb0378
commit 9341ebd213
1 file changed
+3 -1
+3 -1
View File
@@ -1543,7 +1543,9 @@ struct Engine {
static const bool all = std::getenv("STRATA_Q36_STREAM_ALL") != nullptr;
const int ne = (int) m->g.n_expert;
const Hy& H = hy[(size_t) stream_seq[(size_t) i]];
if (all || L.n_slots <= 0) {
// fewer than half the experts resident (a 12 GB card): the one whole-layer copy is faster than many small ones
// (RTX 3060, UD-Q4_K_XL at 37 of 256: pp2048 1970 whole vs 1540 in runs)
if (all || 2 * L.n_slots < ne) {
CK(cudaMemcpyAsync(stage[b], L.hblobs, L.stride * (size_t) ne, cudaMemcpyHostToDevice, cst));
} else {
for (int x = 0; x < ne;) {