fix(tests,docs): register STRATA_PREFILL_RAM_RESERVE_MIB and prefer Git usr/bin in test_docker_files

This commit is contained in:
Niko1221 committed 2026-11-23 02:12:25 +01:00
1 parent ff7a77bfbe
commit 94e1fc4fbf
3 files changed
+363 -292

No files matched your search

+8 -7
View File
@@ -10,7 +10,7 @@ debugging and are kept in `terminal/data/settings-register.json`.
A number or a word is set like any environment variable, for example `STRATA_KVA=1`. In the Terminal, `strata launch --set NAME=value`
puts it in the model's run configuration.
## Switches you can turn on (331)
## Switches you can turn on (332)
Off unless you set them. The last column says where each one is described.
@@ -258,6 +258,7 @@ Off unless you set them. The last column says where each one is described.
| `STRATA_PREFILL_LAYER_MAJOR` | on / off | NVIDIA and AMD | [release-notes-0.2.7.md](release-notes-0.2.7.md) |
| `STRATA_PREFILL_MMQ` | number | NVIDIA and AMD, Intel Arc | [AMD_HIP_PERFORMANCE.md](AMD_HIP_PERFORMANCE.md), [INTEL.md](INTEL.md), [INTEL_INT8_EXPERTS.md](INTEL_INT8_EXPERTS.md) |
| `STRATA_PREFILL_PIPE` | number | NVIDIA and AMD | [MULTI_GPU.md](MULTI_GPU.md) |
| `STRATA_PREFILL_RAM_RESERVE_MIB` | on / off | NVIDIA and AMD | - |
| `STRATA_PREFILL_ROUTED_STREAM` | text | NVIDIA and AMD | [DETAILS.md](DETAILS.md) |
| `STRATA_PREFILL_ROUTED_STREAM_DEPTH` | on / off | NVIDIA and AMD | [DETAILS.md](DETAILS.md) |
| `STRATA_PREFILL_STREAM_ALL` | on / off | Intel Arc | [INTEL.md](INTEL.md) |
@@ -373,11 +374,11 @@ version made it the default.
| `STRATA_GFX11_EXP8` | text | AMD | v0.2.19 | - |
| `STRATA_GFX11_WMMA_DEFAULTS` | on / off | NVIDIA and AMD | v0.2.19 | - |
| `STRATA_GFX12_DEFAULTS` | on / off | NVIDIA and AMD | v0.2.16 | [DETAILS.md](DETAILS.md) |
| `STRATA_GFX12_EXP8` | text | AMD | - | - |
| `STRATA_GFX12_EXP8` | text | AMD | v0.2.20 | - |
| `STRATA_GR_V3` | number | NVIDIA and AMD, Intel Arc | v0.2.16 | [DETAILS.md](DETAILS.md), [README.md](bench-results/2026-10-03-community-rx7900xtx-rocm102-nightly/README.md), [README.md](bench-results/2026-10-04-community-rx7900xtx-hipblaslt-100500/README.md) |
| `STRATA_HC_Q8_ALL_STAGES` | on / off | NVIDIA and AMD | v0.2.16 | - |
| `STRATA_HIPBLASLT` | number | AMD | v0.2.19 | - |
| `STRATA_HIP_EXP8` | text | AMD | - | - |
| `STRATA_HIP_EXP8` | text | AMD | v0.2.20 | - |
| `STRATA_HIP_MAPPED_COHERENT` | on / off | NVIDIA and AMD | v0.2.19 | - |
| `STRATA_HIP_QUEUE_PRIME` | on / off | NVIDIA and AMD | v0.2.16 | [AMD_HIP.md](AMD_HIP.md), [release-notes-0.2.1.md](release-notes-0.2.1.md), [release-notes-0.2.2.md](release-notes-0.2.2.md) |
| `STRATA_I8_SM70` | text | NVIDIA and AMD | v0.2.16 | - |
@@ -398,7 +399,7 @@ version made it the default.
| `STRATA_MTP_BATCH_F16` | on / off | NVIDIA and AMD, Intel Arc | v0.2.16 | - |
| `STRATA_MTP_BATCH_RING` | on / off | NVIDIA and AMD, Intel Arc | v0.2.16 | - |
| `STRATA_NAN_GUARD` | number | NVIDIA and AMD | v0.2.16 | [DETAILS.md](DETAILS.md) |
| `STRATA_NO_DOT_X4` | on / off | CPU | - | - |
| `STRATA_NO_DOT_X4` | on / off | CPU | v0.2.20 | - |
| `STRATA_NO_IQ512` | on / off | CPU | v0.2.16 | - |
| `STRATA_NO_KQ512` | on / off | CPU | v0.2.17 | [DETAILS.md](DETAILS.md) |
| `STRATA_NUMA_CARD` | text | NVIDIA and AMD | v0.2.16 | - |
@@ -439,12 +440,12 @@ version made it the default.
| `STRATA_SCORES_THREAD` | number | NVIDIA and AMD | v0.2.16 | [AMD_HIP.md](AMD_HIP.md), [DETAILS.md](DETAILS.md), [NVIDIA_V100.md](NVIDIA_V100.md) |
| `STRATA_SELECT_OLD` | on / off | NVIDIA and AMD, Intel Arc | v0.2.16 | - |
| `STRATA_SM60_TABLE` | number | NVIDIA and AMD | v0.2.16 | [OLDER_GPUS.md](OLDER_GPUS.md) |
| `STRATA_SM70_PERF` | text | NVIDIA and AMD | - | [DETAILS.md](DETAILS.md), [NVIDIA_V100.md](NVIDIA_V100.md) |
| `STRATA_SM70_PERF` | text | NVIDIA and AMD | v0.2.20 | [DETAILS.md](DETAILS.md), [NVIDIA_V100.md](NVIDIA_V100.md) |
| `STRATA_SPLIT_CHUNK16K` | number | NVIDIA and AMD | v0.2.16 | [MULTI_GPU.md](MULTI_GPU.md) |
| `STRATA_SPLIT_OWN` | on / off | NVIDIA and AMD, Intel Arc | v0.2.16 | [MULTI_GPU.md](MULTI_GPU.md), [README.md](bench-results/2026-10-02-community-2x5060ti/README.md), [README.md](bench-results/2026-10-06-community-2x-rx-7900-gre/README.md) |
| `STRATA_SWITCH_POINT` | on / off | NVIDIA and AMD | v0.2.16 | - |
| `STRATA_SYCL_BF16_DET` | number | Intel Arc | v0.2.16 | - |
| `STRATA_SYCL_BMG_ROUTED_EXPERTS` | on / off | Intel Arc | - | [INTEL.md](INTEL.md) |
| `STRATA_SYCL_BMG_ROUTED_EXPERTS` | on / off | Intel Arc | v0.2.20 | [INTEL.md](INTEL.md) |
| `STRATA_SYCL_GDN_PREFILL_REG_QK` | on / off | Intel Arc | v0.2.16 | [INTEL.md](INTEL.md) |
| `STRATA_SYCL_IQ4_LOOKUP` | number | Intel Arc | v0.2.16 | - |
| `STRATA_SYCL_IQ4_PAIR_REUSE` | on / off | Intel Arc | v0.2.16 | - |
@@ -456,7 +457,7 @@ version made it the default.
| `STRATA_TOPK_SPLIT` | number | NVIDIA and AMD | v0.2.16 | [DETAILS.md](DETAILS.md) |
| `STRATA_TOPK_STREAM` | on / off | NVIDIA and AMD, Intel Arc | v0.2.16 | [AMD_HIP.md](AMD_HIP.md), [DETAILS.md](DETAILS.md), [TROUBLESHOOTING.md](TROUBLESHOOTING.md) |
| `STRATA_TQ_STAGE` | on / off | NVIDIA and AMD | v0.2.16 | [GYRO.md](GYRO.md), [release-notes-0.2.2.md](release-notes-0.2.2.md) |
| `STRATA_UMA` | on / off | Intel Arc | - | [INTEL.md](INTEL.md), [INTEL_ARC.md](INTEL_ARC.md) |
| `STRATA_UMA` | on / off | Intel Arc | v0.2.20 | [INTEL.md](INTEL.md), [INTEL_ARC.md](INTEL_ARC.md) |
| `STRATA_UMA_PIN_CAP` | on / off | AMD | v0.2.16 | [BATCHING.md](BATCHING.md) |
| `STRATA_UMA_RESERVE_GIB` | on / off | NVIDIA and AMD | v0.2.16 | [release-notes-0.2.2.md](release-notes-0.2.2.md), [STRIX_HALO.md](STRIX_HALO.md) |
| `STRATA_WDDM_SHARED_RESERVE_MIB` | number | NVIDIA and AMD | v0.2.17 | - |
File diff suppressed because it is too large. Load diff
+52 -15
View File
@@ -13,31 +13,70 @@ import yaml
ROOT = Path(__file__).resolve().parents[2]
DOCKER = ROOT.parent / "tools" / "docker"
SH = shutil.which("sh")
BASH = shutil.which("bash") # the full path: on Windows a bare "bash" can start the WSL launcher in System32 instead of Git bash
CYGPATH = shutil.which("cygpath")
def _posix_bin_dir() -> Path | None:
import os
if os.name == "nt":
git = shutil.which("git")
if git:
usr_bin = Path(git).resolve().parents[1] / "usr" / "bin"
if usr_bin.is_dir():
return usr_bin
return None
_USR_BIN = _posix_bin_dir()
def _find_posix_tool(name: str) -> str | None:
"""Prefer Git's usr/bin on Windows so System32/bash.exe (the WSL stub) is never mistaken for Git bash."""
import os
if _USR_BIN is not None:
cand = shutil.which(name, path=str(_USR_BIN))
if cand:
return cand
found = shutil.which(name)
if found and os.name == "nt" and "system32" in found.lower():
try:
if subprocess.run([found, "--version"], capture_output=True, timeout=5).returncode != 0:
return None
except OSError:
return None
return found
def _run_posix(cmd: list[str], *, env: dict[str, str] | None = None, check: bool = False):
import os
run_env = dict(os.environ if env is None else env)
if _USR_BIN is not None:
run_env["PATH"] = str(_USR_BIN) + os.pathsep + run_env.get("PATH", "")
return subprocess.run(cmd, capture_output=True, text=True, env=run_env, check=check)
SH = _find_posix_tool("sh")
BASH = _find_posix_tool("bash")
CYGPATH = _find_posix_tool("cygpath")
def sh_path(p) -> str:
"""The path as the shell reads it. Git bash on Windows wants /c/Users/..., not C:\\Users\\... (tar even takes `C:` for a host)."""
if CYGPATH is None:
return str(p)
return subprocess.run([CYGPATH, "-u", str(p)], capture_output=True, text=True, check=True).stdout.strip()
return _run_posix([CYGPATH, "-u", str(p)], check=True).stdout.strip()
class Scripts(unittest.TestCase):
@unittest.skipIf(SH is None, "needs sh")
def test_shell_scripts_parse(self):
for name in ("entrypoint.sh", "strata-wrapper.sh", "healthcheck.sh", "build.sh", "publish.sh"):
r = subprocess.run([SH, "-n", sh_path(DOCKER / name)], capture_output=True, text=True)
r = _run_posix([SH, "-n", sh_path(DOCKER / name)])
self.assertEqual(r.returncode, 0, f"{name}: {r.stderr}")
@unittest.skipIf(BASH is None, "needs bash")
def test_smoke_test_parses_with_bash(self): # it is a bash script (process substitution), not POSIX sh
r = subprocess.run([BASH, "-n", sh_path(DOCKER / "smoke-test.sh")], capture_output=True, text=True)
r = _run_posix([BASH, "-n", sh_path(DOCKER / "smoke-test.sh")])
self.assertEqual(r.returncode, 0, r.stderr)
@unittest.skipIf(SH is None or shutil.which("tar") is None, "needs sh and tar")
@unittest.skipIf(SH is None or _find_posix_tool("tar") is None, "needs sh and tar")
def test_build_script_exits_zero_after_assembling_a_context(self):
"""--ctx-only stops after the context is made (no docker needed). The EXIT trap once returned 1 there, so a good run reported failure."""
import tempfile
@@ -48,8 +87,7 @@ class Scripts(unittest.TestCase):
(pkg / "strata").write_text("#!/bin/sh\n", encoding="utf-8")
(pkg / "strata").chmod(0o755)
ctx = Path(tmp) / "ctx"
r = subprocess.run([SH, sh_path(DOCKER / "build.sh"), "--flavor", "cuda", "--engine", sh_path(pkg), "--ctx", sh_path(ctx), "--ctx-only"],
capture_output=True, text=True)
r = _run_posix([SH, sh_path(DOCKER / "build.sh"), "--flavor", "cuda", "--engine", sh_path(pkg), "--ctx", sh_path(ctx), "--ctx-only"])
self.assertEqual(r.returncode, 0, r.stdout + r.stderr)
self.assertTrue((ctx / "Dockerfile").is_file())
self.assertTrue((ctx / "terminal-src" / "docs" / "TERMINAL_LAUNCH.md").is_file())
@@ -61,9 +99,8 @@ class Scripts(unittest.TestCase):
(hy4pkg / "engine-component.json").write_text('{"shape": "hy4", "entrypoint": "strata-hy4"}', encoding="utf-8")
(hy4pkg / "strata-hy4").write_text("#!/bin/sh\n", encoding="utf-8")
ctx2 = Path(tmp) / "ctx2"
r2 = subprocess.run([SH, sh_path(DOCKER / "build.sh"), "--flavor", "cuda", "--engine", sh_path(pkg),
"--shape-engine", f"hy4:{sh_path(hy4pkg)}", "--ctx", sh_path(ctx2), "--ctx-only"],
capture_output=True, text=True)
r2 = _run_posix([SH, sh_path(DOCKER / "build.sh"), "--flavor", "cuda", "--engine", sh_path(pkg),
"--shape-engine", f"hy4:{sh_path(hy4pkg)}", "--ctx", sh_path(ctx2), "--ctx-only"])
self.assertEqual(r2.returncode, 0, r2.stdout + r2.stderr)
self.assertTrue((ctx2 / "shapes" / "hy4" / "engine" / "hy4pkg" / "engine-component.json").is_file())
self.assertTrue((ctx2 / "shapes" / "hy4" / "engine" / "hy4pkg" / "strata-hy4").is_file())
@@ -182,7 +219,7 @@ class LegacyModelsGuard(unittest.TestCase):
env.pop("ALLOW_DOWNLOAD", None)
if allow is not None:
env["ALLOW_DOWNLOAD"] = allow
return subprocess.run([SH, sh_path(script)], capture_output=True, text=True, env=env)
return _run_posix([SH, sh_path(script)], env=env)
def test_files_in_the_older_place_stop_the_start_with_the_folder_named(self):
import tempfile
@@ -236,7 +273,7 @@ class LegacyModelsGuard(unittest.TestCase):
encoding="utf-8",
newline="\n",
)
return subprocess.run([SH, sh_path(script)], capture_output=True, text=True)
return _run_posix([SH, sh_path(script)])
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
@@ -301,7 +338,7 @@ class Publishing(unittest.TestCase):
@unittest.skipIf(SH is None, "needs sh")
def test_publish_script_parses_and_defaults_to_not_pushing(self):
path = DOCKER / "publish.sh"
self.assertEqual(subprocess.run([SH, "-n", sh_path(path)], capture_output=True, text=True).returncode, 0)
self.assertEqual(_run_posix([SH, "-n", sh_path(path)]).returncode, 0)
text = path.read_text(encoding="utf-8")
self.assertNotIn("\r", text)
self.assertIn('push=""', text) # no --push, no docker push