From c8c82e300aaed0cbb2aed8dbfd8ed25da2becd52 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Sun, 22 Nov 2026 01:05:25 +0100 Subject: [PATCH] rdna3: fix STRATA_VERIFY_DEVICE_HITS alias in expert_source and keep opt-in on discrete gfx11 --- engine/include/strata/core/gfx11_extra.hpp | 1 - engine/src/core/expert_source.cpp | 12 +++++++++--- engine/src/core/gfx11_extra_test.cpp | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/engine/include/strata/core/gfx11_extra.hpp b/engine/include/strata/core/gfx11_extra.hpp index 80c93a394f..44945bab52 100644 --- a/engine/include/strata/core/gfx11_extra.hpp +++ b/engine/include/strata/core/gfx11_extra.hpp @@ -70,7 +70,6 @@ inline std::vector> gfx11_discrete_exact_env {"STRATA_SMALL_UNR", "3"}, {"STRATA_GR_Q32_G", "2"}, {"STRATA_GR_Q8_PFS", "1"}, - {"STRATA_VERIFY_DEVICE_HITS", "1"}, }; if (windows) { // Helper thread launches the verify window while the main thread serves CPU doorbells (prevents WDDM first-window launch stalls), diff --git a/engine/src/core/expert_source.cpp b/engine/src/core/expert_source.cpp index acf4af05d5..16537a6a3f 100644 --- a/engine/src/core/expert_source.cpp +++ b/engine/src/core/expert_source.cpp @@ -5562,8 +5562,12 @@ void expert_pool_dispatch_multi(ExpertDispatch& d, const float* x_f, const int32 } static const bool dec_batch = [] { const char* v = std::getenv("STRATA_DEC_BATCH"); return v == nullptr || std::atoi(v) != 0; }(); // the GPU's copy_rows_from_mapped zeroes the rows it computed itself (dec_batch); STRATA_VERIFY_DEVICE_PLAN's - // copy_or_zero_from_mapped copies every row, so there the host still zeroes them - static const bool device_plan = [] { const char* v = std::getenv("STRATA_VERIFY_DEVICE_PLAN"); return v != nullptr && std::atoi(v) != 0; }(); + // (or its alias STRATA_VERIFY_DEVICE_HITS's) copy_or_zero_from_mapped copies every row, so there the host still zeroes them + static const bool device_plan = [] { + const char* v = std::getenv("STRATA_VERIFY_DEVICE_PLAN"); + if (v == nullptr) v = std::getenv("STRATA_VERIFY_DEVICE_HITS"); + return v != nullptr && std::atoi(v) != 0; + }(); const bool gpu_zeroes_hits = (d.plan != nullptr && n <= kMaxWindowEntries && n <= d.plan->cap && dec_batch && !device_plan); bool any_cpu = false; for (int64_t i = 0; i < n; ++i) @@ -7128,7 +7132,9 @@ ForesightSwap* foresight_swap_from_env(int64_t layers, int64_t experts, const st const char* v = std::getenv("STRATA_FS_SLOTS"); const int slots = v ? std::atoi(v) : 0; if (slots <= 0) return nullptr; - if (const char* dp = std::getenv("STRATA_VERIFY_DEVICE_PLAN"); dp && std::atoi(dp) != 0) { + const char* dp = std::getenv("STRATA_VERIFY_DEVICE_PLAN"); + if (dp == nullptr) dp = std::getenv("STRATA_VERIFY_DEVICE_HITS"); + if (dp && std::atoi(dp) != 0) { std::fprintf(stderr, "strata serve: foresight swap: off beside STRATA_VERIFY_DEVICE_PLAN (the device would plan " "resident layers without the host)\n"); return nullptr; diff --git a/engine/src/core/gfx11_extra_test.cpp b/engine/src/core/gfx11_extra_test.cpp index 2ebbc417d4..78a9fa6a6a 100644 --- a/engine/src/core/gfx11_extra_test.cpp +++ b/engine/src/core/gfx11_extra_test.cpp @@ -53,8 +53,8 @@ int main() { const auto ex_lin = gfx11_discrete_exact_env(g, false, false); const auto ex_win = gfx11_discrete_exact_env(g, false, true); const auto wm = gfx11_discrete_wmma_env(g, false); - CHECK(ex_lin.size() == 25); - CHECK(ex_win.size() == 27); + CHECK(ex_lin.size() == 24); + CHECK(ex_win.size() == 26); CHECK(wm.size() == 13); CHECK(has_kv(ex_lin, "STRATA_GDN_HEAD", "1")); CHECK(has_kv(ex_lin, "STRATA_GDN_PP", "2")); @@ -74,7 +74,7 @@ int main() { CHECK(has_kv(wm, "STRATA_PF_P1A_L2", "1")); CHECK(has_kv(wm, "STRATA_DFLASH_WMMA", "1")); CHECK(has_kv(wm, "STRATA_HIP_FAST_DEC", "1")); - CHECK(has_kv(ex_lin, "STRATA_VERIFY_DEVICE_HITS", "1")); + CHECK(!has_kv(ex_lin, "STRATA_VERIFY_DEVICE_HITS", "1")); CHECK(gfx11_prefill_share_default(g, false)); }