From 8c34c475da8de8cc6844979183759d4051594c97 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Sat, 10 Oct 2026 21:40:24 +0200 Subject: [PATCH] STRATA_ADAPT_OVERLAP_SLOW_US: test hook that slows the adaptive copies so the windows wait for them --- src/program/generate.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 8e898a64..c5d392a3 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -8276,6 +8276,13 @@ int main(int argc, char** argv) { std::vector cp_bytes; for (size_t si = 0; si < swaps.size(); ++si) { const Swap& s = swaps[si]; + if (aov && (si == 0 || swaps[si - 1].layer != s.layer)) { + // test hook (STRATA_ADAPT_OVERLAP_SLOW_US=N): a slow link, to make the windows wait for the copies + static const int slow_us = [] { const char* e = std::getenv("STRATA_ADAPT_OVERLAP_SLOW_US"); return e ? std::atoi(e) : 0; }(); + static int slow_arg = slow_us; + if (slow_us > 0) + cudaLaunchHostFunc(adapt_stream, [](void* p) { std::this_thread::sleep_for(std::chrono::microseconds(*(int*) p)); }, &slow_arg); + } const size_t in = (size_t) s.layer * g.n_expert + s.in, out = (size_t) s.layer * g.n_expert + s.out; const int32_t slot = fenced_slots.empty() ? host_res[out] : fenced_slots[si]; const uint8_t* b = srcp->blob_stable(s.layer, s.in);