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++

tests: the tuning-header gate's test builds on Windows, and RDNA1/RDNA2 stays rejected (#695)

bsorensen110fd98b238490a
diff --git a/tests/prefill/tuning_header_arch_family_test.cpp b/tests/prefill/tuning_header_arch_family_test.cpp
index e55151787..06906c291 100644
--- a/tests/prefill/tuning_header_arch_family_test.cpp
+++ b/tests/prefill/tuning_header_arch_family_test.cpp
@@ -3,38 +3,61 @@
// reporting the sibling architecture - an R9700 under HSA_OVERRIDE_GFX_VERSION=12.0.0 reports gfx1200 - otherwise
// rejects its own calibration and loses the tuned prefill route entirely. The per-solution runtime gate
// (getAlgosFromIndex + matmulIsAlgoSupported, hipBLASEx fallback) is what keeps a wrong solution ID from running,
-// so the header gate can be family-wide: RDNA3 siblings (gfx1100/gfx1101) share it, and every cross-family pair
-// and every version mismatch stays rejected.
+// so the header gate can be family-wide over the SIBLING SETS the gate names: RDNA4 (gfx1200/gfx1201) and RDNA3
+// (gfx1100/gfx1101/gfx1102). Every other pair stays rejected, including architectures that merely share a
+// prefix - gfx1010 (RDNA1) and gfx1030 (RDNA2) are not siblings and must not pass a table to each other.
#include "hipblaslt_tuning.hpp"
+#include <chrono>
#include <cstdio>
+#include <filesystem>
#include <fstream>
#include <string>
-#include <unistd.h>
+namespace fs = std::filesystem;
using strata::prefill::hipblaslt::TuningTable;
namespace {
-std::string case_path() {
- return "/tmp/strata_tuning_header_case_" + std::to_string(getpid()) + ".txt";
-}
+// A portable scratch directory. This test is host-only but builds on Windows/MSVC too, so it cannot use
+// <unistd.h>/getpid() or a hard-coded /tmp: std::filesystem::temp_directory_path plus a steady-clock token is
+// the shape tests/core/gguf_split_test.cpp uses.
+struct TempDir {
+ fs::path path;
+ TempDir() {
+ path = fs::temp_directory_path() /
+ ("strata-tuning-header-" +
+ std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
+ fs::create_directories(path);
+ }
+ ~TempDir() {
+ std::error_code ignored;
+ fs::remove_all(path, ignored);
+ }
+};
-bool load(const std::string& file_arch, int file_version, const std::string& runtime_arch, int runtime_version,
- std::string& err, size_t& rows) {
- const std::string path = case_path();
+bool load(const fs::path& dir, const std::string& file_arch, int file_version, const std::string& runtime_arch,
+ int runtime_version, std::string& err, size_t& rows) {
+ const fs::path path = dir / ("case-" + file_arch + "-" + std::to_string(file_version) + "-" + runtime_arch +
+ "-" + std::to_string(runtime_version) + ".txt");
{
std::ofstream out(path);
out << "# solution IDs are scoped to this hipBLASLt version and device architecture\n"
<< "STRATA_HIPBLASLT_TUNING_V1 " << file_arch << " " << file_version << "\n"
<< "bf16 1 2560 1 4096 110508\n"
<< "bf16 2560 320 2560 8192 135699\n";
+ if (!out) { // otherwise a write failure reads as a gate rejection and the case "passes" for the wrong reason
+ err = "cannot write the synthetic table at " + path.string();
+ rows = 0;
+ return false;
+ }
}
TuningTable table;
- const bool ok = table.load(path, runtime_arch, runtime_version, err);
+ const bool ok = table.load(path.string(), runtime_arch, runtime_version, err);
rows = table.rows().size();
- std::remove(path.c_str());
+ std::error_code ignored;
+ fs::remove(path, ignored);
return ok;
}
@@ -50,6 +73,7 @@ struct Expect {
} // namespace
int main() {
+ TempDir dir;
const Expect cases[] = {
{"gfx1201", 100500, "gfx1201", 100500, true, "exact match"},
{"gfx1200", 100500, "gfx1200", 100500, true, "exact match"},
@@ -60,13 +84,17 @@ int main() {
{"gfx1100", 100202, "gfx1201", 100202, false, "RDNA3 table on RDNA4"},
{"gfx1201", 100202, "gfx1100", 100202, false, "RDNA4 table on RDNA3"},
{"gfx1100", 100202, "gfx1101", 100202, true, "RDNA3 siblings share the family rule"},
+ {"gfx1102", 100202, "gfx1101", 100202, true, "RDNA3 siblings, the third member of the set"},
{"gfx1030", 100202, "gfx1201", 100202, false, "RDNA2 table on RDNA4"},
+ // The pair a five-character prefix match would wrongly group: both are "gfx10", neither is a sibling.
+ {"gfx1010", 100202, "gfx1030", 100202, false, "RDNA1 table on RDNA2: a shared prefix is not a family"},
+ {"gfx1030", 100202, "gfx1010", 100202, false, "RDNA2 table on RDNA1, symmetric direction"},
};
int failures = 0;
for (const auto& c : cases) {
std::string err;
size_t rows = 0;
- const bool ok = load(c.file_arch, c.file_version, c.runtime_arch, c.runtime_version, err, rows);
+ const bool ok = load(dir.path, c.file_arch, c.file_version, c.runtime_arch, c.runtime_version, err, rows);
const bool good = ok == c.accept && (!ok || rows == 2);
if (!good) ++failures;
std::printf("%s %s/%d vs %s/%d rows=%zu %s\n", good ? "ok " : "FAIL", c.file_arch, c.file_version,
@@ -76,4 +104,4 @@ int main() {
const int total = int(sizeof(cases) / sizeof(cases[0]));
std::printf("tuning_header_arch_family_test: %d cases, %d failures\n", total, failures);
return failures == 0 ? 0 : 1;
-}
+}
\ No newline at end of file