From 051db74cdfec6d8c3fd47f85b681a8dd9cec3ed5 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Thu, 22 Oct 2026 16:55:16 +0200 Subject: [PATCH 1/3] gfx1151 on Windows: a bare --prefill auto may reach 8192 again (the 6144 cap of #1630 stays for other cards); STRATA_GFX1151_CHUNK=0 keeps 6144 --- src/program/generate.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 4cd39ac5..053b9f29 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -2798,6 +2798,17 @@ int main(int argc, char** argv) { // So its expert arena stays unregistered. STRATA_UMA_REGISTER=1 (or STRATA_ARENA_PIN_GIB=0) registers it as before. if (strata::core::igpu_uma_arena_default(ad.gcnArchName, all_igpu, win_host)) strata::core::arena_uma_no_register_flag().store(true); + // gfx1151 on Windows (#1630 capped a bare `--prefill auto` at 6144 for a 7900 XTX's commit charge): the Strix Halo has its + // 8192 chunk back. IQ3_S, 8K prompt: 691 -> 787 tok/s (one chunk streams 1,785 experts instead of 2,782), 64K 713 -> 748; + // 4K is one chunk already. STRATA_GFX1151_CHUNK=0 (or STRATA_GFX1151_DEFAULTS=0) keeps 6144. + if (win_host && all_igpu && o.prefill_auto_bare && o.prefill_auto_cap > 0 && std::strncmp(ad.gcnArchName, "gfx1151", 7) == 0) { + const char* c1 = std::getenv("STRATA_GFX1151_CHUNK"); + const char* d1 = std::getenv("STRATA_GFX1151_DEFAULTS"); + if (!(c1 != nullptr && c1[0] == '0') && !(d1 != nullptr && d1[0] == '0')) { + o.prefill_auto_cap = 0; + o.prefill_chunk = std::max(o.prefill_chunk, 8192); + } + } } else (void) cudaGetLastError(); } #endif From c62d9801120e9d0534e77a29062b2531a8d47a16 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Thu, 22 Oct 2026 17:04:58 +0200 Subject: [PATCH 2/3] hip prefill: with no STRATA_HIPBLASLT_TUNING in the environment the engine takes the table beside it (tuning/-hipblaslt-.txt) itself, so a start that did not come through the launcher (hand-made config, CLI) does not read prompts at half speed on a Strix Halo; STRATA_HIPBLASLT_TABLE=off keeps plain hipBLAS --- src/prefill/gemm.cu | 47 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/prefill/gemm.cu b/src/prefill/gemm.cu index 6198170c..c42cb1e4 100644 --- a/src/prefill/gemm.cu +++ b/src/prefill/gemm.cu @@ -36,6 +36,17 @@ #if defined(__HIPCC__) && defined(STRATA_HIPBLASLT_AVAILABLE) #include "hipblaslt_tuning.hpp" +#if defined(_WIN32) +#ifndef NOMINMAX +#define NOMINMAX +#endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#include +#endif #include #include #include @@ -238,9 +249,34 @@ struct HipLtDescriptors { } }; +// The engine package's own tuning folder (/tuning), for a start that did not come through the launcher (a hand-made +// config, a CLI run): without a table the prompt GEMMs fall back to plain hipBLAS and a Strix Halo reads prompts at half speed +// (340 against 690 tok/s, IQ3_S 4K). The launcher sets STRATA_HIPBLASLT_TUNING itself; this is the same table found by the engine. +std::string own_tuning_dir() { +#if defined(_WIN32) + char p[4096] = {}; + const DWORD n = GetModuleFileNameA(nullptr, p, (DWORD) sizeof(p)); + std::string s(p, n); + const size_t k = s.find_last_of("\/"); + return k == std::string::npos ? std::string() : s.substr(0, k + 1) + "tuning/"; +#else + char p[4096] = {}; + const ssize_t n = readlink("/proc/self/exe", p, sizeof(p) - 1); + std::string s(p, n > 0 ? (size_t) n : 0); + const size_t k = s.find_last_of('/'); + return k == std::string::npos ? std::string() : s.substr(0, k + 1) + "tuning/"; +#endif +} + std::unique_ptr create_hipblaslt_state(void* workspace, size_t workspace_bytes) { + std::string path_own; const char* path = std::getenv("STRATA_HIPBLASLT_TUNING"); - if (!path || !*path) return nullptr; + bool from_package = false; + if (!path || !*path) { + const char* sw = std::getenv("STRATA_HIPBLASLT_TABLE"); // the launcher's switch: off / 0 / false = never the packaged table + if (sw != nullptr && (std::strcmp(sw, "off") == 0 || std::strcmp(sw, "0") == 0 || std::strcmp(sw, "false") == 0)) return nullptr; + from_package = true; // the file is found below, once the card and the version are known + } auto state = std::make_unique(); state->workspace = workspace; @@ -265,6 +301,15 @@ std::unique_ptr create_hipblaslt_state(void* workspace, size_t works const auto suffix = arch.find(':'); if (suffix != std::string::npos) arch.resize(suffix); + if (from_package) { + const std::string dir = own_tuning_dir(); + if (dir.empty()) return nullptr; + path_own = dir + arch + "-hipblaslt-" + std::to_string(version) + ".txt"; + std::FILE* f = std::fopen(path_own.c_str(), "rb"); + if (f == nullptr) return nullptr; // no table for this card and hipBLASLt version beside the engine: plain hipBLAS as before + std::fclose(f); + path = path_own.c_str(); + } std::string error; if (!state->table.load(path, arch, version, error)) { std::fprintf(stderr, "prefill gemm: %s; using hipBLASEx\n", error.c_str()); From 7b04360f93a6e2444d757a6a4a1c50a955e11f88 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Thu, 22 Oct 2026 18:05:47 +0200 Subject: [PATCH 3/3] hip prefill: the package tuning folder lookup split the exe path on '/' only (a backslash escape lost in the string): split on both --- src/prefill/gemm.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prefill/gemm.cu b/src/prefill/gemm.cu index c42cb1e4..a52af750 100644 --- a/src/prefill/gemm.cu +++ b/src/prefill/gemm.cu @@ -257,7 +257,7 @@ std::string own_tuning_dir() { char p[4096] = {}; const DWORD n = GetModuleFileNameA(nullptr, p, (DWORD) sizeof(p)); std::string s(p, n); - const size_t k = s.find_last_of("\/"); + const size_t k = s.find_last_of("\\/"); return k == std::string::npos ? std::string() : s.substr(0, k + 1) + "tuning/"; #else char p[4096] = {};