diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 5f54eb10..eeb842cb 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -1332,11 +1332,21 @@ void stall_report(std::FILE* f, uint64_t layers_during) { /// STRATA_TRACE=1: the VRAM left at a step of the startup (finds what fills the card after the cache is sized) void mem_mark(const char* where) { - static const bool on = std::getenv("STRATA_TRACE") != nullptr; - if (!on) return; + static const char* const env = std::getenv("STRATA_TRACE"); + if (env == nullptr) return; size_t free_b = 0, total_b = 0; cudaMemGetInfo(&free_b, &total_b); std::fprintf(stderr, "strata trace: %lld MiB free after %s\n", (long long) (free_b >> 20), where); + // STRATA_TRACE=2: also wait for the device here and name the first step after which it reports an error. A + // "sticky" failure (#2013: unspecified launch failure surfacing in a later, unrelated call) is then pinned to + // the step that ran the faulting work. Only a diagnostic: it adds a synchronisation per mark. + if (env[0] == '2') { + const cudaError_t sync_e = cudaDeviceSynchronize(); + const cudaError_t last_e = cudaGetLastError(); + std::fprintf(stderr, "strata trace: device %s after %s (sync: %s, last error: %s)\n", + sync_e == cudaSuccess && last_e == cudaSuccess ? "ok" : "ERROR", where, cudaGetErrorString(sync_e), + cudaGetErrorString(last_e)); + } } /// #463's A/B: STRATA_ADAPT_NOWAIT=1 lets a verify window start before the adaptive tier's copies have landed (0.1.37) @@ -7308,6 +7318,7 @@ int main(int argc, char** argv) { } } } + mem_mark("before the prompt path init"); for (;;) { const int r = init_prompt_paths(); if (r == 0) break;