Ship portable CPU dispatch and verified shared runtime dependencies
This commit is contained in:
1 parent
278b09f82c
commit
0bba1a0aa7
19 files changed
+675
-17
No files matched your search
@@ -22,6 +22,7 @@ def main():
|
||||
parser.add_argument("--archive", type=Path, default=ROOT / ".searchi/packages/searchi-windows.zip")
|
||||
parser.add_argument("--models", type=Path, default=ROOT / ".searchi/models/embeddinggemma2")
|
||||
parser.add_argument("--output", type=Path, default=ROOT / ".searchi/packages/smoke.json")
|
||||
parser.add_argument("--baseline", action="store_true", help="Extract only the baseline CPU module to test the packaged fallback")
|
||||
args = parser.parse_args()
|
||||
manifest = json.loads(Path(__file__).with_name("model-manifest.json").read_text())
|
||||
model = args.models / manifest["files"][0]["path"]
|
||||
@@ -40,6 +41,8 @@ def main():
|
||||
data = archive.read(record["path"])
|
||||
assert len(data) == record["bytes"]
|
||||
assert hashlib.sha256(data).hexdigest() == record["sha256"]
|
||||
if args.baseline and record["path"].startswith("ggml-cpu-") and record["path"] != "ggml-cpu-x64.dll":
|
||||
continue
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(data)
|
||||
environment = dict(os.environ, GGML_DISABLE_VULKAN="1")
|
||||
@@ -56,10 +59,13 @@ def main():
|
||||
worker.kill()
|
||||
worker.wait(timeout=10)
|
||||
raise
|
||||
assert worker.returncode == 0, stderr
|
||||
assert worker.returncode == 0, f"Worker exit {worker.returncode:#x}: {stderr}"
|
||||
worker_duration_ms = (time.perf_counter()-started)*1000
|
||||
hello, result = [json.loads(line) for line in stdout.splitlines()]
|
||||
assert hello["ready"] and hello["device"] == "cpu" and result["device"] == "cpu" and result["ok"]
|
||||
assert hello.get("vulkan_module_loaded") is False
|
||||
if args.baseline:
|
||||
assert hello.get("cpu_backend_module") == "ggml-cpu-x64.dll"
|
||||
vector = result["vectors"][0]
|
||||
assert len(vector) == 768 and all(math.isfinite(x) for x in vector)
|
||||
assert abs(sum(x*x for x in vector) - 1) < 0.0001
|
||||
@@ -69,6 +75,9 @@ def main():
|
||||
with args.archive.open("rb") as stream:
|
||||
archive_checksum = hashlib.file_digest(stream, "sha256").hexdigest()
|
||||
report = {"architecture": package["architecture"], "verified_files": len(package["files"]),
|
||||
"cpu_backend_module": hello.get("cpu_backend_module"),
|
||||
"vulkan_module_loaded": hello.get("vulkan_module_loaded"),
|
||||
"baseline_only": args.baseline,
|
||||
"archive_sha256": archive_checksum,
|
||||
"worker_requested_device": "auto", "worker_actual_device": hello["device"],
|
||||
"no_gpu_condition": "GGML_DISABLE_VULKAN=1 only in child; SEARCHI_FORCE_CPU absent",
|
||||
|
||||
Reference in new issue
Block a user