older CPUs (experimental): STRATA_ISA_FLOOR=avx|none, and setup compiles it instead of stopping (#394 #595 #623)

- CMake: STRATA_ISA_FLOOR (empty by default) builds ggml-cpu for AVX (Sandy/Ivy Bridge) or SSE4.2
  (Nehalem/Westmere) instead of the build host or AVX2; every other ggml ISA option off. Strata's own
  AVX2/AVX-512 kernels stay in the binary behind their CPU checks. Excludes STRATA_PORTABLE. The ggml
  block follows the Strata_Dirigo fork's (rwkeyes).
- STRATA_FORCE_ISA=avx2|avx|sse caps the engine's CPU probes, so the older-CPU paths run on any PC
  (how this was tested here: no old CPU). cpu_sse42_ok(), isa_floor_build().
- The engine: a normal build still refuses a CPU without AVX2, now pointing at the experimental build;
  a floor build checks its own floor (AVX, or SSE4.2 + POPCNT) and warns that it is experimental and
  slow (or, on an AVX2 CPU, that the normal build is faster).
- setup: a CPU without AVX2 warns ("experimental, slow") and compiles the engine on the PC with the
  floor it has, instead of failing (#595's idea); the prebuilt AVX2 engine is not used there. Recorded
  in BUILD.json; a build folder for another floor is configured afresh. STRATA_ISA_FLOOR=avx|none asks
  for it on any PC. Windows + AMD has no source build: a clear stop. The MCP server's recommendation
  notes it instead of refusing.
- tools/test_setup_oldcpu.py.

Default build: nothing changes (no new CMake definitions, the probes answer as before without the env).
This commit is contained in:
Niko1221 committed 2026-10-03 23:35:52 +02:00
1 parent 51a60af92a
commit b8dbdfe12a
7 files changed
+286 -14

No files matched your search

+26 -4
View File
@@ -1923,12 +1923,33 @@ int main(int argc, char** argv) {
// ... and nothing runs on a CPU without AVX2: every CPU expert kernel is AVX2 at least (the AVX-512 ones are
// chosen above it), and so is ggml-cpu in the release build, which the native pack's layout load initializes
// next. Refused here, by name, rather than an illegal instruction in the first expert.
if (!strata::kernels::cpu::cpu_avx2_ok()) {
std::fprintf(stderr, "strata generate: this CPU (%s) does not support AVX2 with FMA and F16C, which every CPU "
"expert kernel needs; Strata runs on Intel Haswell (2013), AMD Zen (2017) or newer\n",
// The experimental older-CPU build (STRATA_ISA_FLOOR=avx|none, compiled on that PC; #394 #595 #623) has ggml-cpu
// for that floor, so a native pack's experts run there on ggml-cpu (every AVX2 kernel is behind cpu_avx2_ok).
const char* isa_floor = strata::kernels::cpu::isa_floor_build();
if (!strata::kernels::cpu::cpu_avx2_ok() && isa_floor[0] == '\0') {
std::fprintf(stderr, "strata generate: this CPU (%s) does not support AVX2 with FMA and F16C, which this engine's "
"CPU expert kernels need; Strata runs on Intel Haswell (2013), AMD Zen (2017) or newer. "
"Older CPUs are EXPERIMENTAL and slow: setup compiles an engine for them on this PC "
"(STRATA_ISA_FLOOR, see \"Older CPUs\" in docs/INSTALL.md)\n",
strata::kernels::cpu::cpu_name().c_str());
return 2;
}
if (isa_floor[0] != '\0') {
const bool avx_floor = std::strcmp(isa_floor, "avx") == 0;
if (avx_floor ? !strata::kernels::cpu::cpu_avx1_ok() : !strata::kernels::cpu::cpu_sse42_ok()) {
std::fprintf(stderr, "strata generate: this engine is the older-CPU build for %s, which this CPU (%s) does "
"not have%s\n", avx_floor ? "AVX" : "SSE4.2 with POPCNT",
strata::kernels::cpu::cpu_name().c_str(),
avx_floor ? "; compile it with STRATA_ISA_FLOOR=none" : "");
return 2;
}
if (!strata::kernels::cpu::cpu_avx2_ok())
std::fprintf(stderr, "strata generate: EXPERIMENTAL older-CPU build (ggml-cpu for %s): this CPU has no AVX2, "
"so the CPU's experts run on ggml-cpu's kernels - expect it to be slow\n", isa_floor);
else
std::fprintf(stderr, "strata generate: this is the older-CPU build (ggml-cpu for %s); this CPU has AVX2, "
"and the normal build is faster on it\n", isa_floor);
}
std::string err;
if (!o.native_head_gguf.empty() && !o.stream_token) {
@@ -2001,7 +2022,8 @@ int main(int argc, char** argv) {
else if (!strata::kernels::cpu::cpu_avx512_ok())
std::fprintf(stderr, "strata generate: this CPU has no AVX-512: the expert kernels run on %s "
"(multi-token for the i-quant gate/up rows)\n",
std::getenv("STRATA_NO_IQ256") == nullptr ? "AVX-2" : "ggml-cpu vec_dot (STRATA_NO_IQ256 set)");
!strata::kernels::cpu::cpu_avx2_ok() ? "ggml-cpu vec_dot (no AVX2: the older-CPU build)"
: std::getenv("STRATA_NO_IQ256") == nullptr ? "AVX-2" : "ggml-cpu vec_dot (STRATA_NO_IQ256 set)");
strata::core::ModelGeometry g; // canonical defaults; the model file overrides the MoE shape below
int64_t K = 10;
// THE ROPE CONFIG RESOLVES HERE, BEFORE ANY WEIGHT MOVES - the CLI and the model file have both spoken,