diff --git a/src/dsv41/ds4_main.cpp b/src/dsv41/ds4_main.cpp index c3a140d9..0bf6f2db 100644 --- a/src/dsv41/ds4_main.cpp +++ b/src/dsv41/ds4_main.cpp @@ -141,11 +141,11 @@ static int g_round_nd = 0; // The drafts' cut on the product of their confidences (DeepInfer's cumulative rule): a draft is verified while the chance // that it and every draft before it are kept stays at least this - a long window whose later drafts are likely lost is // not verified whole. STRATA_DS4_DSPARK_CUM=F, a request's dspark_cum key; 0: off, only the floor on each draft's own -// confidence (dspark_conf). Project Maya's default 0.5 (a Radeon 8065S: decode +6.5%, the same tokens) +// confidence (dspark_conf). Off by default (not measured faster on code: H100 / owner PC); Project Maya runs 0.5 (a Radeon 8065S: decode +6.5%, the same tokens) float dspark_cum_default() { static const float v = [] { const char* e = std::getenv("STRATA_DS4_DSPARK_CUM"); - return e != nullptr ? (float) std::atof(e) : 0.5f; + return e != nullptr ? (float) std::atof(e) : 0.0f; }(); return v; } diff --git a/src/dsv41/ds4_model.cu b/src/dsv41/ds4_model.cu index 411f9326..abbccf6c 100644 --- a/src/dsv41/ds4_model.cu +++ b/src/dsv41/ds4_model.cu @@ -2420,13 +2420,12 @@ struct Model::Impl { // the row cache a small share of the RAM free (DS4_ENGRAM_CACHE_MB: its size, 0 off; DS4_ENGRAM_THREADS) const size_t row = (size_t) pk.eg_hd + pk.eg_hd / 32; #if defined(_WIN32) - // (Windows: each thread's ReadFile is synchronous, so the threads are the queue depth - a 28K-token prompt - // in one chunk, 1.36M rows before layer 1: 10 threads 17.1 s, 32 14.1 s, 64 13.4 s on a 20-core PC) - int nth = 64; -#else + // (Windows: each thread's ReadFile is synchronous, so the threads are the queue depth - Project Maya: a 28K-token + // prompt in one chunk, 10 threads 17.1 s, 64 13.4 s on a 20-core PC. Here (6 cores, shipped profile) 64 readers + // gave +4.5% on a 4K prompt but no decode gain in every pair: DS4_ENGRAM_THREADS=64 turns them on) +#endif const unsigned hw = std::max(1u, std::thread::hardware_concurrency()); int nth = (int) std::min(16u, std::max(4u, hw / 2)); -#endif if (const char* e = std::getenv("DS4_ENGRAM_THREADS")) nth = std::max(1, std::atoi(e)); const uint64_t avail = ram_avail(); uint64_t mb = avail == ~uint64_t{0} ? 64 : std::min(256, std::max(16, (avail >> 20) / 64)); @@ -2437,10 +2436,10 @@ struct Model::Impl { // Windows: the Engram tables' files that hold nothing else are unmapped and read unbuffered - an SSD's // queue kept by the reader threads instead of the page cache's (whose reads of one file from many threads // went ~255K rows a second here); unbuffered reads of a mapped file take a slow path, so only unmapped - // ones (DS4_EG_DIRECT=0: buffered, mapped, as before) + // ones (off by default: -8% on a 4K prompt here; DS4_EG_DIRECT=1 turns it on) std::vector eg_direct(pk.files.size(), 0); #if defined(_WIN32) - if (pk.gguf && (std::getenv("DS4_EG_DIRECT") == nullptr || std::atoi(std::getenv("DS4_EG_DIRECT")) != 0)) { + if (pk.gguf && std::getenv("DS4_EG_DIRECT") != nullptr && std::atoi(std::getenv("DS4_EG_DIRECT")) != 0) { std::vector eg_file(pk.files.size(), 0), other(pk.files.size(), 0); for (const auto& kt : pk.t) if (kt.second.file >= 0 && (size_t) kt.second.file < pk.files.size()) @@ -5084,12 +5083,12 @@ struct Model::Impl { const float lim = g.lim; { // (os::prefetch_cold, as above: the resident ones are left alone - on Windows the hint walks every page of a // range, ~0.13 ms an IQ2_XXS expert, on the lane's critical path before the first entry computes. - // DS4_IQ_PF_ALL=1: every range, as before) + // off by default (the mmap path, owner PC: not faster in every pair); DS4_IQ_PF_COLD=1 turns it on) std::vector> want; for (const Ent& en : ents) if (!store && (l.ram.empty() || l.ram[(size_t) en.e] < 0)) for (int r = 0; r < 3; ++r) want.push_back({mx_mat(l, en.e, r), mx_part_bytes(l, r)}); - static const bool pf_all = std::getenv("DS4_IQ_PF_ALL") != nullptr && std::atoi(std::getenv("DS4_IQ_PF_ALL")) != 0; + static const bool pf_all = std::getenv("DS4_IQ_PF_COLD") == nullptr || std::atoi(std::getenv("DS4_IQ_PF_COLD")) == 0; if (pf_all) os::prefetch(want); else os::prefetch_cold(want); } diff --git a/src/dsv41/ds4_os.hpp b/src/dsv41/ds4_os.hpp index 19d0722e..916d993f 100644 --- a/src/dsv41/ds4_os.hpp +++ b/src/dsv41/ds4_os.hpp @@ -40,11 +40,12 @@ namespace strata::ds4::os { /// Windows sleeps in 15.6 ms ticks unless a process asks for finer ones: the CPU lane's service thread naps (sleep_for 20 us) /// between tokens, and the device's first wait of the next token then waits out the tick. 1 ms for the process's life -/// (Project Maya #358); DS4_TIMER_MS=0 leaves the system's resolution alone. Elsewhere nothing. +/// (Project Maya #358). Off by default (owner PC, shipped profile, 3 pairs: not faster in every pair); DS4_TIMER_MS=1 turns it on. +/// Elsewhere nothing. inline void fine_timer() { #if defined(_WIN32) const char* v = std::getenv("DS4_TIMER_MS"); - const int ms = v != nullptr ? std::atoi(v) : 1; + const int ms = v != nullptr ? std::atoi(v) : 0; if (ms > 0) timeBeginPeriod((UINT) ms); #endif }