Qualify scoped Spark Omni text path on native Windows RTX

This commit is contained in:
tzhouam committed 2026-09-24 15:36:22 +08:00
1 parent b4179a9c1c
commit 605b68cc5f
12 files changed
+2359 -11

No files matched your search

@@ -26,21 +26,25 @@ def clean_ledger(value: dict) -> bool:
def audit(root: Path, route: str) -> dict:
report_path = root / f"{route}_v4_report.json"
first_log = root / f"{route}_v4_server.log"
second_log = root / f"{route}_v4_server_restart.log"
prefix = "spark_rtx" if route == "rtx" else f"{route}_v4"
report_path = root / f"{prefix}_report.json"
first_log = root / f"{prefix}_server.log"
second_log = root / f"{prefix}_server_restart.log"
run = json.loads(report_path.read_text(encoding="utf-8"))
before = run["execution_plan"]
after = run["restart_check"]["fresh_execution_plan"]
abort = run["abort_check"]
restart = run["restart_check"]
if run["status"] != "passed" or run["device"] != ("cpu" if route == "cpu" else "Vulkan1"):
expected_device = {"cpu": "cpu", "radeon": "Vulkan1", "rtx": "Vulkan0"}[route]
if run["status"] != "passed" or run["device"] != expected_device:
raise ValueError(f"{route}: runtime outcome or device differs")
if route == "rtx" and (run["warmup_count"] != 1 or run["measured_count"] != 20):
raise ValueError("RTX route did not complete its declared 20-request profile")
if any(plan["model_sha256"] != MODEL_SHA256 or plan["server_sha256"] != SERVER_SHA256
for plan in (before, after)):
raise ValueError(f"{route}: model or server binary changed between sessions")
expected_offload = ["0", "29"] if route == "cpu" else ["29", "29"]
expected_buffers = [] if route == "cpu" else ["Vulkan1"]
expected_buffers = {"cpu": [], "radeon": ["Vulkan1"], "rtx": ["Vulkan0"]}[route]
if any(plan["offloaded_layers"] != expected_offload
or plan["model_buffer_devices"] != expected_buffers for plan in (before, after)):
raise ValueError(f"{route}: execution placement differs from the intended hardware")
@@ -50,11 +54,17 @@ def audit(root: Path, route: str) -> dict:
if route == "radeon" and any(plan["expected_device_name"] != "AMD Radeon(TM) 890M Graphics"
for plan in (before, after)):
raise ValueError("Radeon route did not pin the 890M by name")
if route == "rtx" and any(plan["expected_device_name"] != "NVIDIA GeForce RTX 5090 Laptop GPU"
for plan in (before, after)):
raise ValueError("RTX route did not pin the 5090 by name")
if ([row["answer"] for row in run["checks"]] != ["Paris", "1511"]
or not all(row["correct"] for row in run["checks"] + run["measured"])
or restart["fresh_request"]["answer"] != "Paris"
or not restart["fresh_request"]["correct"]):
raise ValueError(f"{route}: named complete-request checks failed")
if route == "rtx" and (not run["context_check"]["rejected"]
or run["context_check"]["recovery"]["answer"] != "Paris"):
raise ValueError("RTX route did not reject overflow and recover")
if (abort["abort_case"] != "inventory_120"
or abort["server_tasks_after_abort_request_start"]
<= abort["server_tasks_before_abort_request"]
@@ -74,6 +84,28 @@ def audit(root: Path, route: str) -> dict:
second_starts = len(TASK_START.findall(second_log.read_text(encoding="utf-8", errors="replace")))
if first_starts < abort["server_tasks_after_abort_request_start"] or second_starts < 1:
raise ValueError(f"{route}: server logs do not contain the recorded tasks")
if route == "rtx":
for path in (first_log, second_log):
log = path.read_text(encoding="utf-8", errors="replace")
if ("using device Vulkan0 (NVIDIA GeForce RTX 5090 Laptop GPU)" not in log
or "offloaded 29/29 layers to GPU" not in log
or "Vulkan0 model buffer size" not in log):
raise ValueError("RTX raw server log does not verify GPU placement")
public_path = root / "spark_rtx_public_report.json"
public_log_path = root / "spark_rtx_public_server.log"
public = json.loads(public_path.read_text(encoding="utf-8"))
if (public["status"] != "passed" or public["device"] != "Vulkan0"
or len(public["outputs"]) != 1
or public["outputs"][0]["text"].strip() != "Paris"
or public["outputs"][0]["error"] is not None):
raise ValueError("RTX public AsyncOmni request did not pass")
public_log = public_log_path.read_text(encoding="utf-8", errors="replace")
if ("using device Vulkan0 (NVIDIA GeForce RTX 5090 Laptop GPU)" not in public_log
or "offloaded 29/29 layers to GPU" not in public_log):
raise ValueError("RTX public request did not use the RTX")
files = [report_path, first_log, second_log]
if route == "rtx":
files += [public_path, public_log_path, root / "hardware.json"]
return {
"status": "passed",
"device": run["device"],
@@ -85,20 +117,22 @@ def audit(root: Path, route: str) -> dict:
"fresh_answer": restart["fresh_request"]["answer"],
"ledger_cleared": True,
"files": {p.name: {"bytes": p.stat().st_size, "sha256": sha256(p)}
for p in (report_path, first_log, second_log)},
for p in files},
}
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--evidence-dir", required=True, type=Path)
parser.add_argument("--routes", nargs="+", choices=("cpu", "radeon", "rtx"),
default=("cpu", "radeon"))
args = parser.parse_args()
result = {
"scope": "one in-flight cancel and fresh-stage restart per native Windows Spark placement",
"scope": "one in-flight cancel and fresh-stage restart per selected native Windows Spark placement",
"checkpoint": "Spark-X2.5-1.7B Q4_K_M",
"model_sha256": MODEL_SHA256,
"llama_server_sha256": SERVER_SHA256,
"routes": {route: audit(args.evidence_dir, route) for route in ("cpu", "radeon")},
"routes": {route: audit(args.evidence_dir, route) for route in args.routes},
"limits": [
"A fresh StageRuntime is created after cancellation; no same-session state migration is claimed.",
"The backend returns complete requests rather than incremental token events.",