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

Engine SHA-256: warn and install when no digest is available, STRATA_SKIP_SHA256=1; docs note for STRATA_SH_STREAM (#1218 #1272)

Niko1221960de8bb3d1c
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index fe4c3b022..39446f038 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -210,6 +210,12 @@ rounding). `STRATA_HIP_ADAPT_KERNEL_COPY=1` (#884) copies the adaptive tier's sw
engine, a workaround for the gfx1030 hang seen with the MMQ prompt path and adaptive swaps (untested on the reporter's
machine). Windows HIP: the doorbell kernels fence their store (#697), and the shared-expert fork is off on HIP (#816).
+**The shared-expert stream fork (`STRATA_SH_STREAM`):** it is off by default on HIP, except for the gfx1151 table, and
+that default stays. The measurements disagree by platform. 2x RX 6900 XT on Linux (#1272): turning it off costs 5-13%
+of decode (one card 47.5 / 46.9 / 48.3 -> 50.5 / 48.5 / 51.3 tok/s with it on). RX 6800 on Windows (#816,
+`bench/results/2026-10-04-community-rx-6800-windows`): on was 12-22% slower. 4x R9700: fork off was 13-45% faster.
+Linux RX 6000 users can try `STRATA_SH_STREAM=1`; the output is identical either way.
+
## Linux: verify timeouts while the kernel reclaims host memory (experimental workarounds)
A `verify: timed out at layer N` or "no progress for 60 s" message does not by itself mean a kernel or handshake bug. Two
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index 27cc0ffe0..bea6135cc 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -65,6 +65,9 @@ PC); `STRATA_READ_AHEAD=0` turns that off. On Linux with transparent huge pages
for `MADV_HUGEPAGE` on top (a fragmented machine spent minutes compacting memory, #771); `STRATA_NO_ARENA_THP=1` skips
that request on any setting.
+**Setup says the engine does not match GitHub's checksum.**
+Setup checks the downloaded ready-made engine against the SHA-256 GitHub publishes. On a mismatch the file is corrupt or was changed on the way, so setup deletes it and stops; run setup again to download it afresh. If GitHub gives no checksum (offline, rate limited, your own mirror), setup warns and installs anyway. `STRATA_SKIP_SHA256=1` skips the check, only if you insist.
+
## While it answers
**It's very slow and the disk light keeps blinking.**
diff --git a/setup.py b/setup.py
index 2e482f3ea..1100dc645 100644
--- a/setup.py
+++ b/setup.py
@@ -2491,7 +2491,7 @@ def release_of(base: str) -> tuple[str, str | None] | None:
def is_local(base: str) -> bool:
- """True for a path on this machine - `C:\mirror`, `/mnt/mirror`, `\\share\engine`, `file://...`.
+ """True for a path on this machine - `C:/mirror`, `/mnt/mirror`, `//share/engine`, `file://...`.
A local folder is the user's own file on their own disk, the same trust decision as `--gguf-dir`, and
there is no published digest for it to be checked against. It is treated differently from a remote
@@ -2513,7 +2513,7 @@ def engine_digest(asset: str, base: str) -> tuple[int, str] | None:
GitHub populates `digest` for every asset, including ones uploaded before the field existed
(measured on v0.1.34 through v0.1.40.1). None means no answer - no network, a rate limit, or a
- release that does not publish one - and the caller refuses rather than treating it as a pass.
+ release that does not publish one - and the caller warns and installs anyway (never refuses).
"""
where = release_of(base)
if where is None: # a local folder or a plain mirror: nothing published to check against
@@ -2554,11 +2554,11 @@ def verify_engine_archive(z: Path, asset: str, base: str) -> None:
- a GitHub release URL: the tag is read out of the URL, so the exact release the bytes claim to come
from is the one checked rather than "latest" (setup tries the checkout's own release first, #214),
and the repository comes out of the URL too, so a fork's releases are checked against the fork;
- - a local folder (`--prebuilt D:\mirror`): nothing published to check against. This warns and goes
+ - a local folder (`--prebuilt D:/mirror`): nothing published to check against. This warns and goes
ahead - it is the user's own file, the same trust decision as `--gguf-dir`, and there is nothing an
API could say about it;
- any other remote mirror: nothing published to check against either, but a network is in the middle,
- so it refuses unless `STRATA_ALLOW_UNVERIFIED_ENGINE=1`.
+ so it warns and installs anyway (no digest is never a reason to refuse).
What a digest from the API does NOT cover, stated plainly: it proves the bytes are the ones GitHub
published for that asset, so it catches a corrupted transfer, a mirror or proxy that substituted the
@@ -2574,20 +2574,16 @@ def verify_engine_archive(z: Path, asset: str, base: str) -> None:
to download the same file. A mark that saves 0.8 s is not worth a class of hole - anything that
changes the file after it was verified, at any length - so there is no mark here.
"""
+ if os.environ.get("STRATA_SKIP_SHA256") == "1":
+ warn(f"STRATA_SKIP_SHA256=1: NOT checking {asset} against its SHA-256. If the file is corrupt or "
+ f"tampered with, it will be installed anyway. Unset it to get the check back.")
+ return
want = engine_digest(asset, base) # one API call: this is a rate-limited API
if not want:
- if is_local(base):
- warn(f"{base} is a folder on this PC, not a published release, so {asset} cannot be checked "
- f"against a SHA-256. Installing it as it is.")
- return
- if os.environ.get("STRATA_ALLOW_UNVERIFIED_ENGINE"):
- warn(f"no published SHA-256 for {asset}; installing it UNVERIFIED "
- f"(STRATA_ALLOW_UNVERIFIED_ENGINE)")
- return
- if release_of(base) is None:
- raise UnverifiedEngine(f"{base} is not a GitHub release URL, so there is no published "
- f"SHA-256 for {asset}, and it is not a folder on this PC either")
- raise UnverifiedEngine(f"GitHub's API did not give a SHA-256 for {asset}")
+ # no published digest (offline, rate limit, a mirror or folder): install anyway, never refuse
+ warn(f"could not get a SHA-256 for {asset} from GitHub (offline, rate limited, or not a release "
+ f"URL), so it was NOT verified. Installing it as it is.")
+ return
size, sha = want
have = z.stat().st_size if z.exists() else -1
if have != size:
@@ -2615,14 +2611,12 @@ def engine_refused(asset: str, e: Exception, updating: bool) -> None:
catches what the download can throw.
"""
if not updating:
- fail(f"cannot verify the Strata engine: {e}",
- "the downloaded archive has been deleted so the next run fetches the published one. "
- "Re-run when GitHub answers - it publishes a size and SHA-256 for every asset - or set "
- "STRATA_ALLOW_UNVERIFIED_ENGINE=1 to install an engine that cannot be checked")
+ fail(f"the downloaded Strata engine does not match GitHub's checksum: {e}",
+ "the bad download has been deleted (corrupt or tampered), so the next run fetches the "
+ "published file again. Set STRATA_SKIP_SHA256=1 only if you insist on installing it anyway")
return
warn(f"keeping the engine that is installed: {e}")
- say(f" Nothing was replaced. Run setup again when GitHub answers, or set "
- f"STRATA_ALLOW_UNVERIFIED_ENGINE=1 to install an engine that cannot be checked.")
+ say(" Nothing was replaced. The bad download was deleted; run setup again to fetch it afresh.")
def prebuilt_bases(url_base) -> list[str]:
diff --git a/tools/test_setup_engine_hash.py b/tools/test_setup_engine_hash.py
index f315e1870..86c8b2850 100644
--- a/tools/test_setup_engine_hash.py
+++ b/tools/test_setup_engine_hash.py
@@ -191,7 +191,7 @@ class ArchiveVerification(unittest.TestCase):
patch = mock.patch.dict(os.environ, {}, clear=False)
env = patch.start()
self.addCleanup(patch.stop)
- env.pop("STRATA_ALLOW_UNVERIFIED_ENGINE", None)
+ env.pop("STRATA_SKIP_SHA256", None)
def digest(self, value):
return mock.patch.object(setup, "engine_digest", return_value=value)
@@ -226,33 +226,30 @@ class ArchiveVerification(unittest.TestCase):
setup.verify_engine_archive(self.z, ASSET, TAG_BASE)
self.assertFalse(self.z.exists())
- def test_refuses_when_github_gives_no_hash(self):
- with self.digest(None):
- with self.assertRaises(setup.UnverifiedEngine) as caught:
- setup.verify_engine_archive(self.z, ASSET, TAG_BASE)
- self.assertIn("did not give a SHA-256", str(caught.exception))
- self.assertTrue(self.z.exists(), "the file is left alone; only the install is refused")
+ def test_no_digest_warns_and_installs_anyway(self):
+ # "recommend, never force": no digest (offline, rate limit, mirror, folder) is a warning, not a refusal.
+ for base in (TAG_BASE, LOCAL_BASE, "https://mirror.invalid/dl/"):
+ said = io.StringIO()
+ with self.digest(None), mock.patch.object(setup, "warn", said.write):
+ setup.verify_engine_archive(self.z, ASSET, base) # must not raise
+ self.assertIn("NOT verified", said.getvalue(), base)
+ self.assertTrue(self.z.exists())
- def test_a_local_folder_warns_and_proceeds(self):
- # `--prebuilt D:\mirror` used to be refused unless the override was set, which was a regression on
- # a supported workflow: it is the user's own file on their own disk, the same trust decision as
- # --gguf-dir, and no API could say anything about it. It now warns by name and goes ahead.
+ def test_skip_env_skips_the_check_loudly(self):
+ os.environ["STRATA_SKIP_SHA256"] = "1"
said = io.StringIO()
- with self.digest(None), mock.patch.object(setup, "warn", said.write):
- setup.verify_engine_archive(self.z, ASSET, LOCAL_BASE) # must not raise
- out = said.getvalue()
- self.assertIn(LOCAL_BASE, out)
- self.assertIn("cannot be checked", out)
-
- def test_a_remote_mirror_still_needs_the_override(self):
- # There IS a network in the middle of a mirror, and still no release to check it against.
- with self.digest(None):
- with self.assertRaises(setup.UnverifiedEngine) as caught:
- setup.verify_engine_archive(self.z, ASSET, "https://mirror.invalid/dl/")
- msg = str(caught.exception)
- self.assertIn("not a GitHub release URL", msg)
- # and it says why a local folder would have been different, which is the distinction
- self.assertIn("is not a folder on this PC either", msg)
+ with mock.patch.object(setup, "engine_digest", return_value=(1, "0" * 64)) as m, mock.patch.object(setup, "warn", said.write):
+ setup.verify_engine_archive(self.z, ASSET, TAG_BASE) # a wrong digest, but skipped
+ self.assertEqual(m.call_count, 0)
+ self.assertIn("STRATA_SKIP_SHA256", said.getvalue())
+ self.assertIn("NOT checking", said.getvalue())
+ self.assertTrue(self.z.exists())
+
+ def test_skip_env_needs_exactly_1(self):
+ os.environ["STRATA_SKIP_SHA256"] = "0"
+ with self.digest((1, "0" * 64)):
+ with self.assertRaises(setup.UnverifiedEngine):
+ setup.verify_engine_archive(self.z, ASSET, TAG_BASE)
def test_a_truncated_archive_is_refused(self):
# There is no finish mark any more, so nothing can vouch for a file that changed after it was
@@ -285,22 +282,6 @@ class ArchiveVerification(unittest.TestCase):
setup.verify_engine_archive(self.z, ASSET, TAG_BASE)
self.assertEqual(m.call_count, 1, f"engine_digest was called {m.call_count} times")
- def test_the_api_is_asked_once_when_the_escape_hatch_is_set_too(self):
- os.environ["STRATA_ALLOW_UNVERIFIED_ENGINE"] = "1"
- with mock.patch.object(setup, "engine_digest", return_value=None) as m:
- said = io.StringIO()
- with mock.patch.object(setup, "say", said.write), mock.patch.object(setup, "warn", said.write):
- setup.verify_engine_archive(self.z, ASSET, TAG_BASE) # must not raise
- self.assertEqual(m.call_count, 1, f"engine_digest was called {m.call_count} times")
- self.assertIn("UNVERIFIED", said.getvalue())
- self.assertIn(ASSET, said.getvalue())
-
- def test_the_escape_hatch_is_opt_in(self):
- self.assertNotIn("STRATA_ALLOW_UNVERIFIED_ENGINE", os.environ)
- with self.digest(None):
- with self.assertRaises(setup.UnverifiedEngine):
- setup.verify_engine_archive(self.z, ASSET, TAG_BASE)
-
class WhatARefusalDoesToTheCaller(unittest.TestCase):
"""`engine_refused`, and the paths that call it.
@@ -327,7 +308,7 @@ class WhatARefusalDoesToTheCaller(unittest.TestCase):
def test_updating_keeps_the_installed_engine_instead_of_stopping(self):
# The call site's own words: "a failed download must not stop the model from starting".
- for digest in ((999, "f" * 64), (1, "0" * 64), None):
+ for digest in ((999, "f" * 64), (1, "0" * 64)):
eng, out = self.get_prebuilt(updating=True, digest=digest)
self.assertIsNone(eng, f"digest={digest!r} did not return None")
self.assertNotIn("Setup stopped", out.getvalue(),