Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

STRATA_TRACE: one clock for the whole process, so a layer split's stages compare

Niko12213a26753027c5
diff --git a/src/prefill/prefill.cpp b/src/prefill/prefill.cpp
index 4f9265bfd..9fee4720f 100644
--- a/src/prefill/prefill.cpp
+++ b/src/prefill/prefill.cpp
@@ -2718,8 +2718,8 @@ bool Prefill::run_impl(const int64_t* tokens, int64_t n, int64_t pos0, std::stri
break;
}
if (std::getenv("STRATA_TRACE")) {
- static thread_local Clock::time_point t0;
- static thread_local bool set = false;
+ static Clock::time_point t0; // process-wide: the stages run on different threads
+ static bool set = false;
if (!set) { t0 = Clock::now(); set = true; }
const double ms = std::chrono::duration<double, std::milli>(Clock::now() - t0).count();
std::fprintf(stderr, "strata trace: prompt chunk %lld of %lld stage [%lld,%lld) %.1f ms\n", (long long) c0,
@@ -5171,3 +5171,4 @@ bool Prefill::run(const int64_t* tokens, int64_t n, int64_t pos0, std::string& e
}
} // namespace strata::prefill
+
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index 56c2136a8..15c281996 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -11026,8 +11026,8 @@ int main(int argc, char** argv) {
const bool trace = std::getenv("STRATA_TRACE") != nullptr;
auto tr = [&](const char* what, long long a = -1, long long b = -1) {
if (!trace) return;
- static thread_local Clock::time_point t0;
- static thread_local bool t0_set = false;
+ static Clock::time_point t0; // process-wide: the stages run on different threads
+ static bool t0_set = false;
if (!t0_set) { t0 = Clock::now(); t0_set = true; }
const double ms = std::chrono::duration<double, std::milli>(Clock::now() - t0).count();
std::fprintf(stderr, "strata trace: %s %lld %lld %.1f ms\n", what, a, b, ms);
@@ -17093,3 +17093,4 @@ int main(int argc, char** argv) {
cudaFree(arena);
return 0;
}
+