STRATA_ADAPT_OVERLAP_SLOW_US: test hook that slows the adaptive copies so the windows wait for them

This commit is contained in:
Niko1221 committed 2026-10-10 22:12:27 +02:00
1 parent f95f2eabbd
commit 8c34c475da
1 file changed
+7
+7
View File
@@ -8276,6 +8276,13 @@ int main(int argc, char** argv) {
std::vector<size_t> 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);