Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
54 lines
2.2 KiB
Python
54 lines
2.2 KiB
Python
"""Which OS and backend combinations the project commits to, and what this machine is.
|
||
|
||
Pure and tiny on purpose: the engine resolver on the start path (engine_component.py) needs these answers, and the
|
||
start path must not import the component fetcher (components.py) to get them.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import platform
|
||
|
||
|
||
class ComponentError(RuntimeError):
|
||
"""A component could not be used. The message names the reason and nothing was changed."""
|
||
|
||
def __init__(self, message: str, code: int = 6) -> None:
|
||
super().__init__(message)
|
||
self.code = code
|
||
|
||
|
||
#: The OS × backend families the handoff commits to. A component may only be activated where its
|
||
#: family is listed here, so an unqualified combination is refused rather than attempted: the packet
|
||
#: is explicit that Windows SYCL and Intel Macs are not supported rather than merely untested.
|
||
BACKEND_MATRIX: dict[str, tuple[str, ...]] = {
|
||
"metal": ("macos-arm64",),
|
||
"cuda": ("windows-x86_64", "linux-x86_64"),
|
||
"hip": ("windows-x86_64", "linux-x86_64"),
|
||
"sycl": ("linux-x86_64",),
|
||
"cpu": ("macos-arm64", "macos-x86_64", "windows-x86_64", "linux-x86_64"),
|
||
}
|
||
|
||
def host_platform() -> str:
|
||
"""This machine as an `os-arch` key, matching `BACKEND_MATRIX`."""
|
||
system = {"Darwin": "macos", "Linux": "linux", "Windows": "windows"}.get(platform.system())
|
||
if system is None:
|
||
raise ComponentError(f"unsupported operating system: {platform.system()}")
|
||
machine = platform.machine().lower()
|
||
arch = {"arm64": "arm64", "aarch64": "arm64",
|
||
"x86_64": "x86_64", "amd64": "x86_64"}.get(machine, machine)
|
||
return f"{system}-{arch}"
|
||
|
||
|
||
def backend_supported(backend: str, target: str | None = None) -> tuple[bool, str]:
|
||
"""Whether a backend family is committed to on a platform, with the reason if not."""
|
||
target = target or host_platform()
|
||
if backend not in BACKEND_MATRIX:
|
||
return False, f"unknown backend family {backend!r}"
|
||
platforms = BACKEND_MATRIX[backend]
|
||
if target in platforms:
|
||
return True, ""
|
||
return False, (f"{backend} is not a supported combination on {target}; it is supported on "
|
||
f"{', '.join(platforms)}. Unsupported combinations are not attempted.")
|
||
|
||
|