Check packaged query and indexing contexts during CPU fallback

This commit is contained in:
karl committed 2026-10-13 08:00:16 +02:00
1 parent 6e758c5cca
commit aca0a0a4ce
1 file changed
+5 -1
+5 -1
View File
@@ -23,6 +23,7 @@ def main():
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")
parser.add_argument("--role", choices=("indexing", "query"), default="indexing")
args = parser.parse_args()
manifest = json.loads(Path(__file__).with_name("model-manifest.json").read_text())
model = args.models / manifest["files"][0]["path"]
@@ -49,7 +50,7 @@ def main():
environment.pop("SEARCHI_FORCE_CPU", None)
started = time.perf_counter()
worker = subprocess.Popen([str(target / "searchi-gemma-worker.exe"), "--model", str(model),
"--threads", "1", "--device", "auto"], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
"--threads", "1", "--device", "auto", "--role", args.role], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, text=True, encoding="utf-8", env=environment,
creationflags=subprocess.CREATE_NO_WINDOW)
request = json.dumps({"op": "code_query", "text": "retry failed requests with exponential backoff"}) + "\n"
@@ -64,6 +65,8 @@ def main():
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
assert hello.get("role") == args.role
assert hello.get("context_tokens") == (512 if args.role == "query" else 2048)
if args.baseline:
assert hello.get("cpu_backend_module") == "ggml-cpu-x64.dll"
vector = result["vectors"][0]
@@ -78,6 +81,7 @@ def main():
"cpu_backend_module": hello.get("cpu_backend_module"),
"vulkan_module_loaded": hello.get("vulkan_module_loaded"),
"baseline_only": args.baseline,
"worker_role": hello["role"], "context_tokens": hello["context_tokens"],
"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",