From 045e58468cdbdd7a172ad3cb6892548ee911f3e3 Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 08:09:06 -0500 Subject: [PATCH 1/9] Add PR42 page-base-flight qualification path --- .../glm53_page_base_flight/README.md | 21 + .../glm53_page_base_flight/qualification.py | 472 ++++++++++++++++++ .../test_qualification.py | 179 +++++++ .../README.md | 23 + .../build-image.sh | 127 +++++ .../pins.json | 269 ++++++++++ .../prepare_context.py | 110 ++++ .../remove_distribution.py | 125 +++++ .../test_pr42_page_base_flight_contract.py | 97 ++++ .../verify_image.py | 77 +++ ...fetensors-sparkcache-tp4-dcp1.example.json | 209 ++++++++ ...are_glm53_pr42_page_base_flight_profile.py | 60 +++ ...are_glm53_pr42_page_base_flight_profile.py | 80 +++ 13 files changed, 1849 insertions(+) create mode 100644 performance/harnesses/glm53_page_base_flight/README.md create mode 100644 performance/harnesses/glm53_page_base_flight/qualification.py create mode 100644 performance/harnesses/glm53_page_base_flight/test_qualification.py create mode 100644 runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md create mode 100644 runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh create mode 100644 runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json create mode 100644 runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py create mode 100644 runtime/glm53-flash-dflash7-pr42-page-base-flight/remove_distribution.py create mode 100644 runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py create mode 100644 runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py create mode 100644 scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json create mode 100644 scripts/prepare_glm53_pr42_page_base_flight_profile.py create mode 100644 scripts/test_prepare_glm53_pr42_page_base_flight_profile.py diff --git a/performance/harnesses/glm53_page_base_flight/README.md b/performance/harnesses/glm53_page_base_flight/README.md new file mode 100644 index 00000000..bb8e20ae --- /dev/null +++ b/performance/harnesses/glm53_page_base_flight/README.md @@ -0,0 +1,21 @@ +# GLM-5.3 opaque-page base-flight qualification + +Status: **implemented, not qualified**. + +`qualification.py` publishes one 98,304-token base and sixteen independently +authenticated 131,072-token result roots with private 32,768-token tails. It +records prompt and response hashes without response content. It never starts, +stops, or restarts a service. + +Run `semantic` and `publish`, inspect each rank's isolated manifest root, and +retain their receipts. A service restart is a separate operator action and +must not occur without authorization. After that action, run `replay`, capture +bounded rank logs for only that cohort, and run `verify` with four manifest +receipts and four logs. The verifier requires one +`sparkcache-page-base-restore-flight/v1` summary per rank with 16 participants, +one physical base read, 15 avoided reads, and outcome `verified`, plus 16 +independently verified result restores on every rank. + +The unrelated request submitted after the cohort uses no common prefix and +must complete successfully. This is a bounded isolation check, not a latency +claim. diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py new file mode 100644 index 00000000..26ca4296 --- /dev/null +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -0,0 +1,472 @@ +#!/usr/bin/env python3 +"""Produce and verify deterministic GLM-5.3 page-base-flight evidence.""" + +from __future__ import annotations + +import argparse +import concurrent.futures +import hashlib +import json +import time +import urllib.error +import urllib.request +from pathlib import Path +from typing import Any + + +BASE_TOKENS = 98_304 +RESULT_TOKENS = 131_072 +TAIL_TOKENS = RESULT_TOKENS - BASE_TOKENS +PARTICIPANTS = 16 +FLIGHT_SCHEMA = "sparkcache-page-base-restore-flight/v1" +RESTORE_SCHEMA = "sparkcache-restore-timing/v1" +RECEIPT_SCHEMA = "sparkring-glm53-pr42-page-base-flight-qualification/v1" +PROMPT_SEED = ( + "SparkCache deterministic token bank: alpha beta gamma delta epsilon zeta " + "eta theta iota kappa lambda mu nu xi omicron pi rho sigma tau upsilon." +) + + +class QualificationError(RuntimeError): + """The deterministic qualification evidence is incomplete or contradictory.""" + + +def _canonical(value: object) -> bytes: + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def _sha256(value: bytes) -> str: + return hashlib.sha256(value).hexdigest() + + +def _token_hash(tokens: list[int]) -> str: + return _sha256(_canonical(tokens)) + + +def _write(path: Path, document: dict[str, Any]) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text( + json.dumps(document, indent=2, sort_keys=True) + "\n", + encoding="utf-8", + newline="\n", + ) + + +def _post(endpoint: str, route: str, payload: dict[str, Any], timeout: float) -> dict: + request = urllib.request.Request( + endpoint.rstrip("/") + route, + data=_canonical(payload), + headers={"Content-Type": "application/json"}, + method="POST", + ) + try: + with urllib.request.urlopen(request, timeout=timeout) as response: + body = response.read() + status = response.status + except urllib.error.HTTPError as exc: + raise QualificationError(f"HTTP {exc.code} from {route}") from exc + except OSError as exc: + raise QualificationError(f"request to {route} did not complete: {exc}") from exc + if status != 200: + raise QualificationError(f"HTTP {status} from {route}") + try: + return json.loads(body) + except json.JSONDecodeError as exc: + raise QualificationError(f"non-JSON response from {route}") from exc + + +def discover_token_bank(endpoint: str, model: str, timeout: float) -> list[int]: + document = _post( + endpoint, + "/tokenize", + {"model": model, "prompt": PROMPT_SEED}, + timeout, + ) + observed = document.get("tokens") or document.get("token_ids") + if not isinstance(observed, list): + raise QualificationError("tokenize response omits token IDs") + unique: list[int] = [] + for value in observed: + if isinstance(value, int) and value >= 0 and value not in unique: + unique.append(value) + if len(unique) < PARTICIPANTS + 2: + raise QualificationError("tokenize response has fewer than 18 distinct tokens") + return unique[: PARTICIPANTS + 2] + + +def prompts(token_bank: list[int]) -> tuple[list[int], list[list[int]], list[int]]: + if len(token_bank) < PARTICIPANTS + 2: + raise QualificationError("token bank must contain at least 18 distinct IDs") + common, terminator = token_bank[0], token_bank[-1] + base = [common] * BASE_TOKENS + [terminator] + results = [ + [common] * BASE_TOKENS + [token_bank[index + 1]] * TAIL_TOKENS + [terminator] + for index in range(PARTICIPANTS) + ] + unrelated = [token_bank[-2]] * 4096 + [terminator] + return base, results, unrelated + + +def _completion( + endpoint: str, + model: str, + token_ids: list[int], + timeout: float, +) -> dict[str, Any]: + started = time.perf_counter() + response = _post( + endpoint, + "/v1/completions", + { + "model": model, + "prompt": token_ids, + "max_tokens": 1, + "temperature": 0, + }, + timeout, + ) + choices = response.get("choices") + if not isinstance(choices, list) or len(choices) != 1: + raise QualificationError("completion response must contain one choice") + text = choices[0].get("text") + if not isinstance(text, str): + raise QualificationError("completion response omits text") + usage = response.get("usage") or {} + return { + "http_status": 200, + "prompt_tokens": len(token_ids), + "prompt_sha256": _token_hash(token_ids), + "response_sha256": _sha256(text.encode()), + "completion_tokens": usage.get("completion_tokens"), + "finish_reason": choices[0].get("finish_reason"), + "elapsed_seconds": round(time.perf_counter() - started, 6), + } + + +def publish(endpoint: str, model: str, timeout: float) -> dict[str, Any]: + bank = discover_token_bank(endpoint, model, timeout) + base, results, _unrelated = prompts(bank) + base_result = _completion(endpoint, model, base, timeout) + result_receipts = [ + {"result_index": index, **_completion(endpoint, model, prompt, timeout)} + for index, prompt in enumerate(results) + ] + return { + "schema": RECEIPT_SCHEMA, + "kind": "publish", + "status": "observed", + "model": model, + "token_bank_sha256": _token_hash(bank), + "base_publication_tokens": BASE_TOKENS, + "result_publication_tokens": RESULT_TOKENS, + "private_tail_tokens": TAIL_TOKENS, + "base_request": base_result, + "results": result_receipts, + } + + +def semantic(endpoint: str, model: str, timeout: float) -> dict[str, Any]: + prompt = "The capital of France is" + response = _post( + endpoint, + "/v1/completions", + {"model": model, "prompt": prompt, "max_tokens": 16, "temperature": 0}, + timeout, + ) + choice = response["choices"][0] + text = str(choice.get("text", "")) + return { + "schema": RECEIPT_SCHEMA, + "kind": "semantic", + "status": "verified" if "paris" in text.lower() else "rejected", + "model": model, + "prompt_sha256": _sha256(prompt.encode()), + "response_sha256": _sha256(text.encode()), + "semantic_match": "paris" in text.lower(), + } + + +def replay( + endpoint: str, + model: str, + publish_receipt: dict[str, Any], + timeout: float, +) -> dict[str, Any]: + bank = discover_token_bank(endpoint, model, timeout) + _base, results, unrelated = prompts(bank) + expected = [item["prompt_sha256"] for item in publish_receipt["results"]] + observed = [_token_hash(item) for item in results] + if observed != expected: + raise QualificationError("reconstructed prompt hashes differ from publication") + with concurrent.futures.ThreadPoolExecutor(max_workers=PARTICIPANTS + 1) as pool: + futures = [ + pool.submit(_completion, endpoint, model, prompt, timeout) + for prompt in results + ] + time.sleep(0.05) + unrelated_future = pool.submit(_completion, endpoint, model, unrelated, timeout) + receipts = [future.result() for future in futures] + unrelated_receipt = unrelated_future.result() + for index, item in enumerate(receipts): + item["result_index"] = index + if item["response_sha256"] != publish_receipt["results"][index][ + "response_sha256" + ]: + raise QualificationError(f"result {index} response differs from publication") + return { + "schema": RECEIPT_SCHEMA, + "kind": "replay", + "status": "verified", + "model": model, + "token_bank_sha256": _token_hash(bank), + "results": receipts, + "unrelated_later_request": unrelated_receipt, + } + + +def inspect_manifests(root: Path, rank: int) -> dict[str, Any]: + selected: list[dict[str, Any]] = [] + for path in root.rglob("*.json"): + try: + document = json.loads(path.read_text(encoding="utf-8")) + except (OSError, json.JSONDecodeError): + continue + if ( + document.get("base_committed_tokens") == BASE_TOKENS + and document.get("committed_tokens") == RESULT_TOKENS + and document.get("schema") in { + "sparkcache-page-delta-manifest/v1", + "sparkcache-page-delta-manifest/v2", + } + ): + base_root = document.get("base_root") + if not isinstance(base_root, dict): + raise QualificationError("result manifest omits its authenticated base root") + if _sha256(_canonical(base_root)) != document.get("base_root_sha256"): + raise QualificationError("result manifest base-root checksum differs") + selected.append( + { + "context_digest": document["context_digest"], + "base_context_digest": document["base_context_digest"], + "base_root_sha256": document["base_root_sha256"], + "layout_sha256": document["layout_sha256"], + "delta_sha256": document["delta_sha256"], + "delta_encoded_bytes": document["delta_encoded_bytes"], + } + ) + if len(selected) != PARTICIPANTS: + raise QualificationError(f"rank {rank} has {len(selected)} result manifests, want 16") + for field in ("base_context_digest", "base_root_sha256", "layout_sha256"): + if len({item[field] for item in selected}) != 1: + raise QualificationError(f"rank {rank} result manifests disagree on {field}") + for field in ("context_digest", "delta_sha256"): + if len({item[field] for item in selected}) != PARTICIPANTS: + raise QualificationError(f"rank {rank} result manifests do not have 16 {field} values") + return { + "schema": RECEIPT_SCHEMA, + "kind": "manifest-inspection", + "status": "verified", + "rank": rank, + "storage_mode": "block_pages_v1", + "base_tokens": BASE_TOKENS, + "result_tokens": RESULT_TOKENS, + "result_count": len(selected), + "shared_base_context_digest": selected[0]["base_context_digest"], + "shared_base_root_sha256": selected[0]["base_root_sha256"], + "layout_sha256": selected[0]["layout_sha256"], + "result_context_digests": sorted(item["context_digest"] for item in selected), + "delta_sha256": sorted(item["delta_sha256"] for item in selected), + } + + +def _records(path: Path, marker: str, schema: str) -> list[dict[str, Any]]: + records: list[dict[str, Any]] = [] + for line in path.read_text(encoding="utf-8", errors="replace").splitlines(): + if marker not in line: + continue + try: + document = json.loads(line.split(marker, 1)[1]) + except json.JSONDecodeError as exc: + raise QualificationError(f"malformed {schema} record in {path}") from exc + if document.get("schema") == schema: + records.append(document) + return records + + +def verify_evidence( + artifact_receipt: Path, + semantic_receipt: Path, + publish_receipt: Path, + replay_receipt: Path, + manifest_receipts: list[Path], + rank_logs: list[Path], +) -> dict[str, Any]: + artifact = json.loads(artifact_receipt.read_text(encoding="utf-8")) + semantic_document = json.loads(semantic_receipt.read_text(encoding="utf-8")) + published = json.loads(publish_receipt.read_text(encoding="utf-8")) + replayed = json.loads(replay_receipt.read_text(encoding="utf-8")) + labels = artifact.get("labels") + image_id = artifact.get("image_id") + if not isinstance(labels, dict): + image = artifact.get("image") + if not isinstance(image, dict): + raise QualificationError("artifact receipt omits image metadata") + labels = image.get("labels") + image_id = image.get("id") + if not isinstance(labels, dict) or not isinstance(image_id, str): + raise QualificationError("artifact receipt omits labels or image ID") + expected_labels = { + "org.sparkcache.source-revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", + "org.sparkcache.source-tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "org.sparkcache.source-sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "org.sparkcache.cuda-placement-library-sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", + "org.sparkcache.feature.page-base-read-flight": ( + "implemented-gpu-free-tested" + ), + "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.cache-namespace-impact": "none", + } + if any(labels.get(name) != value for name, value in expected_labels.items()): + raise QualificationError("artifact receipt labels differ from PR42") + contract = artifact.get("page_base_restore_flight_contract") + if contract is not None and ( + not isinstance(contract, dict) or contract.get("summary_schema") != FLIGHT_SCHEMA + ): + raise QualificationError("artifact receipt contains a contradictory contract") + if semantic_document.get("status") != "verified": + raise QualificationError("semantic canary is not verified") + if replayed.get("status") != "verified": + raise QualificationError("replay receipt is not verified") + published_results = published.get("results", []) + replayed_results = replayed.get("results", []) + if len(published_results) != PARTICIPANTS or len(replayed_results) != PARTICIPANTS: + raise QualificationError("publication and replay must each contain 16 results") + if [item["prompt_sha256"] for item in published_results] != [ + item["prompt_sha256"] for item in replayed_results + ]: + raise QualificationError("publication and replay prompt hashes differ") + if [item["response_sha256"] for item in published_results] != [ + item["response_sha256"] for item in replayed_results + ]: + raise QualificationError("publication and replay response hashes differ") + manifests = [json.loads(path.read_text(encoding="utf-8")) for path in manifest_receipts] + if len(manifests) != 4 or any(item.get("status") != "verified" for item in manifests): + raise QualificationError("four verified rank manifest receipts are required") + rank_evidence = [] + if len(rank_logs) != 4: + raise QualificationError("four bounded rank logs are required") + for rank, path in enumerate(rank_logs): + flights = _records(path, "spark-context-cache-page-base-flight:", FLIGHT_SCHEMA) + if len(flights) != 1: + raise QualificationError(f"rank {rank} has {len(flights)} flight summaries") + flight = flights[0] + required = { + "participants": 16, + "physical_base_reads": 1, + "avoided_base_reads": 15, + "outcome": "verified", + "storage_mode": "block_pages_v1", + } + if any(flight.get(name) != value for name, value in required.items()): + raise QualificationError(f"rank {rank} flight summary differs: {flight}") + restores = [ + item + for item in _records( + path, + "spark-context-cache-restore-timing:", + RESTORE_SCHEMA, + ) + if item.get("span_tokens") == RESULT_TOKENS + and item.get("storage_mode") == "block_pages_v1" + and item.get("outcome") == "verified" + ] + if len(restores) != PARTICIPANTS: + raise QualificationError(f"rank {rank} has {len(restores)} verified result restores") + if len({item["digest"] for item in restores}) != PARTICIPANTS: + raise QualificationError(f"rank {rank} result restore digests are not independent") + rank_evidence.append( + { + "rank": rank, + "flight_summary": flight, + "verified_result_restores": len(restores), + "log_sha256": _sha256(path.read_bytes()), + } + ) + inputs = [ + artifact_receipt, + semantic_receipt, + publish_receipt, + replay_receipt, + *manifest_receipts, + ] + return { + "schema": RECEIPT_SCHEMA, + "kind": "qualification-verdict", + "status": "qualified", + "image_id": image_id, + "sparkcache_revision": labels["org.sparkcache.source-revision"], + "semantic_prompt_sha256": semantic_document["prompt_sha256"], + "semantic_response_sha256": semantic_document["response_sha256"], + "result_prompt_sha256": [item["prompt_sha256"] for item in replayed_results], + "result_response_sha256": [item["response_sha256"] for item in replayed_results], + "unrelated_later_request": replayed["unrelated_later_request"], + "rank_evidence": rank_evidence, + "input_sha256": {path.name: _sha256(path.read_bytes()) for path in inputs}, + } + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + subparsers = parser.add_subparsers(dest="command", required=True) + for name in ("semantic", "publish", "replay"): + command = subparsers.add_parser(name) + command.add_argument("--endpoint", required=True) + command.add_argument("--model", required=True) + command.add_argument("--timeout", type=float, default=900.0) + command.add_argument("--output", type=Path, required=True) + if name == "replay": + command.add_argument("--publish-receipt", type=Path, required=True) + inspect = subparsers.add_parser("inspect-manifests") + inspect.add_argument("--manifest-root", type=Path, required=True) + inspect.add_argument("--rank", type=int, choices=range(4), required=True) + inspect.add_argument("--output", type=Path, required=True) + verify = subparsers.add_parser("verify") + verify.add_argument("--artifact-receipt", type=Path, required=True) + verify.add_argument("--semantic-receipt", type=Path, required=True) + verify.add_argument("--publish-receipt", type=Path, required=True) + verify.add_argument("--replay-receipt", type=Path, required=True) + verify.add_argument("--manifest-receipt", type=Path, action="append", required=True) + verify.add_argument("--rank-log", type=Path, action="append", required=True) + verify.add_argument("--output", type=Path, required=True) + args = parser.parse_args() + if args.command == "semantic": + document = semantic(args.endpoint, args.model, args.timeout) + elif args.command == "publish": + document = publish(args.endpoint, args.model, args.timeout) + elif args.command == "replay": + document = replay( + args.endpoint, + args.model, + json.loads(args.publish_receipt.read_text(encoding="utf-8")), + args.timeout, + ) + elif args.command == "inspect-manifests": + document = inspect_manifests(args.manifest_root, args.rank) + else: + if len(args.manifest_receipt) != 4 or len(args.rank_log) != 4: + parser.error("verify requires exactly four manifest receipts and rank logs") + document = verify_evidence( + args.artifact_receipt, + args.semantic_receipt, + args.publish_receipt, + args.replay_receipt, + args.manifest_receipt, + args.rank_log, + ) + _write(args.output, document) + print(json.dumps(document, indent=2, sort_keys=True)) + return 0 if document.get("status") in {"observed", "verified", "qualified"} else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/performance/harnesses/glm53_page_base_flight/test_qualification.py b/performance/harnesses/glm53_page_base_flight/test_qualification.py new file mode 100644 index 00000000..3a16dcd7 --- /dev/null +++ b/performance/harnesses/glm53_page_base_flight/test_qualification.py @@ -0,0 +1,179 @@ +from __future__ import annotations + +import hashlib +import json +from pathlib import Path + +from qualification import ( + BASE_TOKENS, + FLIGHT_SCHEMA, + PARTICIPANTS, + RECEIPT_SCHEMA, + RESULT_TOKENS, + TAIL_TOKENS, + inspect_manifests, + prompts, + verify_evidence, +) + + +def _write(path: Path, value: object) -> Path: + path.write_text(json.dumps(value), encoding="utf-8") + return path + + +def _canonical(value: object) -> bytes: + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def test_prompt_geometry_is_exact_and_distinct() -> None: + base, results, unrelated = prompts(list(range(100, 118))) + assert len(base) == BASE_TOKENS + 1 + assert len(results) == PARTICIPANTS + assert all(len(result) == RESULT_TOKENS + 1 for result in results) + assert all(result[:BASE_TOKENS] == base[:BASE_TOKENS] for result in results) + assert len({hashlib.sha256(_canonical(result)).hexdigest() for result in results}) == 16 + assert len(unrelated) == 4097 + assert unrelated[:4096] != base[:4096] + assert TAIL_TOKENS == 32768 + + +def test_manifest_inspection_requires_one_shared_base_and_private_deltas( + tmp_path: Path, +) -> None: + base_root = { + "schema": "sparkcache-page-root/v1", + "committed_tokens": BASE_TOKENS, + "chunks": [], + } + base_root_sha = hashlib.sha256(_canonical(base_root)).hexdigest() + for index in range(PARTICIPANTS): + _write( + tmp_path / f"manifest-{index}.json", + { + "schema": "sparkcache-page-delta-manifest/v2", + "base_committed_tokens": BASE_TOKENS, + "committed_tokens": RESULT_TOKENS, + "context_digest": f"{index + 1:064x}", + "base_context_digest": "a" * 64, + "base_root": base_root, + "base_root_sha256": base_root_sha, + "layout_sha256": "b" * 64, + "delta_sha256": f"{index + 101:064x}", + "delta_encoded_bytes": 1234 + index, + }, + ) + receipt = inspect_manifests(tmp_path, rank=2) + assert receipt["status"] == "verified" + assert receipt["rank"] == 2 + assert receipt["result_count"] == 16 + assert receipt["shared_base_root_sha256"] == base_root_sha + assert len(receipt["result_context_digests"]) == 16 + assert len(receipt["delta_sha256"]) == 16 + + +def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( + tmp_path: Path, +) -> None: + labels = { + "org.sparkcache.source-revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", + "org.sparkcache.source-tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "org.sparkcache.source-sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "org.sparkcache.cuda-placement-library-sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", + "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", + "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.cache-namespace-impact": "none", + } + artifact = _write( + tmp_path / "artifact.json", + { + "schema": "sparkcache-diagnostic-image-receipt/v1", + "image": {"id": "sha256:" + "c" * 64, "labels": labels}, + }, + ) + semantic = _write( + tmp_path / "semantic.json", + { + "status": "verified", + "prompt_sha256": "d" * 64, + "response_sha256": "e" * 64, + }, + ) + results = [ + { + "result_index": index, + "http_status": 200, + "prompt_sha256": f"{index + 1:064x}", + "response_sha256": f"{index + 101:064x}", + } + for index in range(PARTICIPANTS) + ] + published = _write(tmp_path / "publish.json", {"results": results}) + replayed = _write( + tmp_path / "replay.json", + { + "status": "verified", + "results": results, + "unrelated_later_request": { + "http_status": 200, + "prompt_sha256": "f" * 64, + "response_sha256": "0" * 64, + }, + }, + ) + manifests = [ + _write( + tmp_path / f"rank-{rank}-manifests.json", + {"status": "verified", "rank": rank, "result_count": 16}, + ) + for rank in range(4) + ] + logs = [] + for rank in range(4): + lines = [ + "spark-context-cache-page-base-flight:" + + json.dumps( + { + "schema": FLIGHT_SCHEMA, + "participants": 16, + "physical_base_reads": 1, + "avoided_base_reads": 15, + "outcome": "verified", + "storage_mode": "block_pages_v1", + } + ) + ] + lines.extend( + "spark-context-cache-restore-timing:" + + json.dumps( + { + "schema": "sparkcache-restore-timing/v1", + "span_tokens": RESULT_TOKENS, + "storage_mode": "block_pages_v1", + "outcome": "verified", + "digest": f"{index + 1:064x}", + "request_id": f"rank-{rank}-request-{index}", + } + ) + for index in range(PARTICIPANTS) + ) + log = tmp_path / f"rank-{rank}.log" + log.write_text("\n".join(lines) + "\n", encoding="utf-8") + logs.append(log) + verdict = verify_evidence( + artifact, + semantic, + published, + replayed, + manifests, + logs, + ) + assert verdict["schema"] == RECEIPT_SCHEMA + assert verdict["status"] == "qualified" + assert verdict["image_id"] == "sha256:" + "c" * 64 + assert [item["verified_result_restores"] for item in verdict["rank_evidence"]] == [ + 16, + 16, + 16, + 16, + ] diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md new file mode 100644 index 00000000..75360f2d --- /dev/null +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md @@ -0,0 +1,23 @@ +# GLM-5.3 DFlash7 SparkCache PR42 image + +Status: **implemented, not qualified**. + +This isolated image contract retains the vLLM, B12X, DFlash, recurrent +publication, lease, and CUDA placement identities from SparkRing pull request +#146 while installing SparkCache commit +`9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970`. Its build receipt records the +`sparkcache-page-base-restore-flight/v1` qualification contract. Live serving +claims require the deterministic harness under +`performance/harnesses/glm53_page_base_flight/`. + +Build on Linux ARM64: + +```bash +IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64' \ +BUILD_RECEIPT="$PWD/glm53-pr42-page-base-flight-image-receipt.json" \ +bash runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh +``` + +The builder contacts no serving host. A verified local image and receipt are +construction evidence only; the runtime remains unqualified until the +four-rank procedure is separately authorized and completed. diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh new file mode 100644 index 00000000..f21fd527 --- /dev/null +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh @@ -0,0 +1,127 @@ +#!/usr/bin/env bash +# Build a GLM-5.3 SparkCache image by replacing only attested Python sources. +set -euo pipefail + +here="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +repo_root="$(git -C "${here}" rev-parse --show-toplevel)" +pins="${here}/pins.json" +shared_overlay="${repo_root}/runtime/glm53-flash-adaptive-mtp-python-overlay" +engine="${CONTAINER_ENGINE:-docker}" +image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64}" +receipt_path="${BUILD_RECEIPT:-${PWD}/glm53-pr42-page-base-flight-image-receipt.json}" + +fatal() { + printf 'FATAL: %s\n' "$*" >&2 + exit 78 +} + +read_pin() { + python3 - "${pins}" "$1" <<'PY' +import json +import sys + +value = json.load(open(sys.argv[1], encoding="utf-8")) +for component in sys.argv[2].split("."): + value = value[int(component)] if isinstance(value, list) else value[component] +print(value) +PY +} + +tracked_inputs=( + runtime/glm53-flash-dflash7-pr42-page-base-flight + runtime/glm53-flash-adaptive-mtp-python-overlay + LICENSE +) +git -C "${repo_root}" diff --quiet HEAD -- "${tracked_inputs[@]}" || + fatal "builder inputs differ from the checked-out SparkRing revision" +untracked="$(git -C "${repo_root}" ls-files --others --exclude-standard -- "${tracked_inputs[@]}")" +[[ -z "${untracked}" ]] || + fatal "builder inputs include untracked files: ${untracked%%$'\n'*}" + +public_base="$(read_pin public_base.reference)" +public_base_id="$(read_pin public_base.image_id)" +arm_builder="$(read_pin builder.arm_builder)" +vllm_native_commit="$(read_pin vllm.native_commit)" +vllm_python_commit="$(read_pin vllm.python_commit)" +vllm_python_tree="$(read_pin vllm.python_tree)" +overlay_manifest_sha256="$(read_pin vllm.overlay_manifest_sha256)" +b12x_commit="$(read_pin b12x.commit)" +b12x_tree="$(read_pin b12x.tree)" +sparkcache_commit="$(read_pin sparkcache.commit)" +sparkcache_tree="$(read_pin sparkcache.tree)" +sparkcache_source_sha256="$(read_pin sparkcache.source_tree_sha256)" +deep_ep_removal_receipt_sha256="$(read_pin runtime_cleanup.deep_ep.receipt_sha256)" +sparkring_revision="$(git -C "${repo_root}" rev-parse HEAD)" + +"${engine}" pull --platform linux/arm64 "${public_base}" +python3 "${here}/verify_image.py" \ + --engine "${engine}" --pins "${pins}" --base-image "${public_base}" >/dev/null + +workspace="$(mktemp -d)" +context="${workspace}/context" +cleanup() { + # `workspace` is created by mktemp in this process and never accepts caller input. + rm -rf -- "${workspace}" +} +trap cleanup EXIT + +python3 "${here}/prepare_context.py" \ + --repo-root "${repo_root}" "${context}" >/dev/null +python3 "${here}/prepare_context.py" --verify "${context}" >/dev/null +source_receipt_sha256="$(sha256sum "${context}/receipt.json" | cut -d' ' -f1)" +mkdir -p "${context}/base-probe" +"${engine}" run --rm --entrypoint python3 \ + --volume "${shared_overlay}:/contract:ro" \ + --volume "${pins}:/dflash-pins.json:ro" \ + --volume "${context}/base-probe:/out" \ + "${public_base}" \ + /contract/overlay_contract.py \ + --pins /dflash-pins.json \ + --manifest /contract/vllm-python-overlay.json \ + record-base \ + --site-root /usr/local/lib/python3.12/dist-packages \ + --console-script /usr/local/bin/vllm \ + --output /out/retained-native.json >/dev/null +native_elf_manifest_sha256="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1], encoding="utf-8"))["native_elf_manifest_sha256"])' "${context}/base-probe/retained-native.json")" +native_dispatch_manifest_sha256="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1], encoding="utf-8"))["native_dispatch_manifest_sha256"])' "${context}/base-probe/retained-native.json")" +cuda_placement_stage="sparkring-sparkcache-cuda-placement:${sparkcache_commit:0:12}-${sparkring_revision:0:12}" +"${engine}" build \ + --platform linux/arm64 \ + --target sparkcache-cuda-placement \ + --file "${context}/bundle/runtime/Containerfile" \ + --build-arg "ARM_BUILDER=${arm_builder}" \ + --tag "${cuda_placement_stage}" \ + "${context}" +sparkcache_cuda_placement_sha256="$("${engine}" run --rm --entrypoint sha256sum \ + "${cuda_placement_stage}" \ + /build/sparkcache-cuda-placement/build-cuda/libspark_cache_placement.so | cut -d' ' -f1)" + +"${engine}" build \ + --platform linux/arm64 \ + --file "${context}/bundle/runtime/Containerfile" \ + --build-arg "PUBLIC_BASE=${public_base}" \ + --build-arg "PUBLIC_BASE_ID=${public_base_id}" \ + --build-arg "ARM_BUILDER=${arm_builder}" \ + --build-arg "VLLM_NATIVE_COMMIT=${vllm_native_commit}" \ + --build-arg "VLLM_PYTHON_COMMIT=${vllm_python_commit}" \ + --build-arg "VLLM_PYTHON_TREE=${vllm_python_tree}" \ + --build-arg "B12X_COMMIT=${b12x_commit}" \ + --build-arg "B12X_TREE=${b12x_tree}" \ + --build-arg "SPARKCACHE_COMMIT=${sparkcache_commit}" \ + --build-arg "SPARKCACHE_TREE=${sparkcache_tree}" \ + --build-arg "SPARKCACHE_SOURCE_SHA256=${sparkcache_source_sha256}" \ + --build-arg "SPARKRING_REVISION=${sparkring_revision}" \ + --build-arg "SOURCE_RECEIPT_SHA256=${source_receipt_sha256}" \ + --build-arg "OVERLAY_MANIFEST_SHA256=${overlay_manifest_sha256}" \ + --build-arg "NATIVE_ELF_MANIFEST_SHA256=${native_elf_manifest_sha256}" \ + --build-arg "NATIVE_DISPATCH_MANIFEST_SHA256=${native_dispatch_manifest_sha256}" \ + --build-arg "SPARKCACHE_CUDA_PLACEMENT_SHA256=${sparkcache_cuda_placement_sha256}" \ + --build-arg "DEEP_EP_REMOVAL_RECEIPT_SHA256=${deep_ep_removal_receipt_sha256}" \ + --tag "${image}" \ + "${context}" + +python3 "${here}/verify_image.py" \ + --engine "${engine}" --pins "${pins}" --image "${image}" \ + --output "${receipt_path}" >/dev/null +printf 'image=%s\nreceipt=%s\n' "${image}" "${receipt_path}" +"${engine}" image inspect --format '{{.Id}}' "${image}" diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json new file mode 100644 index 00000000..e0649c9b --- /dev/null +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json @@ -0,0 +1,269 @@ +{ + "schema": "sparkring-glm53-dflash7-pr42-page-base-flight/v1", + "status": "implemented", + "qualification": "Image construction and GPU-free qualification tooling are implemented. Four-rank model loading, semantic generation, persistent publication, restart, base-flight reuse, result restore, isolation, and response checks have no live qualification.", + "platform": "linux/arm64", + "public_base": { + "reference": "ghcr.io/fujitsupolycom/sparkring-glm53-runtime@sha256:864adfe68f458223e186a19844ac80c7adc7365e5db1f25e109b85fc19850dcd", + "image_id": "sha256:7e8c0ebcb2001efb4cdab0ec9d20d53972e62db3688230044e22e61ffb1d35d5", + "labels": { + "org.jovian.architecture": "linux-arm64-sm121", + "org.jovian.vllm.commit": "da4d7be6c97434f6942292ed8abbf4b32dc44355", + "org.jovian.b12x.commit": "2fcf23a0ce269be27b2e03fece73d46e90e6aeea", + "org.jovian.transport": "sparkring-nccl-2.30.7-source-built", + "org.sparkring.nccl.commit": "73cf112295c33aee2b895f329f592f2a9b4b0f97", + "org.sparkring.nccl.patched-tree": "abdeb053b94c3f6d472cd55ae2b79ca821299009", + "org.sparkring.nccl.patch-sha256": "6709063fa1c25055ae77a9397dea5d89643f8211d25e7990bdd11597d08c0dde" + } + }, + "builder": { + "arm_builder": "pytorch/manylinuxaarch64-builder@sha256:f91599c49f526c77d01b68286f2bf943a5fd6a432d7e3f0afcc5784825908fe9", + "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64" + }, + "vllm": { + "repository": "https://github.com/local-inference-lab/vllm.git", + "native_commit": "da4d7be6c97434f6942292ed8abbf4b32dc44355", + "native_tree": "4a99033352bc1a6b00852dc0e8b1cecbdd9f0ebb", + "python_commit": "0b67266a0f37d6146a8403fb8482403c62f412d5", + "python_tree": "ba9484ccb33aa56e90ff2f447f15ca9b9da97639", + "overlay_manifest": "runtime/glm53-flash-adaptive-mtp-python-overlay/vllm-python-overlay.json", + "overlay_manifest_sha256": "e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a", + "runtime_patches": [ + { + "status": "implemented", + "path": "runtime/glm53-flash-adaptive-mtp-python-overlay/patches/010-dflash-draft-load-config.patch", + "target": "vllm/v1/worker/gpu/spec_decode/dflash/utils.py", + "sha256": "39b567013ee7aed79f63200ed460129587933dc77fb430decdf19f78178de279", + "preimage_sha256": "2301c8199b73ed893dfbd3ae14ad125816f100b2d2ed034215b1f2d9aa2c23c5", + "postimage_sha256": "98acbae2b3bb4482d83f9637c163ce7c92707ccdf6561b7e431f23337f151cf4", + "contract": "DFlash passes SpeculativeConfig.draft_load_config to get_model; None retains the target LoadConfig fallback." + } + ], + "composed_runtime_patches": [ + { + "status": "implemented", + "path": "runtime/glm53-flash-adaptive-mtp-python-overlay/patches/011-recurrent-boundary-contract.patch", + "sha256": "5a6561a5bbab990dcd03bfd6a485ea26c3b5a578c2fd61b76305767b16dbfba0", + "contract": "SchedulerOutput.recurrent_boundary_blocks exposes only hash-proven aligned Mamba pages and partial-tail CoW targets; request cleanup releases their pins.", + "targets": [ + { + "path": "vllm/v1/core/kv_cache_manager.py", + "preimage_sha256": "ee03dc9ce2b720c0be6e9f572d23580ba96eff68fe3406250557e83071654af0", + "postimage_sha256": "c5b83d382c96b2bf8c466a993ed77123a14a971e2661797128533319388d0b5f" + }, + { + "path": "vllm/v1/core/sched/output.py", + "preimage_sha256": "65235eba652e5a3ccee18bf3cbfeac9bf4da8fb9c61e961580f612cfb7e593bc", + "postimage_sha256": "9911b3f9d21815a185285852b5a6176e5484e1ab0ff5c30f7caaa68ea0fab543" + }, + { + "path": "vllm/v1/core/sched/scheduler.py", + "preimage_sha256": "6d397c97f31e67a75efc01b5ddd89fa58db425de14fa43965ef2d6146b6b9bdb", + "postimage_sha256": "260f36ce8fabf70c193b20009ea465eea7b1b6c8e9fb72f2307a01ba8fcf7b2a" + }, + { + "path": "vllm/v1/core/single_type_kv_cache_manager.py", + "preimage_sha256": "e4b1c5c38b63b708fd55aa40a9ab0d008b266d006a63dcfcef55890ac1371cb8", + "postimage_sha256": "f67a1850a7e0288baaa6d42e7ec55b22b09c156720767e23acaabedcae333c8a" + } + ] + }, + { + "status": "implemented", + "path": "runtime/glm53-flash-adaptive-mtp-python-overlay/patches/013-recurrent-publication-boundary.patch", + "sha256": "587fc332917a8ffd5a29712dc5253d51e6051eca1166ed4a165e576a84f2e300", + "contract": "Connector-proposed recurrent publication targets split scheduling without changing native hash geometry; exact secondary hashes survive CoW.", + "targets": [ + { + "path": "vllm/distributed/kv_transfer/kv_connector/v1/base.py", + "preimage_sha256": "bc1965431087676876f58360cd9cc07ab6c06febe6d747695f10b051fd85c412", + "postimage_sha256": "7460e0638c0c81808dbdbbad7114db2e840e531e9ce83360c55b9171fcc872b1" + }, + { + "path": "vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py", + "preimage_sha256": "aafafbf4b0e3a43e7c864270fe56ffaa4b0f3dc343e77a0871db25f075d984dd", + "postimage_sha256": "8741b86b0f3e91af06d01a52240cdc988e3073bf049f72b506f56d6ceebb1ac0" + }, + { + "path": "vllm/v1/core/kv_cache_manager.py", + "preimage_sha256": "c5b83d382c96b2bf8c466a993ed77123a14a971e2661797128533319388d0b5f", + "postimage_sha256": "2c646969b750f6cb4e17fe8a6bf12993d01eefbfbe74e5f8c755f7e0d929faf2" + }, + { + "path": "vllm/v1/core/sched/scheduler.py", + "preimage_sha256": "260f36ce8fabf70c193b20009ea465eea7b1b6c8e9fb72f2307a01ba8fcf7b2a", + "postimage_sha256": "494bfd8758e32d3b265fe4df92e8c93b91292899baf5fafe8b490d27bd15cd0f" + }, + { + "path": "vllm/v1/core/single_type_kv_cache_manager.py", + "preimage_sha256": "f67a1850a7e0288baaa6d42e7ec55b22b09c156720767e23acaabedcae333c8a", + "postimage_sha256": "abbedbd7b9165bbb005c9ba7ceb4367ee1987ac47c632a629dd17ed08ae1db0c" + } + ], + "test_patch": { + "path": "runtime/glm53-flash-adaptive-mtp-python-overlay/patches/012-recurrent-boundary-contract-tests.patch", + "sha256": "c358ba374f35dbe5939e39a7c7433676fbf4aef8e52e3fea0df131c7a6506ea7", + "target": "tests/v1/core/prefix_cache/test_partial_prefix_cache_hits.py", + "preimage_sha256": "2f58e600fd39413b385b9e96b3c642a9ffb051bedcfc247a700fb532b35ec185", + "postimage_sha256": "82ad238c138d33537cb05b990c1e2cdf3350f4002faceb55aa97770245c5f868" + } + } + ], + "native_source_objects": { + "csrc": "9ada29088768f1bc08dadd2eed3c9738eb9ac8a1", + "cmake": "5e5bbdbe1c1b3a479656d8d6a41cc32a1982c43d", + "rust": "85c3cd52db223217d45377d3f7f884e756641de3", + "CMakeLists.txt": "bb0f51b43ef4e1c57918b551b8cf213f9059b601", + "setup.py": "ae64a13daa0f1facc255afcdb4ffcad264776b98", + "pyproject.toml": "0766645fc7481da0ec439208128b838b3348d94c", + "requirements": "d6e1c8e13cd4c4358ab422e3ef006d3f9f23e18b", + "docker/Dockerfile": "6e20f6eab482782ed90a05d91b669b59641eaa46" + }, + "retained_distribution_metadata": [ + "vllm/_version.py", + "vllm-*.dist-info", + "/usr/local/bin/vllm" + ] + }, + "b12x": { + "repository": "https://github.com/local-inference-lab/b12x.git", + "commit": "b1d541f9e71a35f030d45fae437630fff7507c2a", + "tree": "c69cdec1c59a08e8e0e549f930fa8abcfb5134ae", + "package_version": "1.3.0", + "base_commit": "2fcf23a0ce269be27b2e03fece73d46e90e6aeea", + "base_tree": "58a046fc8faa747346f40f87166cda7e0f67ff47", + "required_caps_field": "kda_metadata_validation", + "required_caps_value": "trusted" + }, + "dependencies": { + "python": "3.12", + "torch": "2.13.0+cu130", + "cuda": "13.0.3", + "fastsafetensors": "0.3.3", + "instanttensor": "0.1.9", + "instanttensor_sdist_sha256": "d8692b97991c1a5fb2db7905b9a6ae90a7f967c7ddd853d35e41caa146750c02", + "nccl_library": "/opt/sparkring/nccl/libnccl.so.2.30.7", + "nccl_library_sha256": "5f1c3f10d5ace66d4ba584415bbfe42b6ac1a0a9116a3b81dcbe50516ad924b3" + }, + "sparkcache": { + "repository": "https://github.com/FujitsuPolycom/sparkcache.git", + "commit": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", + "tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "source_tree_sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "cuda_placement_library_sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", + "cuda_config_schema": "canonical-v1", + "canonical_cuda_config_keys": [ + "spark_cache_cuda_restore", + "spark_cache_cuda_placement_library", + "spark_cache_cuda_placement_library_sha256", + "spark_cache_cuda_placement_arena_bytes", + "spark_cache_cuda_restore_io_workers" + ], + "contract": { + "path": "sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json", + "sha256": "8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9", + "files": 12 + }, + "patches": [ + { + "path": "patches/vllm-glm53-b12x-kda-adaptive-mtp/020-sparkcache-vmm-exemption.patch", + "sha256": "370b498eebf44b4e52a2d2751fa249ad4bd3d0b6fd951b063a161fb06febbe99", + "target": "vllm/config/vllm.py", + "preimage_sha256": "cc03756d9bebf2a128828e5fbf7e9766446884dfce016c34381bce0aa78bfd9e", + "postimage_sha256": "9f64f5041f7f9d953e9f6bc53de8733b3eb4035c0753056a1f646346702a0994" + }, + { + "path": "patches/vllm-glm53-b12x-kda-adaptive-mtp/030-sparkcache-hma-load-failure.patch", + "sha256": "0202df4b5db7bd35540eebdef51fcbe2bb01845b952964080e1fe903ee19b404", + "target": "vllm/v1/core/sched/scheduler.py", + "preimage_sha256": "05c05f4b372c7a4bf76399b38b338eab657c69406b7019ab02101d2ab0c7764c", + "postimage_sha256": "337893b6b088d12eb38d8d70c866242d085134442289b4f4574a1f162c9f11c8" + }, + { + "path": "patches/vllm-glm53-b12x-kda-adaptive-mtp/040-sparkcache-shared-prefix-lease.patch", + "sha256": "6c6d6bdc2d6e35742ef37715e88697b1f972d23b28948690c4d8d835edcaf01b", + "target": "vllm/v1/core/kv_cache_manager.py", + "preimage_sha256": "02c71da26bbac81629248ee42b0a71bd2db817d339894d647d2ff6b66fd5ad19", + "postimage_sha256": "ee03dc9ce2b720c0be6e9f572d23580ba96eff68fe3406250557e83071654af0" + }, + { + "path": "patches/vllm-glm53-b12x-kda-adaptive-mtp/041-sparkcache-shared-prefix-attach.patch", + "sha256": "b98e6bc06990f608fc5f0828c11b8eb453fbec0f8fbbf24ba45254810b7e67c3", + "target": "vllm/v1/core/sched/scheduler.py", + "preimage_sha256": "337893b6b088d12eb38d8d70c866242d085134442289b4f4574a1f162c9f11c8", + "postimage_sha256": "6d397c97f31e67a75efc01b5ddd89fa58db425de14fa43965ef2d6146b6b9bdb" + } + ] + }, + "runtime_cleanup": { + "deep_ep": { + "module": "deep_ep", + "distribution": "deep_ep", + "version": "2.0.0+local", + "receipt_sha256": "65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3", + "reason": "The four-rank DFlash7 profile uses B12X kernels and PYNCCL collectives. Removing unused DeepEP prevents its import probe from loading a second NCCL distribution." + } + }, + "page_base_restore_flight": { + "status": "implemented-unqualified", + "summary_schema": "sparkcache-page-base-restore-flight/v1", + "storage_mode": "block_pages_v1", + "base_tokens": 98304, + "result_tokens": 131072, + "private_tail_tokens": 32768, + "participants": 16, + "physical_base_reads": 1, + "avoided_base_reads": 15, + "required_outcome": "verified", + "maximum_simultaneous_flights": 2, + "maximum_declared_bytes_per_flight": 1073741824, + "maximum_peak_reserved_bytes": 2147483648, + "artifact_receipt": { + "schema": "sparkcache-diagnostic-image-receipt/v1", + "sha256": "551072f700db6cf064a85242ed1c8fbd52c8cca870c20534a6d0c1b133ba6bc4", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64", + "image_id": "sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde", + "builder": "spark-aa42", + "feature_status": "implemented-gpu-free-tested", + "parent_image_id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", + "cache_namespace_impact": "none" + } + }, + "runtime_cache_roots": { + "VLLM_CACHE_ROOT": "/cache/jit/vllm/dflash7-pr42-page-base-flight", + "B12X_CUTE_COMPILE_CACHE_DIR": "/cache/jit/b12x/b1d541f9/dflash7-pr42-page-base-flight", + "TRITON_CACHE_DIR": "/cache/jit/triton/dflash7-pr42-page-base-flight" + }, + "outputs": { + "image": null, + "image_id": null, + "image_digest": null, + "native_elf_manifest_sha256": null, + "native_dispatch_manifest_sha256": null, + "b12x_wheel_sha256": null + }, + "workload": { + "role": "external-dflash7", + "target": { + "repository": "local-inference-lab/GLM-5.3-Flash-NVFP4", + "revision": "520de24eabf507659eaef7c70f14fd584527facc", + "cache_identity_sha256": "a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9" + }, + "draft": { + "repository": "incoai/GLM-5.3-Flash-DFlash2", + "revision": "dc77ff1c99eeb2df044ee3d4f0094eb033fee410", + "config_sha256": "c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573", + "weights_sha256": "b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b", + "speculative_tokens": 7, + "tensor_parallel_size": 4 + }, + "target_loaders": { + "safetensors": "implemented", + "fastsafetensors": "implemented" + }, + "kv_cache_dtype": "fp8", + "block_size": 256, + "max_num_seqs": 32 + } +} diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py new file mode 100644 index 00000000..7a520da8 --- /dev/null +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +"""Prepare the isolated DFlash7 SparkCache PR42 image context.""" + +from __future__ import annotations + +import importlib.util +import json +from pathlib import Path + + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +BASE = ROOT / "runtime" / "glm53-flash-dflash7-python-overlay" +PINS = HERE / "pins.json" +DEPLOYMENT = "glm53-flash-dflash7-python-overlay" + + +def _module(): + path = BASE / "prepare_context.py" + spec = importlib.util.spec_from_file_location("glm53_dflash7_base_prepare", path) + if spec is None or spec.loader is None: + raise RuntimeError(f"cannot load DFlash7 context preparer: {path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +base = _module() +base.HERE = HERE +base.ROOT = ROOT +base.PINS = PINS +_base_render_containerfile = base._render_containerfile +_base_render_verify_image = base._render_verify_image + + +def _feature() -> dict[str, object]: + return json.loads(PINS.read_text(encoding="utf-8"))["page_base_restore_flight"] + + +def _render_containerfile() -> str: + text = _base_render_containerfile() + replacements = { + "/cache/jit/vllm/dflash7-py-0b67266-native-da4d7be": ( + "/cache/jit/vllm/dflash7-pr42-page-base-flight" + ), + "/cache/jit/b12x/b1d541f9/dflash7-cute": ( + "/cache/jit/b12x/b1d541f9/dflash7-pr42-page-base-flight" + ), + "/cache/jit/triton/dflash7-vllm-py-0b67266-native-da4d7be": ( + "/cache/jit/triton/dflash7-pr42-page-base-flight" + ), + } + for old, new in replacements.items(): + if old not in text: + raise RuntimeError(f"base DFlash7 Containerfile omits required text: {old}") + text = text.replace(old, new) + marker = f' org.sparkcache.deployment-profile="{DEPLOYMENT}" \\\n' + if text.count(marker) != 1: + raise RuntimeError("PR42 Containerfile omits the deployment label") + labels = ( + marker + + ' org.sparkcache.feature.page-base-read-flight="implemented-gpu-free-tested" \\\n' + + ' org.sparkcache.feature.page-base-read-flight-pr="42" \\\n' + + ' org.sparkcache.parent-image-id="sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8" \\\n' + + ' org.sparkcache.cache-namespace-impact="none" \\\n' + ) + return text.replace(marker, labels) + + +def _render_verify_image() -> str: + text = _base_render_verify_image() + text = text.replace( + "sparkring-glm53-dflash7-python-overlay-image/v1", + "sparkring-glm53-dflash7-pr42-page-base-flight-image/v1", + ) + text = text.replace("glm53-flash-dflash7-python-overlay", DEPLOYMENT) + marker = f' "org.sparkcache.deployment-profile": "{DEPLOYMENT}",\n' + if text.count(marker) != 1: + raise RuntimeError("PR42 verifier omits the deployment label") + expected = ( + marker + + ' "org.sparkcache.feature.page-base-read-flight": ' + + '"implemented-gpu-free-tested",\n' + + ' "org.sparkcache.feature.page-base-read-flight-pr": "42",\n' + + ' "org.sparkcache.parent-image-id": ' + + '"sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8",\n' + + ' "org.sparkcache.cache-namespace-impact": "none",\n' + ) + text = text.replace(marker, expected) + receipt_marker = ' "artifacts": artifacts,\n' + if text.count(receipt_marker) != 1: + raise RuntimeError("PR42 verifier omits the receipt artifact marker") + return text.replace( + receipt_marker, + receipt_marker + + ' "page_base_restore_flight_contract": ' + + 'pins["page_base_restore_flight"],\n', + ) + + +base._render_containerfile = _render_containerfile +base._render_verify_image = _render_verify_image + + +def main() -> int: + return base.main() + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/remove_distribution.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/remove_distribution.py new file mode 100644 index 00000000..55513580 --- /dev/null +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/remove_distribution.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +"""Remove one exact Python distribution after proving module ownership.""" + +from __future__ import annotations + +import argparse +import importlib +import importlib.metadata +import importlib.util +import json +import subprocess +import sys +from pathlib import Path +from typing import Any + + +SCHEMA = "sparkring-python-distribution-removal/v1" + + +class RemovalError(RuntimeError): + """The installed module ownership or removal result differs from the receipt.""" + + +def load_receipt(path: Path) -> dict[str, str]: + document = json.loads(path.read_text(encoding="utf-8")) + if not isinstance(document, dict) or document.get("schema") != SCHEMA: + raise RemovalError(f"removal receipt must use schema {SCHEMA}") + expected = { + "schema", + "status", + "module", + "distribution", + "version", + "postcondition", + "reason", + } + if set(document) != expected: + raise RemovalError("removal receipt fields differ from the contract") + if document.get("status") != "implemented": + raise RemovalError("removal receipt status must be implemented") + if document.get("postcondition") != "module-absent": + raise RemovalError("removal receipt postcondition must be module-absent") + for name in ("module", "distribution", "version", "reason"): + if not isinstance(document.get(name), str) or not document[name]: + raise RemovalError(f"removal receipt {name} must be a non-empty string") + return document + + +def verify_unique_owner(receipt: dict[str, str]) -> None: + module = receipt["module"] + distribution = receipt["distribution"] + owners = importlib.metadata.packages_distributions().get(module) or [] + if owners != [distribution]: + raise RemovalError( + f"module {module} must have exactly one owner {distribution}; got {owners}" + ) + installed = importlib.metadata.distribution(distribution) + observed_name = installed.metadata.get("Name") + if observed_name != distribution or installed.version != receipt["version"]: + raise RemovalError( + f"distribution identity differs: expected {distribution}=={receipt['version']}, " + f"got {observed_name}=={installed.version}" + ) + if importlib.util.find_spec(module) is None: + raise RemovalError(f"owned module is not importable before removal: {module}") + + +def verify_absent(receipt: dict[str, str]) -> None: + importlib.invalidate_caches() + module = receipt["module"] + distribution = receipt["distribution"] + if importlib.util.find_spec(module) is not None: + raise RemovalError(f"module remains importable after removal: {module}") + owners = importlib.metadata.packages_distributions().get(module) or [] + if owners: + raise RemovalError(f"module ownership remains after removal: {owners}") + try: + importlib.metadata.distribution(distribution) + except importlib.metadata.PackageNotFoundError: + return + raise RemovalError(f"distribution metadata remains after removal: {distribution}") + + +def remove_distribution(receipt: dict[str, str]) -> dict[str, Any]: + verify_unique_owner(receipt) + subprocess.run( + [ + sys.executable, + "-m", + "pip", + "uninstall", + "--yes", + receipt["distribution"], + ], + check=True, + ) + verify_absent(receipt) + return { + "schema": SCHEMA, + "module": receipt["module"], + "distribution": receipt["distribution"], + "version": receipt["version"], + "postcondition": "module-absent", + } + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--receipt", type=Path, required=True) + args = parser.parse_args() + try: + result = remove_distribution(load_receipt(args.receipt)) + except ( + OSError, + json.JSONDecodeError, + RemovalError, + subprocess.CalledProcessError, + ) as exc: + parser.error(str(exc)) + print(json.dumps(result, sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py new file mode 100644 index 00000000..9e144022 --- /dev/null +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +import importlib.util +import json +from pathlib import Path + + +HERE = Path(__file__).resolve().parent +PINS = HERE / "pins.json" + + +def _module(name: str, path: Path): + spec = importlib.util.spec_from_file_location(name, path) + assert spec is not None and spec.loader is not None + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +prepare = _module("glm53_pr42_prepare", HERE / "prepare_context.py") +verify = _module("glm53_pr42_verify", HERE / "verify_image.py") + + +def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: + pins = json.loads(PINS.read_text(encoding="utf-8")) + assert pins["sparkcache"] == { + **pins["sparkcache"], + "commit": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", + "tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "source_tree_sha256": ( + "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c" + ), + "cuda_placement_library_sha256": ( + "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c" + ), + } + assert pins["vllm"]["native_commit"] == ( + "da4d7be6c97434f6942292ed8abbf4b32dc44355" + ) + assert pins["vllm"]["python_commit"] == ( + "0b67266a0f37d6146a8403fb8482403c62f412d5" + ) + assert pins["b12x"]["commit"] == ( + "b1d541f9e71a35f030d45fae437630fff7507c2a" + ) + assert pins["sparkcache"]["contract"]["sha256"] == ( + "8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9" + ) + assert pins["page_base_restore_flight"] == { + "status": "implemented-unqualified", + "summary_schema": "sparkcache-page-base-restore-flight/v1", + "storage_mode": "block_pages_v1", + "base_tokens": 98304, + "result_tokens": 131072, + "private_tail_tokens": 32768, + "participants": 16, + "physical_base_reads": 1, + "avoided_base_reads": 15, + "required_outcome": "verified", + "maximum_simultaneous_flights": 2, + "maximum_declared_bytes_per_flight": 1073741824, + "maximum_peak_reserved_bytes": 2147483648, + "artifact_receipt": { + "schema": "sparkcache-diagnostic-image-receipt/v1", + "sha256": "551072f700db6cf064a85242ed1c8fbd52c8cca870c20534a6d0c1b133ba6bc4", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64", + "image_id": "sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde", + "builder": "spark-aa42", + "feature_status": "implemented-gpu-free-tested", + "parent_image_id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", + "cache_namespace_impact": "none", + }, + } + + +def test_rendered_context_and_verifier_bind_feature_receipt_fields() -> None: + containerfile = prepare._render_containerfile() + assert 'org.sparkcache.feature.page-base-read-flight="implemented-gpu-free-tested"' in containerfile + assert "org.sparkcache.feature.page-base-read-flight" in containerfile + assert "implemented-gpu-free-tested" in containerfile + assert "/cache/jit/vllm/dflash7-pr42-page-base-flight" in containerfile + verifier = prepare._render_verify_image() + assert "sparkring-glm53-dflash7-pr42-page-base-flight-image/v1" in verifier + assert 'pins["page_base_restore_flight"]' in verifier + labels = verify.expected_output_labels(json.loads(PINS.read_text())) + assert labels["org.sparkcache.feature.page-base-read-flight"] == ( + "implemented-gpu-free-tested" + ) + assert labels["org.sparkcache.feature.page-base-read-flight-pr"] == "42" + + +def test_build_script_uses_isolated_default_outputs() -> None: + script = (HERE / "build-image.sh").read_text(encoding="utf-8") + assert "dflash7-pr42-page-base-flight-arm64" in script + assert "glm53-pr42-page-base-flight-image-receipt.json" in script + assert "runtime/glm53-flash-dflash7-pr42-page-base-flight" in script diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py new file mode 100644 index 00000000..c27f6e04 --- /dev/null +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Verify the isolated DFlash7 SparkCache PR42 image and receipt.""" + +from __future__ import annotations + +import importlib.util +from pathlib import Path +from typing import Any + + +HERE = Path(__file__).resolve().parent +COMMON = HERE.parent / "glm53-flash-adaptive-mtp-python-overlay" +PINS = HERE / "pins.json" +DEPLOYMENT = "glm53-flash-dflash7-python-overlay" + + +def _module(): + path = COMMON / "verify_image.py" + spec = importlib.util.spec_from_file_location("glm53_pr42_shared_verify", path) + if spec is None or spec.loader is None: + raise RuntimeError(f"cannot load shared image verifier: {path}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +shared = _module() +shared.PINS = PINS +shared.RECEIPT_SCHEMA = "sparkring-glm53-dflash7-pr42-page-base-flight-image/v1" +_shared_expected_output_labels = shared.expected_output_labels +_shared_verify_image = shared.verify_image + + +def expected_output_labels(pins: dict[str, Any]) -> dict[str, str]: + labels = _shared_expected_output_labels(pins) + labels.update( + { + "org.sparkcache.deployment-profile": DEPLOYMENT, + "org.sparkcache.cuda-config-schema": "canonical-v1", + "org.sparkcache.feature.page-base-read-flight": ( + "implemented-gpu-free-tested" + ), + "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.parent-image-id": ( + "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8" + ), + "org.sparkcache.cache-namespace-impact": "none", + } + ) + return labels + + +def verify_image(engine: str, image: str, pins_path: Path = PINS) -> dict[str, Any]: + pins = shared.load_pins(pins_path) + result = _shared_verify_image(engine, image, pins_path) + expected_cuda = pins["sparkcache"]["cuda_placement_library_sha256"] + observed_cuda = result["artifacts"]["sparkcache_cuda_placement_sha256"] + if observed_cuda != expected_cuda: + raise shared.VerifyError( + "SparkCache CUDA placement library differs from the PR42 pin" + ) + result["page_base_restore_flight_contract"] = pins[ + "page_base_restore_flight" + ] + return result + + +shared.expected_output_labels = expected_output_labels +shared.verify_image = verify_image + + +def main() -> int: + return shared.main() + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json new file mode 100644 index 00000000..eabb2836 --- /dev/null +++ b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json @@ -0,0 +1,209 @@ +{ + "schema": "sparkring-runtime-profile/v1", + "profile_id": "glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1", + "model_family": "glm53-flash", + "engine": "docker", + "container_name": "glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4", + "image": "REPLACE_WITH_DFLASH7_PR42_PAGE_BASE_FLIGHT_IMAGE", + "image_id": "sha256:0000000000000000000000000000000000000000000000000000000000000000", + "model_host_path": "/REPLACE/TARGET_MODEL_HOST_PATH", + "model_container_path": "/models/target", + "shm_size": "32g", + "startup_timeout_seconds": 7200, + "environment": { + "B12X_CUTE_COMPILE_CACHE_DIR": "/cache/jit/b12x/b1d541f9/dflash7-pr42-page-base-flight", + "CMAKE_CUDA_ARCHITECTURES": "121", + "CUTE_DSL_ARCH": "sm_121a", + "FLASHINFER_CUDA_ARCH_LIST": "12.1f", + "HF_HUB_OFFLINE": "1", + "LD_PRELOAD": "/opt/sparkring/nccl/libnccl.so.2", + "NCCL_ALGO": "Ring", + "NCCL_CROSS_NIC": "1", + "NCCL_CUMEM_ENABLE": "0", + "NCCL_DEBUG": "WARN", + "NCCL_IB_DISABLE": "0", + "NCCL_IB_MERGE_NICS": "0", + "NCCL_IB_SUBNET_AWARE_ROUTING": "1", + "NCCL_IGNORE_CPU_AFFINITY": "1", + "NCCL_MAX_NCHANNELS": "4", + "NCCL_MIN_NCHANNELS": "4", + "NCCL_NET": "IB", + "NCCL_NET_PLUGIN": "none", + "NCCL_P2P_LEVEL": "SYS", + "NCCL_PROTO": "LL,LL128,Simple", + "NCCL_SWITCHLESS_RING_ONLY": "1", + "PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True", + "TORCHINDUCTOR_CACHE_DIR": "/cache/jit/torchinductor/dflash7-pr42-page-base-flight", + "TORCHINDUCTOR_COMPILE_THREADS": "1", + "TORCH_CUDA_ARCH_LIST": "12.1a", + "TRANSFORMERS_OFFLINE": "1", + "TRITON_CACHE_DIR": "/cache/jit/triton/dflash7-pr42-page-base-flight", + "VLLM_ALLREDUCE_USE_FLASHINFER": "0", + "VLLM_ALLREDUCE_USE_SYMM_MEM": "0", + "VLLM_B12X_MOE_FP4_FORCE_A16": "0", + "VLLM_CACHE_ROOT": "/cache/jit/vllm/dflash7-pr42-page-base-flight", + "VLLM_ENABLE_PCIE_ALLREDUCE": "0", + "VLLM_FASTSAFETENSORS_QUEUE_SIZE": "1", + "VLLM_NCCL_SO_PATH": "/opt/sparkring/nccl/libnccl.so.2", + "VLLM_NO_USAGE_STATS": "1", + "VLLM_PLUGINS": "", + "XDG_CACHE_HOME": "/cache/jit" + }, + "extra_vllm_args": [ + "--served-model-name", + "glm-5.3-flash-nvfp4-dflash7-pr42-page-base-flight-0b67266-on-da4d7be-b12x-b1d541f-tp4", + "--host", + "0.0.0.0", + "--pipeline-parallel-size", + "1", + "--disable-custom-all-reduce", + "--mamba-cache-mode", + "align", + "--language-model-only", + "--enable-chunked-prefill", + "--dtype", + "bfloat16", + "--kv-cache-dtype", + "fp8", + "--quantization", + "modelopt_mixed", + "--attention-backend", + "B12X", + "--block-size", + "256", + "--moe-backend", + "b12x", + "--linear-backend", + "b12x", + "--no-enable-flashinfer-autotune", + "--load-format", + "fastsafetensors", + "--enable-auto-tool-choice", + "--tool-call-parser", + "glm47", + "--reasoning-parser", + "glm45", + "--kda-prefill-backend", + "triton", + "--gpu-memory-utilization", + "0.80", + "--max-num-batched-tokens", + "8192", + "--speculative-config", + "{\"method\":\"dflash\",\"model\":\"/dflash-draft\",\"num_speculative_tokens\":7,\"draft_tensor_parallel_size\":4,\"kv_cache_dtype\":\"auto\",\"draft_sample_method\":\"probabilistic\",\"rejection_sample_method\":\"standard\",\"draft_load_config\":{\"load_format\":\"safetensors\"}}", + "--compilation-config", + "{\"cudagraph_mode\":\"FULL_AND_PIECEWISE\",\"cudagraph_capture_sizes\":[8,16,32,64,128,256],\"custom_ops\":[\"all\"],\"pass_config\":{\"fuse_allreduce_rms\":false}}", + "--max-cudagraph-capture-size", + "256", + "--async-scheduling", + "--enable-prefix-caching", + "--cudagraph-metrics", + "--kv-transfer-config", + "{\"kv_connector\":\"SparkContextCacheConnector\",\"kv_connector_module_path\":\"sparkcache.spark_context_cache_connector\",\"kv_role\":\"kv_both\",\"kv_load_failure_policy\":\"recompute\",\"kv_connector_extra_config\":{\"spark_cache_root\":\"/cache/jit/sparkcache-context/dflash7-pr42-page-base-flight\",\"spark_cache_model_profile\":\"glm53-flash-hybrid\",\"spark_cache_publication_schema\":\"tail-cow-v1\",\"spark_cache_target_checkpoint_sha256\":\"a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9\",\"spark_cache_draft_checkpoint_sha256\":\"b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b\",\"spark_cache_draft_policy\":\"separate\",\"spark_cache_store\":true,\"spark_cache_restore\":true,\"spark_cache_scheduler_probe\":\"none\",\"spark_cache_streaming_snapshots\":false,\"spark_cache_cuda_restore\":true,\"spark_cache_max_bytes\":51539607552,\"spark_cache_low_watermark_bytes\":42949672960,\"spark_cache_ttl_seconds\":0,\"spark_cache_min_span_tokens\":4096,\"spark_cache_max_span_tokens\":524288,\"spark_cache_cuda_placement_library\":\"/opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so\",\"spark_cache_cuda_placement_library_sha256\":\"REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256\",\"spark_cache_cuda_placement_arena_bytes\":268435456,\"spark_cache_cuda_restore_io_workers\":8,\"spark_cache_load_threads\":2,\"spark_cache_clear_once\":\"sparkring-dflash7-pr42-page-base-flight-9c2f6c8-initialization\"}}" + ], + "extra_volumes": [ + { + "host": "/REPLACE/DFLASH_MODEL_HOST_PATH", + "container": "/dflash-draft", + "mode": "ro" + }, + { + "host": "/REPLACE/GLM53_DFLASH7_PR42_PAGE_BASE_FLIGHT_CACHE_HOST_ROOT", + "container": "/cache/jit", + "mode": "rw" + } + ], + "extra_labels": { + "org.sparkring.model-profile": "glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-tp4-dcp1", + "org.sparkring.external-cache": "sparkcache", + "org.sparkcache.publication-schema": "tail-cow-v1", + "org.sparkring.speculator": "external-dflash7", + "org.sparkring.qualification-status": "implemented-unqualified" + }, + "init": true, + "security_opts": [ + "label=disable" + ], + "privileged": false, + "confirmation": "START_GLM53_FLASH_DFLASH7_PR42_PAGE_BASE_FLIGHT_FASTSAFETENSORS_TP4", + "identity": { + "target_repository": "local-inference-lab/GLM-5.3-Flash-NVFP4", + "target_revision": "520de24eabf507659eaef7c70f14fd584527facc", + "target_cache_identity_sha256": "a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9", + "target_config_sha256": "676382abd1e90a6c85f0c8f33d45441ecd45fd514fd7b63ce5610e732d8e4996", + "target_weight_index_sha256": "0d1d9e6b226e76520e182de10d4e7194cc885c5cb1bf885bb90de1916ce312cb", + "speculator": "external_dflash", + "draft_repository": "incoai/GLM-5.3-Flash-DFlash2", + "draft_revision": "dc77ff1c99eeb2df044ee3d4f0094eb033fee410", + "draft_config_sha256": "c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573", + "draft_weights_sha256": "b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b", + "draft_speculative_tokens": "7", + "draft_tensor_parallel_size": "4", + "target_weight_loader": "fastsafetensors", + "target_weight_loader_queue_size": "1", + "target_weight_loader_tp_nogds": "true", + "dflash_loader_scope": "target_fastsafetensors_draft_safetensors", + "dflash_peak_gpu_memory_status": "implemented", + "dflash_serving_status": "implemented", + "kv_cache_dtype": "fp8", + "vllm_block_size": "256", + "max_num_seqs": "32", + "sparkcache_publication_schema": "tail-cow-v1", + "sparkcache_effective_publication_schema": "page-tail-cow-v1", + "sparkcache_source_sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "sparkcache_source_revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", + "sparkcache_source_tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "vllm_native_revision": "da4d7be6c97434f6942292ed8abbf4b32dc44355", + "vllm_python_revision": "0b67266a0f37d6146a8403fb8482403c62f412d5", + "vllm_python_tree": "ba9484ccb33aa56e90ff2f447f15ca9b9da97639", + "b12x_revision": "b1d541f9e71a35f030d45fae437630fff7507c2a", + "b12x_tree": "c69cdec1c59a08e8e0e549f930fa8abcfb5134ae", + "vllm_python_overlay_manifest_sha256": "e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a", + "deep_ep_removed_distribution": "deep_ep==2.0.0+local", + "deep_ep_module_status": "absent", + "allowed_runtime_warnings": "modelopt_experimental_quantization,fp8_kv_cache_accuracy", + "page_base_restore_flight_schema": "sparkcache-page-base-restore-flight/v1", + "page_base_restore_flight_status": "implemented-unqualified" + }, + "required_image_labels": { + "org.jovian.architecture": "linux-arm64-sm121", + "org.jovian.b12x.commit": "b1d541f9e71a35f030d45fae437630fff7507c2a", + "org.jovian.transport": "sparkring-nccl-2.30.7-source-built", + "org.jovian.vllm.commit": "da4d7be6c97434f6942292ed8abbf4b32dc44355", + "org.sparkring.vllm.native.commit": "da4d7be6c97434f6942292ed8abbf4b32dc44355", + "org.sparkring.vllm.python.commit": "0b67266a0f37d6146a8403fb8482403c62f412d5", + "org.sparkring.vllm.python.tree": "ba9484ccb33aa56e90ff2f447f15ca9b9da97639", + "org.sparkring.vllm.python-overlay-manifest-sha256": "e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a", + "org.sparkring.vllm.dflash-draft-loader-patch-sha256": "39b567013ee7aed79f63200ed460129587933dc77fb430decdf19f78178de279", + "org.sparkring.vllm.dflash-draft-loader-postimage-sha256": "98acbae2b3bb4482d83f9637c163ce7c92707ccdf6561b7e431f23337f151cf4", + "org.sparkring.vllm.recurrent-boundary-patch-sha256": "5a6561a5bbab990dcd03bfd6a485ea26c3b5a578c2fd61b76305767b16dbfba0", + "org.sparkring.vllm.recurrent-publication-patch-sha256": "587fc332917a8ffd5a29712dc5253d51e6051eca1166ed4a165e576a84f2e300", + "org.sparkring.vllm.native-elf-manifest-sha256": "REPLACE_WITH_VLLM_NATIVE_ELF_MANIFEST_SHA256", + "org.sparkring.vllm.native-dispatch-manifest-sha256": "REPLACE_WITH_VLLM_NATIVE_DISPATCH_MANIFEST_SHA256", + "org.sparkring.b12x.tree": "c69cdec1c59a08e8e0e549f930fa8abcfb5134ae", + "org.opencontainers.image.base.name": "ghcr.io/fujitsupolycom/sparkring-glm53-runtime@sha256:864adfe68f458223e186a19844ac80c7adc7365e5db1f25e109b85fc19850dcd", + "org.sparkring.base.image-id": "sha256:7e8c0ebcb2001efb4cdab0ec9d20d53972e62db3688230044e22e61ffb1d35d5", + "org.sparkcache.deployment-profile": "glm53-flash-dflash7-python-overlay", + "org.sparkcache.cuda-config-schema": "canonical-v1", + "org.sparkcache.cuda-placement-library-sha256": "REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256", + "org.sparkcache.source-revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", + "org.sparkcache.source-tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "org.sparkcache.source-sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "org.sparkcache.vllm-contract-sha256": "8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9", + "org.sparkring.runtime.removed-deep-ep-distribution": "deep_ep==2.0.0+local", + "org.sparkring.runtime.deep-ep-removal-receipt-sha256": "65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3", + "org.sparkring.source-receipt-sha256": "REPLACE_WITH_SOURCE_RECEIPT_SHA256", + "org.sparkring.nccl.commit": "73cf112295c33aee2b895f329f592f2a9b4b0f97", + "org.sparkring.nccl.patch-sha256": "6709063fa1c25055ae77a9397dea5d89643f8211d25e7990bdd11597d08c0dde", + "org.sparkring.nccl.patched-tree": "abdeb053b94c3f6d472cd55ae2b79ca821299009", + "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", + "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.parent-image-id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", + "org.sparkcache.cache-namespace-impact": "none" + }, + "attestation_hook": [ + "/bin/sh", + "-ec", + "test -f /models/target/config.json && test -f /models/target/model.safetensors.index.json && test \"$(sha256sum /models/target/config.json | cut -d ' ' -f1)\" = 676382abd1e90a6c85f0c8f33d45441ecd45fd514fd7b63ce5610e732d8e4996 && test \"$(sha256sum /models/target/model.safetensors.index.json | cut -d ' ' -f1)\" = 0d1d9e6b226e76520e182de10d4e7194cc885c5cb1bf885bb90de1916ce312cb && test -f /dflash-draft/config.json && test -f /dflash-draft/model.safetensors && test \"$(sha256sum /dflash-draft/config.json | cut -d ' ' -f1)\" = c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573 && test \"$(sha256sum /dflash-draft/model.safetensors | cut -d ' ' -f1)\" = b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b && test \"$(sha256sum /opt/sparkring/nccl/libnccl.so.2 | cut -d ' ' -f1)\" = 5f1c3f10d5ace66d4ba584415bbfe42b6ac1a0a9116a3b81dcbe50516ad924b3 && grep -q '\"tail-cow-v1\"' /opt/sparkcache-src/sparkcache/spark_context_cache_config.py && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/vllm-python-overlay.json | cut -d ' ' -f1)\" = e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/source-receipt.json | cut -d ' ' -f1)\" = REPLACE_WITH_SOURCE_RECEIPT_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_elf_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_ELF_MANIFEST_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_dispatch_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_DISPATCH_MANIFEST_SHA256 && test \"$(cat /opt/sparkring/runtime/python-overlay/sparkcache-source-tree.sha256)\" = 834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c && test \"$(sha256sum /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json | cut -d ' ' -f1)\" = 8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9 && test \"$(sha256sum /opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so | cut -d ' ' -f1)\" = REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256 && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/deep-ep-removal-receipt.json | cut -d ' ' -f1)\" = 65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3 && python3 -c 'import importlib.util; assert importlib.util.find_spec(\"deep_ep\") is None' && python3 /opt/sparkcache-src/sparkcache/runtime_patches/verify_lease_contract.py --vllm-root /usr/local/lib/python3.12/dist-packages --contract /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json" + ] +} diff --git a/scripts/prepare_glm53_pr42_page_base_flight_profile.py b/scripts/prepare_glm53_pr42_page_base_flight_profile.py new file mode 100644 index 00000000..6a70f1cf --- /dev/null +++ b/scripts/prepare_glm53_pr42_page_base_flight_profile.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +"""Resolve the isolated GLM-5.3 DFlash7 SparkCache PR42 profile.""" + +from __future__ import annotations + +import copy +import importlib.util +from pathlib import Path + + +HERE = Path(__file__).resolve().parent +BASE_PATH = HERE / "prepare_glm53_dflash7_python_overlay_profile.py" +DEPLOYMENT = "glm53-flash-dflash7-python-overlay" +BASE_DEPLOYMENT = "glm53-flash-dflash7-python-overlay" + + +def _module(): + spec = importlib.util.spec_from_file_location("glm53_dflash7_base_profile", BASE_PATH) + if spec is None or spec.loader is None: + raise RuntimeError(f"cannot load DFlash7 profile resolver: {BASE_PATH}") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +base = _module() +base.IMAGE_PLACEHOLDER = "REPLACE_WITH_DFLASH7_PR42_PAGE_BASE_FLIGHT_IMAGE" +base.SPARKCACHE_COMMIT = "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970" +base.SPARKCACHE_TREE = "e7ac2ef7a3180c5a83771edac44216c3325894e5" +base.SPARKCACHE_SOURCE_SHA256 = ( + "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c" +) +_base_resolve = base.resolve + + +def resolve(*args, **kwargs): + profile = copy.deepcopy(args[0] if args else kwargs["profile"]) + profile["required_image_labels"]["org.sparkcache.deployment-profile"] = ( + BASE_DEPLOYMENT + ) + if args: + args = (profile, *args[1:]) + else: + kwargs["profile"] = profile + resolved_profile, resolved_site = _base_resolve(*args, **kwargs) + resolved_profile["required_image_labels"][ + "org.sparkcache.deployment-profile" + ] = DEPLOYMENT + return resolved_profile, resolved_site + + +base.resolve = resolve + + +def main() -> int: + return base.main() + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py new file mode 100644 index 00000000..dfe0af39 --- /dev/null +++ b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +import json +from pathlib import Path + +import yaml + +from prepare_glm53_pr42_page_base_flight_profile import resolve + + +ROOT = Path(__file__).resolve().parents[1] +PROFILE = ( + ROOT + / "scripts/config/glm53-flash-dflash7-pr42-page-base-flight-" + "fastsafetensors-sparkcache-tp4-dcp1.example.json" +) +SITE = ROOT / "scripts/config/glm53-flash-tp4-site.example.yaml" +DIGESTS = { + "cuda_placement_library_sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", + "native_elf_manifest_sha256": "2b" * 32, + "native_dispatch_manifest_sha256": "3c" * 32, + "source_receipt_sha256": "4d" * 32, +} + + +def _argument(profile: dict, option: str) -> str: + args = profile["extra_vllm_args"] + return args[args.index(option) + 1] + + +def test_pr42_profile_is_operationally_isolated_without_identity_geometry_change() -> None: + profile = json.loads(PROFILE.read_text(encoding="utf-8")) + assert profile["profile_id"].startswith("glm53-flash-dflash7-pr42-page-base-flight") + assert "pr42-page-base-flight" in profile["container_name"] + assert "pr42-page-base-flight" in _argument(profile, "--served-model-name") + transfer = json.loads(_argument(profile, "--kv-transfer-config")) + extra = transfer["kv_connector_extra_config"] + assert extra["spark_cache_root"].endswith("dflash7-pr42-page-base-flight") + assert extra["spark_cache_clear_once"] == ( + "sparkring-dflash7-pr42-page-base-flight-9c2f6c8-initialization" + ) + assert extra["spark_cache_publication_schema"] == "tail-cow-v1" + assert extra["spark_cache_model_profile"] == "glm53-flash-hybrid" + assert profile["identity"]["target_cache_identity_sha256"] == ( + "a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9" + ) + assert profile["identity"]["draft_weights_sha256"] == ( + "b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b" + ) + + +def test_pr42_profile_resolves_exact_source_and_feature_labels() -> None: + profile = json.loads(PROFILE.read_text(encoding="utf-8")) + site = yaml.safe_load(SITE.read_text(encoding="utf-8")) + profile["model_host_path"] = "/srv/models/glm53" + profile["extra_volumes"][0]["host"] = "/srv/models/dflash" + profile["extra_volumes"][1]["host"] = "/srv/cache/pr42-page-base-flight" + resolved, resolved_site = resolve( + profile, + site, + image="local/pr42-page-base-flight@sha256:" + "a" * 64, + image_id="sha256:" + "b" * 64, + **DIGESTS, + ) + assert resolved_site["runtime"]["container_image"] == resolved["image"] + assert resolved["identity"]["sparkcache_source_revision"] == ( + "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970" + ) + labels = resolved["required_image_labels"] + assert labels["org.sparkcache.deployment-profile"] == ( + "glm53-flash-dflash7-python-overlay" + ) + assert labels["org.sparkcache.feature.page-base-read-flight"] == ( + "implemented-gpu-free-tested" + ) + assert labels["org.sparkcache.feature.page-base-read-flight-pr"] == "42" + assert labels["org.sparkcache.cuda-placement-library-sha256"] == ( + DIGESTS["cuda_placement_library_sha256"] + ) + assert "REPLACE_WITH" not in json.dumps(resolved) From 2b8a908b3009bc4b254cf5cdf4925b42508a5fe8 Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 08:45:01 -0500 Subject: [PATCH 2/9] Bind corrected PR42 image receipt --- .../glm53_page_base_flight/qualification.py | 6 ++++++ .../glm53_page_base_flight/test_qualification.py | 13 +++++++++++-- .../README.md | 2 +- .../build-image.sh | 2 +- .../pins.json | 12 ++++++------ .../prepare_context.py | 3 +++ .../test_pr42_page_base_flight_contract.py | 15 +++++++++------ .../verify_image.py | 4 ++++ ...stsafetensors-sparkcache-tp4-dcp1.example.json | 1 + ...prepare_glm53_pr42_page_base_flight_profile.py | 3 +++ 10 files changed, 45 insertions(+), 16 deletions(-) diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py index 26ca4296..5b9f2cc2 100644 --- a/performance/harnesses/glm53_page_base_flight/qualification.py +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -315,6 +315,8 @@ def verify_evidence( image_id = image.get("id") if not isinstance(labels, dict) or not isinstance(image_id, str): raise QualificationError("artifact receipt omits labels or image ID") + if image_id != "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f": + raise QualificationError("artifact receipt is not the corrected exact image") expected_labels = { "org.sparkcache.source-revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", "org.sparkcache.source-tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", @@ -325,6 +327,10 @@ def verify_evidence( ), "org.sparkcache.feature.page-base-read-flight-pr": "42", "org.sparkcache.cache-namespace-impact": "none", + "org.sparkcache.diagnostic-fix": ( + "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;" + "parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" + ), } if any(labels.get(name) != value for name, value in expected_labels.items()): raise QualificationError("artifact receipt labels differ from PR42") diff --git a/performance/harnesses/glm53_page_base_flight/test_qualification.py b/performance/harnesses/glm53_page_base_flight/test_qualification.py index 3a16dcd7..fa1aaaf5 100644 --- a/performance/harnesses/glm53_page_base_flight/test_qualification.py +++ b/performance/harnesses/glm53_page_base_flight/test_qualification.py @@ -83,12 +83,19 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", "org.sparkcache.feature.page-base-read-flight-pr": "42", "org.sparkcache.cache-namespace-impact": "none", + "org.sparkcache.diagnostic-fix": ( + "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;" + "parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" + ), } artifact = _write( tmp_path / "artifact.json", { "schema": "sparkcache-diagnostic-image-receipt/v1", - "image": {"id": "sha256:" + "c" * 64, "labels": labels}, + "image": { + "id": "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", + "labels": labels, + }, }, ) semantic = _write( @@ -170,7 +177,9 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( ) assert verdict["schema"] == RECEIPT_SCHEMA assert verdict["status"] == "qualified" - assert verdict["image_id"] == "sha256:" + "c" * 64 + assert verdict["image_id"] == ( + "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" + ) assert [item["verified_result_restores"] for item in verdict["rank_evidence"]] == [ 16, 16, diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md index 75360f2d..724b1b63 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md @@ -13,7 +13,7 @@ claims require the deterministic harness under Build on Linux ARM64: ```bash -IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64' \ +IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64' \ BUILD_RECEIPT="$PWD/glm53-pr42-page-base-flight-image-receipt.json" \ bash runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh ``` diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh index f21fd527..58c8de5d 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh @@ -7,7 +7,7 @@ repo_root="$(git -C "${here}" rev-parse --show-toplevel)" pins="${here}/pins.json" shared_overlay="${repo_root}/runtime/glm53-flash-adaptive-mtp-python-overlay" engine="${CONTAINER_ENGINE:-docker}" -image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64}" +image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64}" receipt_path="${BUILD_RECEIPT:-${PWD}/glm53-pr42-page-base-flight-image-receipt.json}" fatal() { diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json index e0649c9b..3e7db31d 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json @@ -18,7 +18,7 @@ }, "builder": { "arm_builder": "pytorch/manylinuxaarch64-builder@sha256:f91599c49f526c77d01b68286f2bf943a5fd6a432d7e3f0afcc5784825908fe9", - "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64" + "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64" }, "vllm": { "repository": "https://github.com/local-inference-lab/vllm.git", @@ -219,11 +219,11 @@ "maximum_declared_bytes_per_flight": 1073741824, "maximum_peak_reserved_bytes": 2147483648, "artifact_receipt": { - "schema": "sparkcache-diagnostic-image-receipt/v1", - "sha256": "551072f700db6cf064a85242ed1c8fbd52c8cca870c20534a6d0c1b133ba6bc4", - "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-arm64.json", - "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64", - "image_id": "sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde", + "schema": "sparkcache-diagnostic-image-receipt/v2", + "sha256": "18052a885776d7da31511c53cf8ed3c626f2b5ab0e56b321d4f669c2bc46241c", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-exact-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64", + "image_id": "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", "builder": "spark-aa42", "feature_status": "implemented-gpu-free-tested", "parent_image_id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py index 7a520da8..998ed5a0 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py @@ -61,6 +61,7 @@ def _render_containerfile() -> str: marker + ' org.sparkcache.feature.page-base-read-flight="implemented-gpu-free-tested" \\\n' + ' org.sparkcache.feature.page-base-read-flight-pr="42" \\\n' + + ' org.sparkcache.diagnostic-fix="source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" \\\n' + ' org.sparkcache.parent-image-id="sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8" \\\n' + ' org.sparkcache.cache-namespace-impact="none" \\\n' ) @@ -82,6 +83,8 @@ def _render_verify_image() -> str: + ' "org.sparkcache.feature.page-base-read-flight": ' + '"implemented-gpu-free-tested",\n' + ' "org.sparkcache.feature.page-base-read-flight-pr": "42",\n' + + ' "org.sparkcache.diagnostic-fix": ' + + '"source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde",\n' + ' "org.sparkcache.parent-image-id": ' + '"sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8",\n' + ' "org.sparkcache.cache-namespace-impact": "none",\n' diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py index 9e144022..40ab5d3c 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py @@ -61,11 +61,11 @@ def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: "maximum_declared_bytes_per_flight": 1073741824, "maximum_peak_reserved_bytes": 2147483648, "artifact_receipt": { - "schema": "sparkcache-diagnostic-image-receipt/v1", - "sha256": "551072f700db6cf064a85242ed1c8fbd52c8cca870c20534a6d0c1b133ba6bc4", - "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-arm64.json", - "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-arm64", - "image_id": "sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde", + "schema": "sparkcache-diagnostic-image-receipt/v2", + "sha256": "18052a885776d7da31511c53cf8ed3c626f2b5ab0e56b321d4f669c2bc46241c", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-exact-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64", + "image_id": "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", "builder": "spark-aa42", "feature_status": "implemented-gpu-free-tested", "parent_image_id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", @@ -88,10 +88,13 @@ def test_rendered_context_and_verifier_bind_feature_receipt_fields() -> None: "implemented-gpu-free-tested" ) assert labels["org.sparkcache.feature.page-base-read-flight-pr"] == "42" + assert labels["org.sparkcache.diagnostic-fix"].startswith( + "source-tree-marker=834ff02c" + ) def test_build_script_uses_isolated_default_outputs() -> None: script = (HERE / "build-image.sh").read_text(encoding="utf-8") - assert "dflash7-pr42-page-base-flight-arm64" in script + assert "dflash7-pr42-page-base-flight-exact-arm64" in script assert "glm53-pr42-page-base-flight-image-receipt.json" in script assert "runtime/glm53-flash-dflash7-pr42-page-base-flight" in script diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py index c27f6e04..84cdb25f 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py @@ -41,6 +41,10 @@ def expected_output_labels(pins: dict[str, Any]) -> dict[str, str]: "implemented-gpu-free-tested" ), "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.diagnostic-fix": ( + "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;" + "parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" + ), "org.sparkcache.parent-image-id": ( "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8" ), diff --git a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json index eabb2836..a720d154 100644 --- a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json +++ b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json @@ -198,6 +198,7 @@ "org.sparkring.nccl.patched-tree": "abdeb053b94c3f6d472cd55ae2b79ca821299009", "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.diagnostic-fix": "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde", "org.sparkcache.parent-image-id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", "org.sparkcache.cache-namespace-impact": "none" }, diff --git a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py index dfe0af39..cb969e2a 100644 --- a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py +++ b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py @@ -74,6 +74,9 @@ def test_pr42_profile_resolves_exact_source_and_feature_labels() -> None: "implemented-gpu-free-tested" ) assert labels["org.sparkcache.feature.page-base-read-flight-pr"] == "42" + assert labels["org.sparkcache.diagnostic-fix"].startswith( + "source-tree-marker=834ff02c" + ) assert labels["org.sparkcache.cuda-placement-library-sha256"] == ( DIGESTS["cuda_placement_library_sha256"] ) From 93dca9a0c08ca66b181baa420ec4d883b3e2b941 Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 09:30:04 -0500 Subject: [PATCH 3/9] Bind PR42 source-bytes fix artifact --- .../glm53_page_base_flight/qualification.py | 13 ++++---- .../test_qualification.py | 15 +++++----- .../README.md | 4 +-- .../build-image.sh | 2 +- .../pins.json | 29 +++++++++++------- .../prepare_context.py | 6 ++-- .../test_pr42_page_base_flight_contract.py | 30 ++++++++++++------- .../verify_image.py | 5 ++-- ...fetensors-sparkcache-tp4-dcp1.example.json | 30 ++++++++++--------- ...are_glm53_pr42_page_base_flight_profile.py | 6 ++-- ...are_glm53_pr42_page_base_flight_profile.py | 7 +++-- 11 files changed, 87 insertions(+), 60 deletions(-) diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py index 5b9f2cc2..198614fa 100644 --- a/performance/harnesses/glm53_page_base_flight/qualification.py +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -315,12 +315,12 @@ def verify_evidence( image_id = image.get("id") if not isinstance(labels, dict) or not isinstance(image_id, str): raise QualificationError("artifact receipt omits labels or image ID") - if image_id != "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f": + if image_id != "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0": raise QualificationError("artifact receipt is not the corrected exact image") expected_labels = { - "org.sparkcache.source-revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", - "org.sparkcache.source-tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", - "org.sparkcache.source-sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "org.sparkcache.source-revision": "5a6613e473a713695948e69e0027fd67530028f8", + "org.sparkcache.source-tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", + "org.sparkcache.source-sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", "org.sparkcache.cuda-placement-library-sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", "org.sparkcache.feature.page-base-read-flight": ( "implemented-gpu-free-tested" @@ -328,9 +328,10 @@ def verify_evidence( "org.sparkcache.feature.page-base-read-flight-pr": "42", "org.sparkcache.cache-namespace-impact": "none", "org.sparkcache.diagnostic-fix": ( - "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;" - "parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" + "page-header-source-bytes-fix=229d7d6;" + "parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" ), + "org.sparkcache.page-header-source-bytes-fix": "229d7d6", } if any(labels.get(name) != value for name, value in expected_labels.items()): raise QualificationError("artifact receipt labels differ from PR42") diff --git a/performance/harnesses/glm53_page_base_flight/test_qualification.py b/performance/harnesses/glm53_page_base_flight/test_qualification.py index fa1aaaf5..3a1f7c3b 100644 --- a/performance/harnesses/glm53_page_base_flight/test_qualification.py +++ b/performance/harnesses/glm53_page_base_flight/test_qualification.py @@ -76,24 +76,25 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( tmp_path: Path, ) -> None: labels = { - "org.sparkcache.source-revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", - "org.sparkcache.source-tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", - "org.sparkcache.source-sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "org.sparkcache.source-revision": "5a6613e473a713695948e69e0027fd67530028f8", + "org.sparkcache.source-tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", + "org.sparkcache.source-sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", "org.sparkcache.cuda-placement-library-sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", "org.sparkcache.feature.page-base-read-flight-pr": "42", "org.sparkcache.cache-namespace-impact": "none", "org.sparkcache.diagnostic-fix": ( - "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;" - "parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" + "page-header-source-bytes-fix=229d7d6;" + "parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" ), + "org.sparkcache.page-header-source-bytes-fix": "229d7d6", } artifact = _write( tmp_path / "artifact.json", { "schema": "sparkcache-diagnostic-image-receipt/v1", "image": { - "id": "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", + "id": "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0", "labels": labels, }, }, @@ -178,7 +179,7 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( assert verdict["schema"] == RECEIPT_SCHEMA assert verdict["status"] == "qualified" assert verdict["image_id"] == ( - "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" + "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0" ) assert [item["verified_result_restores"] for item in verdict["rank_evidence"]] == [ 16, diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md index 724b1b63..7a8b0e6b 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md @@ -5,7 +5,7 @@ Status: **implemented, not qualified**. This isolated image contract retains the vLLM, B12X, DFlash, recurrent publication, lease, and CUDA placement identities from SparkRing pull request #146 while installing SparkCache commit -`9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970`. Its build receipt records the +`5a6613e473a713695948e69e0027fd67530028f8`. Its build receipt records the `sparkcache-page-base-restore-flight/v1` qualification contract. Live serving claims require the deterministic harness under `performance/harnesses/glm53_page_base_flight/`. @@ -13,7 +13,7 @@ claims require the deterministic harness under Build on Linux ARM64: ```bash -IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64' \ +IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64' \ BUILD_RECEIPT="$PWD/glm53-pr42-page-base-flight-image-receipt.json" \ bash runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh ``` diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh index 58c8de5d..38c3d53f 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh @@ -7,7 +7,7 @@ repo_root="$(git -C "${here}" rev-parse --show-toplevel)" pins="${here}/pins.json" shared_overlay="${repo_root}/runtime/glm53-flash-adaptive-mtp-python-overlay" engine="${CONTAINER_ENGINE:-docker}" -image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64}" +image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64}" receipt_path="${BUILD_RECEIPT:-${PWD}/glm53-pr42-page-base-flight-image-receipt.json}" fatal() { diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json index 3e7db31d..fcc62df7 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json @@ -18,7 +18,7 @@ }, "builder": { "arm_builder": "pytorch/manylinuxaarch64-builder@sha256:f91599c49f526c77d01b68286f2bf943a5fd6a432d7e3f0afcc5784825908fe9", - "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64" + "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64" }, "vllm": { "repository": "https://github.com/local-inference-lab/vllm.git", @@ -147,9 +147,9 @@ }, "sparkcache": { "repository": "https://github.com/FujitsuPolycom/sparkcache.git", - "commit": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", - "tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", - "source_tree_sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "commit": "5a6613e473a713695948e69e0027fd67530028f8", + "tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", + "source_tree_sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", "cuda_placement_library_sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", "cuda_config_schema": "canonical-v1", "canonical_cuda_config_keys": [ @@ -218,16 +218,25 @@ "maximum_simultaneous_flights": 2, "maximum_declared_bytes_per_flight": 1073741824, "maximum_peak_reserved_bytes": 2147483648, + "source_feature_commit": "6f3edede4b9f707ef9e8879359b05b0775ed5fee", + "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01", "artifact_receipt": { - "schema": "sparkcache-diagnostic-image-receipt/v2", - "sha256": "18052a885776d7da31511c53cf8ed3c626f2b5ab0e56b321d4f669c2bc46241c", - "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-exact-arm64.json", - "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64", - "image_id": "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", + "schema": "sparkcache-sourcebytesfix-image-receipt/v1", + "sha256": "31c226697752672cafe83b6d06793638fb64d6ad1abe9937edf89ee4814bca5a", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-sourcebytesfix-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64", + "image_id": "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0", "builder": "spark-aa42", "feature_status": "implemented-gpu-free-tested", "parent_image_id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", - "cache_namespace_impact": "none" + "cache_namespace_impact": "none", + "tp4_import_receipt": { + "schema": "sparkcache-pr42-sourcebytesfix-tp4-import-receipt/v1", + "path": "/home/code/image-build-receipts/pr42-sourcebytesfix-tp4-import-receipt.json", + "sha256": "0e14c0e6e21a8fdd8a21bbdcad960188a853512bdf97cfbc3f2843edb8a79e72", + "archive_sha256": "9e1876207e7cbb3a85ac121fd91c21974eb73298af2638813a3a2fc5a27dc2ab", + "archive_bytes": 20822443008 + } } }, "runtime_cache_roots": { diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py index 998ed5a0..8fd14c9d 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py @@ -61,7 +61,8 @@ def _render_containerfile() -> str: marker + ' org.sparkcache.feature.page-base-read-flight="implemented-gpu-free-tested" \\\n' + ' org.sparkcache.feature.page-base-read-flight-pr="42" \\\n' - + ' org.sparkcache.diagnostic-fix="source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" \\\n' + + ' org.sparkcache.diagnostic-fix="page-header-source-bytes-fix=229d7d6;parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" \\\n' + + ' org.sparkcache.page-header-source-bytes-fix="229d7d6" \\\n' + ' org.sparkcache.parent-image-id="sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8" \\\n' + ' org.sparkcache.cache-namespace-impact="none" \\\n' ) @@ -84,7 +85,8 @@ def _render_verify_image() -> str: + '"implemented-gpu-free-tested",\n' + ' "org.sparkcache.feature.page-base-read-flight-pr": "42",\n' + ' "org.sparkcache.diagnostic-fix": ' - + '"source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde",\n' + + '"page-header-source-bytes-fix=229d7d6;parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f",\n' + + ' "org.sparkcache.page-header-source-bytes-fix": "229d7d6",\n' + ' "org.sparkcache.parent-image-id": ' + '"sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8",\n' + ' "org.sparkcache.cache-namespace-impact": "none",\n' diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py index 40ab5d3c..8c3c1d39 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py @@ -25,10 +25,10 @@ def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: pins = json.loads(PINS.read_text(encoding="utf-8")) assert pins["sparkcache"] == { **pins["sparkcache"], - "commit": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", - "tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "commit": "5a6613e473a713695948e69e0027fd67530028f8", + "tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", "source_tree_sha256": ( - "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c" + "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313" ), "cuda_placement_library_sha256": ( "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c" @@ -60,16 +60,25 @@ def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: "maximum_simultaneous_flights": 2, "maximum_declared_bytes_per_flight": 1073741824, "maximum_peak_reserved_bytes": 2147483648, + "source_feature_commit": "6f3edede4b9f707ef9e8879359b05b0775ed5fee", + "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01", "artifact_receipt": { - "schema": "sparkcache-diagnostic-image-receipt/v2", - "sha256": "18052a885776d7da31511c53cf8ed3c626f2b5ab0e56b321d4f669c2bc46241c", - "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-exact-arm64.json", - "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-exact-arm64", - "image_id": "sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", + "schema": "sparkcache-sourcebytesfix-image-receipt/v1", + "sha256": "31c226697752672cafe83b6d06793638fb64d6ad1abe9937edf89ee4814bca5a", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-sourcebytesfix-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64", + "image_id": "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0", "builder": "spark-aa42", "feature_status": "implemented-gpu-free-tested", "parent_image_id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", "cache_namespace_impact": "none", + "tp4_import_receipt": { + "schema": "sparkcache-pr42-sourcebytesfix-tp4-import-receipt/v1", + "path": "/home/code/image-build-receipts/pr42-sourcebytesfix-tp4-import-receipt.json", + "sha256": "0e14c0e6e21a8fdd8a21bbdcad960188a853512bdf97cfbc3f2843edb8a79e72", + "archive_sha256": "9e1876207e7cbb3a85ac121fd91c21974eb73298af2638813a3a2fc5a27dc2ab", + "archive_bytes": 20822443008, + }, }, } @@ -89,12 +98,13 @@ def test_rendered_context_and_verifier_bind_feature_receipt_fields() -> None: ) assert labels["org.sparkcache.feature.page-base-read-flight-pr"] == "42" assert labels["org.sparkcache.diagnostic-fix"].startswith( - "source-tree-marker=834ff02c" + "page-header-source-bytes-fix=229d7d6" ) + assert labels["org.sparkcache.page-header-source-bytes-fix"] == "229d7d6" def test_build_script_uses_isolated_default_outputs() -> None: script = (HERE / "build-image.sh").read_text(encoding="utf-8") - assert "dflash7-pr42-page-base-flight-exact-arm64" in script + assert "dflash7-pr42-page-base-flight-sourcebytesfix-arm64" in script assert "glm53-pr42-page-base-flight-image-receipt.json" in script assert "runtime/glm53-flash-dflash7-pr42-page-base-flight" in script diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py index 84cdb25f..b82e2f09 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py @@ -42,9 +42,10 @@ def expected_output_labels(pins: dict[str, Any]) -> dict[str, str]: ), "org.sparkcache.feature.page-base-read-flight-pr": "42", "org.sparkcache.diagnostic-fix": ( - "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;" - "parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde" + "page-header-source-bytes-fix=229d7d6;" + "parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" ), + "org.sparkcache.page-header-source-bytes-fix": "229d7d6", "org.sparkcache.parent-image-id": ( "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8" ), diff --git a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json index a720d154..e38a9d31 100644 --- a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json +++ b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json @@ -1,9 +1,9 @@ { "schema": "sparkring-runtime-profile/v1", - "profile_id": "glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1", + "profile_id": "glm53-flash-dflash7-pr42-page-base-flight-sourcebytesfix-fastsafetensors-sparkcache-tp4-dcp1", "model_family": "glm53-flash", "engine": "docker", - "container_name": "glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4", + "container_name": "glm53-flash-dflash7-pr42-page-base-flight-sourcebytesfix-fastsafetensors-sparkcache-tp4", "image": "REPLACE_WITH_DFLASH7_PR42_PAGE_BASE_FLIGHT_IMAGE", "image_id": "sha256:0000000000000000000000000000000000000000000000000000000000000000", "model_host_path": "/REPLACE/TARGET_MODEL_HOST_PATH", @@ -51,7 +51,7 @@ }, "extra_vllm_args": [ "--served-model-name", - "glm-5.3-flash-nvfp4-dflash7-pr42-page-base-flight-0b67266-on-da4d7be-b12x-b1d541f-tp4", + "glm-5.3-flash-nvfp4-dflash7-pr42-page-base-flight-sourcebytesfix-0b67266-on-da4d7be-b12x-b1d541f-tp4", "--host", "0.0.0.0", "--pipeline-parallel-size", @@ -99,7 +99,7 @@ "--enable-prefix-caching", "--cudagraph-metrics", "--kv-transfer-config", - "{\"kv_connector\":\"SparkContextCacheConnector\",\"kv_connector_module_path\":\"sparkcache.spark_context_cache_connector\",\"kv_role\":\"kv_both\",\"kv_load_failure_policy\":\"recompute\",\"kv_connector_extra_config\":{\"spark_cache_root\":\"/cache/jit/sparkcache-context/dflash7-pr42-page-base-flight\",\"spark_cache_model_profile\":\"glm53-flash-hybrid\",\"spark_cache_publication_schema\":\"tail-cow-v1\",\"spark_cache_target_checkpoint_sha256\":\"a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9\",\"spark_cache_draft_checkpoint_sha256\":\"b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b\",\"spark_cache_draft_policy\":\"separate\",\"spark_cache_store\":true,\"spark_cache_restore\":true,\"spark_cache_scheduler_probe\":\"none\",\"spark_cache_streaming_snapshots\":false,\"spark_cache_cuda_restore\":true,\"spark_cache_max_bytes\":51539607552,\"spark_cache_low_watermark_bytes\":42949672960,\"spark_cache_ttl_seconds\":0,\"spark_cache_min_span_tokens\":4096,\"spark_cache_max_span_tokens\":524288,\"spark_cache_cuda_placement_library\":\"/opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so\",\"spark_cache_cuda_placement_library_sha256\":\"REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256\",\"spark_cache_cuda_placement_arena_bytes\":268435456,\"spark_cache_cuda_restore_io_workers\":8,\"spark_cache_load_threads\":2,\"spark_cache_clear_once\":\"sparkring-dflash7-pr42-page-base-flight-9c2f6c8-initialization\"}}" + "{\"kv_connector\":\"SparkContextCacheConnector\",\"kv_connector_module_path\":\"sparkcache.spark_context_cache_connector\",\"kv_role\":\"kv_both\",\"kv_load_failure_policy\":\"recompute\",\"kv_connector_extra_config\":{\"spark_cache_root\":\"/cache/jit/sparkcache-context/dflash7-pr42-page-base-flight\",\"spark_cache_model_profile\":\"glm53-flash-hybrid\",\"spark_cache_publication_schema\":\"tail-cow-v1\",\"spark_cache_target_checkpoint_sha256\":\"a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9\",\"spark_cache_draft_checkpoint_sha256\":\"b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b\",\"spark_cache_draft_policy\":\"separate\",\"spark_cache_store\":true,\"spark_cache_restore\":true,\"spark_cache_scheduler_probe\":\"none\",\"spark_cache_streaming_snapshots\":false,\"spark_cache_cuda_restore\":true,\"spark_cache_max_bytes\":51539607552,\"spark_cache_low_watermark_bytes\":42949672960,\"spark_cache_ttl_seconds\":0,\"spark_cache_min_span_tokens\":4096,\"spark_cache_max_span_tokens\":524288,\"spark_cache_cuda_placement_library\":\"/opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so\",\"spark_cache_cuda_placement_library_sha256\":\"REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256\",\"spark_cache_cuda_placement_arena_bytes\":268435456,\"spark_cache_cuda_restore_io_workers\":8,\"spark_cache_load_threads\":2,\"spark_cache_clear_once\":\"sparkring-dflash7-pr42-page-base-flight-5a6613e-sourcebytesfix\"}}" ], "extra_volumes": [ { @@ -114,7 +114,7 @@ } ], "extra_labels": { - "org.sparkring.model-profile": "glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-tp4-dcp1", + "org.sparkring.model-profile": "glm53-flash-dflash7-pr42-page-base-flight-sourcebytesfix-fastsafetensors-tp4-dcp1", "org.sparkring.external-cache": "sparkcache", "org.sparkcache.publication-schema": "tail-cow-v1", "org.sparkring.speculator": "external-dflash7", @@ -150,9 +150,9 @@ "max_num_seqs": "32", "sparkcache_publication_schema": "tail-cow-v1", "sparkcache_effective_publication_schema": "page-tail-cow-v1", - "sparkcache_source_sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", - "sparkcache_source_revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", - "sparkcache_source_tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", + "sparkcache_source_sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", + "sparkcache_source_revision": "5a6613e473a713695948e69e0027fd67530028f8", + "sparkcache_source_tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", "vllm_native_revision": "da4d7be6c97434f6942292ed8abbf4b32dc44355", "vllm_python_revision": "0b67266a0f37d6146a8403fb8482403c62f412d5", "vllm_python_tree": "ba9484ccb33aa56e90ff2f447f15ca9b9da97639", @@ -163,7 +163,8 @@ "deep_ep_module_status": "absent", "allowed_runtime_warnings": "modelopt_experimental_quantization,fp8_kv_cache_accuracy", "page_base_restore_flight_schema": "sparkcache-page-base-restore-flight/v1", - "page_base_restore_flight_status": "implemented-unqualified" + "page_base_restore_flight_status": "implemented-unqualified", + "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01" }, "required_image_labels": { "org.jovian.architecture": "linux-arm64-sm121", @@ -186,9 +187,9 @@ "org.sparkcache.deployment-profile": "glm53-flash-dflash7-python-overlay", "org.sparkcache.cuda-config-schema": "canonical-v1", "org.sparkcache.cuda-placement-library-sha256": "REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256", - "org.sparkcache.source-revision": "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970", - "org.sparkcache.source-tree": "e7ac2ef7a3180c5a83771edac44216c3325894e5", - "org.sparkcache.source-sha256": "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c", + "org.sparkcache.source-revision": "5a6613e473a713695948e69e0027fd67530028f8", + "org.sparkcache.source-tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", + "org.sparkcache.source-sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", "org.sparkcache.vllm-contract-sha256": "8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9", "org.sparkring.runtime.removed-deep-ep-distribution": "deep_ep==2.0.0+local", "org.sparkring.runtime.deep-ep-removal-receipt-sha256": "65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3", @@ -198,13 +199,14 @@ "org.sparkring.nccl.patched-tree": "abdeb053b94c3f6d472cd55ae2b79ca821299009", "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", "org.sparkcache.feature.page-base-read-flight-pr": "42", - "org.sparkcache.diagnostic-fix": "source-tree-marker=834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c;parent=sha256:ba6ca684f5dbbe7fccac93aedce8abe907cf4cabcc4f5d2f481fad2706fdbfde", + "org.sparkcache.diagnostic-fix": "page-header-source-bytes-fix=229d7d6;parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", + "org.sparkcache.page-header-source-bytes-fix": "229d7d6", "org.sparkcache.parent-image-id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", "org.sparkcache.cache-namespace-impact": "none" }, "attestation_hook": [ "/bin/sh", "-ec", - "test -f /models/target/config.json && test -f /models/target/model.safetensors.index.json && test \"$(sha256sum /models/target/config.json | cut -d ' ' -f1)\" = 676382abd1e90a6c85f0c8f33d45441ecd45fd514fd7b63ce5610e732d8e4996 && test \"$(sha256sum /models/target/model.safetensors.index.json | cut -d ' ' -f1)\" = 0d1d9e6b226e76520e182de10d4e7194cc885c5cb1bf885bb90de1916ce312cb && test -f /dflash-draft/config.json && test -f /dflash-draft/model.safetensors && test \"$(sha256sum /dflash-draft/config.json | cut -d ' ' -f1)\" = c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573 && test \"$(sha256sum /dflash-draft/model.safetensors | cut -d ' ' -f1)\" = b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b && test \"$(sha256sum /opt/sparkring/nccl/libnccl.so.2 | cut -d ' ' -f1)\" = 5f1c3f10d5ace66d4ba584415bbfe42b6ac1a0a9116a3b81dcbe50516ad924b3 && grep -q '\"tail-cow-v1\"' /opt/sparkcache-src/sparkcache/spark_context_cache_config.py && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/vllm-python-overlay.json | cut -d ' ' -f1)\" = e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/source-receipt.json | cut -d ' ' -f1)\" = REPLACE_WITH_SOURCE_RECEIPT_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_elf_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_ELF_MANIFEST_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_dispatch_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_DISPATCH_MANIFEST_SHA256 && test \"$(cat /opt/sparkring/runtime/python-overlay/sparkcache-source-tree.sha256)\" = 834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c && test \"$(sha256sum /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json | cut -d ' ' -f1)\" = 8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9 && test \"$(sha256sum /opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so | cut -d ' ' -f1)\" = REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256 && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/deep-ep-removal-receipt.json | cut -d ' ' -f1)\" = 65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3 && python3 -c 'import importlib.util; assert importlib.util.find_spec(\"deep_ep\") is None' && python3 /opt/sparkcache-src/sparkcache/runtime_patches/verify_lease_contract.py --vllm-root /usr/local/lib/python3.12/dist-packages --contract /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json" + "test -f /models/target/config.json && test -f /models/target/model.safetensors.index.json && test \"$(sha256sum /models/target/config.json | cut -d ' ' -f1)\" = 676382abd1e90a6c85f0c8f33d45441ecd45fd514fd7b63ce5610e732d8e4996 && test \"$(sha256sum /models/target/model.safetensors.index.json | cut -d ' ' -f1)\" = 0d1d9e6b226e76520e182de10d4e7194cc885c5cb1bf885bb90de1916ce312cb && test -f /dflash-draft/config.json && test -f /dflash-draft/model.safetensors && test \"$(sha256sum /dflash-draft/config.json | cut -d ' ' -f1)\" = c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573 && test \"$(sha256sum /dflash-draft/model.safetensors | cut -d ' ' -f1)\" = b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b && test \"$(sha256sum /opt/sparkring/nccl/libnccl.so.2 | cut -d ' ' -f1)\" = 5f1c3f10d5ace66d4ba584415bbfe42b6ac1a0a9116a3b81dcbe50516ad924b3 && grep -q '\"tail-cow-v1\"' /opt/sparkcache-src/sparkcache/spark_context_cache_config.py && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/vllm-python-overlay.json | cut -d ' ' -f1)\" = e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/source-receipt.json | cut -d ' ' -f1)\" = REPLACE_WITH_SOURCE_RECEIPT_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_elf_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_ELF_MANIFEST_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_dispatch_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_DISPATCH_MANIFEST_SHA256 && test \"$(cat /opt/sparkring/runtime/python-overlay/sparkcache-source-tree.sha256)\" = 446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313 && test \"$(sha256sum /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json | cut -d ' ' -f1)\" = 8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9 && test \"$(sha256sum /opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so | cut -d ' ' -f1)\" = REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256 && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/deep-ep-removal-receipt.json | cut -d ' ' -f1)\" = 65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3 && python3 -c 'import importlib.util; assert importlib.util.find_spec(\"deep_ep\") is None' && python3 /opt/sparkcache-src/sparkcache/runtime_patches/verify_lease_contract.py --vllm-root /usr/local/lib/python3.12/dist-packages --contract /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json" ] } diff --git a/scripts/prepare_glm53_pr42_page_base_flight_profile.py b/scripts/prepare_glm53_pr42_page_base_flight_profile.py index 6a70f1cf..d2ca1964 100644 --- a/scripts/prepare_glm53_pr42_page_base_flight_profile.py +++ b/scripts/prepare_glm53_pr42_page_base_flight_profile.py @@ -25,10 +25,10 @@ def _module(): base = _module() base.IMAGE_PLACEHOLDER = "REPLACE_WITH_DFLASH7_PR42_PAGE_BASE_FLIGHT_IMAGE" -base.SPARKCACHE_COMMIT = "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970" -base.SPARKCACHE_TREE = "e7ac2ef7a3180c5a83771edac44216c3325894e5" +base.SPARKCACHE_COMMIT = "5a6613e473a713695948e69e0027fd67530028f8" +base.SPARKCACHE_TREE = "5e74b3f9d484064d966ce6392dda1e0f7ff17190" base.SPARKCACHE_SOURCE_SHA256 = ( - "834ff02c235e3f3a3594cec31d0a83d981ac8d410d6482d062725fd9b846a95c" + "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313" ) _base_resolve = base.resolve diff --git a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py index cb969e2a..ef1a7aca 100644 --- a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py +++ b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py @@ -37,7 +37,7 @@ def test_pr42_profile_is_operationally_isolated_without_identity_geometry_change extra = transfer["kv_connector_extra_config"] assert extra["spark_cache_root"].endswith("dflash7-pr42-page-base-flight") assert extra["spark_cache_clear_once"] == ( - "sparkring-dflash7-pr42-page-base-flight-9c2f6c8-initialization" + "sparkring-dflash7-pr42-page-base-flight-5a6613e-sourcebytesfix" ) assert extra["spark_cache_publication_schema"] == "tail-cow-v1" assert extra["spark_cache_model_profile"] == "glm53-flash-hybrid" @@ -64,7 +64,7 @@ def test_pr42_profile_resolves_exact_source_and_feature_labels() -> None: ) assert resolved_site["runtime"]["container_image"] == resolved["image"] assert resolved["identity"]["sparkcache_source_revision"] == ( - "9c2f6c8ac36e0aa5d134fbcd81e819db2ce63970" + "5a6613e473a713695948e69e0027fd67530028f8" ) labels = resolved["required_image_labels"] assert labels["org.sparkcache.deployment-profile"] == ( @@ -75,8 +75,9 @@ def test_pr42_profile_resolves_exact_source_and_feature_labels() -> None: ) assert labels["org.sparkcache.feature.page-base-read-flight-pr"] == "42" assert labels["org.sparkcache.diagnostic-fix"].startswith( - "source-tree-marker=834ff02c" + "page-header-source-bytes-fix=229d7d6" ) + assert labels["org.sparkcache.page-header-source-bytes-fix"] == "229d7d6" assert labels["org.sparkcache.cuda-placement-library-sha256"] == ( DIGESTS["cuda_placement_library_sha256"] ) From 205b6204792404b5bff82b031e77a16695839ff4 Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 10:19:13 -0500 Subject: [PATCH 4/9] Advance PR42 singleton qualification harness --- .../glm53_page_base_flight/README.md | 9 +- .../glm53_page_base_flight/qualification.py | 106 +++++++++- .../test_qualification.py | 188 +++++++++++++++++- .../README.md | 4 +- .../build-image.sh | 2 +- .../pins.json | 11 +- .../prepare_context.py | 3 + .../test_pr42_page_base_flight_contract.py | 14 +- .../verify_image.py | 3 + ...fetensors-sparkcache-tp4-dcp1.example.json | 28 +-- ...are_glm53_pr42_page_base_flight_profile.py | 6 +- ...are_glm53_pr42_page_base_flight_profile.py | 7 +- 12 files changed, 332 insertions(+), 49 deletions(-) diff --git a/performance/harnesses/glm53_page_base_flight/README.md b/performance/harnesses/glm53_page_base_flight/README.md index bb8e20ae..0126b6fc 100644 --- a/performance/harnesses/glm53_page_base_flight/README.md +++ b/performance/harnesses/glm53_page_base_flight/README.md @@ -7,8 +7,13 @@ authenticated 131,072-token result roots with private 32,768-token tails. It records prompt and response hashes without response content. It never starts, stops, or restarts a service. -Run `semantic` and `publish`, inspect each rank's isolated manifest root, and -retain their receipts. A service restart is a separate operator action and +Run `semantic` and capture rank 0's container log continuously to a local file +before invoking `publish --scheduler-log PATH`. After the base commit, the +publisher submits one two-token scheduler step and reads only log bytes written +after publication began. It requires one `KV Transfer metrics` record with four +ranks reporting and four held digests before it submits any private-tail +request. Inspect each rank's isolated manifest root and retain the receipts. A +service restart is a separate operator action and must not occur without authorization. After that action, run `replay`, capture bounded rank logs for only that cohort, and run `verify` with four manifest receipts and four logs. The verifier requires one diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py index 198614fa..4c82b34f 100644 --- a/performance/harnesses/glm53_page_base_flight/qualification.py +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -7,6 +7,7 @@ import concurrent.futures import hashlib import json +import re import time import urllib.error import urllib.request @@ -18,6 +19,7 @@ RESULT_TOKENS = 131_072 TAIL_TOKENS = RESULT_TOKENS - BASE_TOKENS PARTICIPANTS = 16 +TP_RANKS = 4 FLIGHT_SCHEMA = "sparkcache-page-base-restore-flight/v1" RESTORE_SCHEMA = "sparkcache-restore-timing/v1" RECEIPT_SCHEMA = "sparkring-glm53-pr42-page-base-flight-qualification/v1" @@ -143,10 +145,88 @@ def _completion( } -def publish(endpoint: str, model: str, timeout: float) -> dict[str, Any]: +def _confirm_base_held_on_all_ranks( + endpoint: str, + model: str, + token_bank: list[int], + scheduler_log: Path, + scheduler_log_offset: int, + timeout: float, +) -> dict[str, Any]: + # One request below SparkCache's publication threshold gives the scheduler + # a step in which to absorb the workers' post-commit held-digest reports. + scheduler_step = _completion( + endpoint, + model, + [token_bank[-2], token_bank[-1]], + timeout, + ) + deadline = time.monotonic() + timeout + last_counts: tuple[int, int] | None = None + matched_line: str | None = None + while time.monotonic() < deadline: + try: + size = scheduler_log.stat().st_size + offset = scheduler_log_offset if size >= scheduler_log_offset else 0 + with scheduler_log.open("rb") as stream: + stream.seek(offset) + observed = stream.read().decode("utf-8", errors="replace") + except OSError as exc: + raise QualificationError( + f"scheduler log cannot be read: {scheduler_log}" + ) from exc + for line in observed.splitlines(): + if "KV Transfer metrics:" not in line: + continue + ranks = re.search(r"\bspark_cache_ranks_reporting=(\d+)\b", line) + held = re.search(r"\bspark_cache_digests_held=(\d+)\b", line) + if ranks is None or held is None: + continue + last_counts = (int(ranks.group(1)), int(held.group(1))) + if last_counts == (TP_RANKS, TP_RANKS): + matched_line = line + break + if matched_line is not None: + break + time.sleep(0.1) + if matched_line is None: + suffix = "no complete report observed" + if last_counts is not None: + suffix = ( + f"ranks_reporting={last_counts[0]} digests_held={last_counts[1]}" + ) + raise QualificationError(f"base publication is not held on all ranks: {suffix}") + return { + "status": "verified", + "required_ranks": TP_RANKS, + "ranks_reporting": TP_RANKS, + "digests_held": TP_RANKS, + "scheduler_log_line_sha256": _sha256(matched_line.encode()), + "scheduler_step": scheduler_step, + } + + +def publish( + endpoint: str, + model: str, + scheduler_log: Path, + timeout: float, +) -> dict[str, Any]: + try: + scheduler_log_offset = scheduler_log.stat().st_size + except OSError as exc: + raise QualificationError(f"scheduler log cannot be read: {scheduler_log}") from exc bank = discover_token_bank(endpoint, model, timeout) base, results, _unrelated = prompts(bank) base_result = _completion(endpoint, model, base, timeout) + base_readiness = _confirm_base_held_on_all_ranks( + endpoint, + model, + bank, + scheduler_log, + scheduler_log_offset, + timeout, + ) result_receipts = [ {"result_index": index, **_completion(endpoint, model, prompt, timeout)} for index, prompt in enumerate(results) @@ -161,6 +241,7 @@ def publish(endpoint: str, model: str, timeout: float) -> dict[str, Any]: "result_publication_tokens": RESULT_TOKENS, "private_tail_tokens": TAIL_TOKENS, "base_request": base_result, + "base_readiness": base_readiness, "results": result_receipts, } @@ -207,20 +288,22 @@ def replay( unrelated_future = pool.submit(_completion, endpoint, model, unrelated, timeout) receipts = [future.result() for future in futures] unrelated_receipt = unrelated_future.result() + response_mismatch_indices: list[int] = [] for index, item in enumerate(receipts): item["result_index"] = index if item["response_sha256"] != publish_receipt["results"][index][ "response_sha256" ]: - raise QualificationError(f"result {index} response differs from publication") + response_mismatch_indices.append(index) return { "schema": RECEIPT_SCHEMA, "kind": "replay", - "status": "verified", + "status": "rejected" if response_mismatch_indices else "verified", "model": model, "token_bank_sha256": _token_hash(bank), "results": receipts, "unrelated_later_request": unrelated_receipt, + "response_mismatch_indices": response_mismatch_indices, } @@ -315,17 +398,20 @@ def verify_evidence( image_id = image.get("id") if not isinstance(labels, dict) or not isinstance(image_id, str): raise QualificationError("artifact receipt omits labels or image ID") - if image_id != "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0": - raise QualificationError("artifact receipt is not the corrected exact image") + if re.fullmatch(r"sha256:[0-9a-f]{64}", image_id) is None: + raise QualificationError("artifact receipt omits an exact image ID") expected_labels = { - "org.sparkcache.source-revision": "5a6613e473a713695948e69e0027fd67530028f8", - "org.sparkcache.source-tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", - "org.sparkcache.source-sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", + "org.sparkcache.source-revision": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "org.sparkcache.source-tree": "4d5b8eb8c5c13793ee7a1e67b2b34bd38fcf4ddb", + "org.sparkcache.source-sha256": "6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b", "org.sparkcache.cuda-placement-library-sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", "org.sparkcache.feature.page-base-read-flight": ( "implemented-gpu-free-tested" ), "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.page-base-read-flight-singleton-later-cohorts": ( + "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" + ), "org.sparkcache.cache-namespace-impact": "none", "org.sparkcache.diagnostic-fix": ( "page-header-source-bytes-fix=229d7d6;" @@ -433,6 +519,8 @@ def main() -> int: command.add_argument("--output", type=Path, required=True) if name == "replay": command.add_argument("--publish-receipt", type=Path, required=True) + elif name == "publish": + command.add_argument("--scheduler-log", type=Path, required=True) inspect = subparsers.add_parser("inspect-manifests") inspect.add_argument("--manifest-root", type=Path, required=True) inspect.add_argument("--rank", type=int, choices=range(4), required=True) @@ -449,7 +537,7 @@ def main() -> int: if args.command == "semantic": document = semantic(args.endpoint, args.model, args.timeout) elif args.command == "publish": - document = publish(args.endpoint, args.model, args.timeout) + document = publish(args.endpoint, args.model, args.scheduler_log, args.timeout) elif args.command == "replay": document = replay( args.endpoint, diff --git a/performance/harnesses/glm53_page_base_flight/test_qualification.py b/performance/harnesses/glm53_page_base_flight/test_qualification.py index 3a1f7c3b..e442e220 100644 --- a/performance/harnesses/glm53_page_base_flight/test_qualification.py +++ b/performance/harnesses/glm53_page_base_flight/test_qualification.py @@ -2,8 +2,12 @@ import hashlib import json +import sys from pathlib import Path +import pytest + +import qualification from qualification import ( BASE_TOKENS, FLIGHT_SCHEMA, @@ -11,8 +15,11 @@ RECEIPT_SCHEMA, RESULT_TOKENS, TAIL_TOKENS, + QualificationError, inspect_manifests, + publish, prompts, + replay, verify_evidence, ) @@ -38,6 +45,172 @@ def test_prompt_geometry_is_exact_and_distinct() -> None: assert TAIL_TOKENS == 32768 +def _completion_receipt(tokens: list[int], response_sha256: str = "a" * 64) -> dict: + return { + "http_status": 200, + "prompt_tokens": len(tokens), + "prompt_sha256": hashlib.sha256(_canonical(tokens)).hexdigest(), + "response_sha256": response_sha256, + "completion_tokens": 1, + "finish_reason": "length", + "elapsed_seconds": 0.125, + } + + +def test_publish_waits_for_all_rank_held_digest_report_before_results( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + bank = list(range(100, 118)) + observed_lengths: list[int] = [] + scheduler_log = tmp_path / "scheduler.log" + scheduler_log.write_text( + "KV Transfer metrics: spark_cache_ranks_reporting=4, " + "spark_cache_digests_held=3\n", + encoding="utf-8", + ) + + monkeypatch.setattr(qualification, "discover_token_bank", lambda *_args: bank) + + def fake_completion( + _endpoint: str, _model: str, tokens: list[int], _timeout: float + ) -> dict: + observed_lengths.append(len(tokens)) + if len(tokens) == 2: + with scheduler_log.open("a", encoding="utf-8") as stream: + stream.write( + "KV Transfer metrics: spark_cache_ranks_reporting=4, " + "spark_cache_digests_held=4\n" + ) + return _completion_receipt(tokens) + + monkeypatch.setattr(qualification, "_completion", fake_completion) + + receipt = publish("http://rank0", "model", scheduler_log, 10.0) + + assert observed_lengths[:3] == [BASE_TOKENS + 1, 2, RESULT_TOKENS + 1] + assert observed_lengths[2:] == [RESULT_TOKENS + 1] * PARTICIPANTS + assert receipt["base_readiness"] == { + "status": "verified", + "required_ranks": 4, + "ranks_reporting": 4, + "digests_held": 4, + "scheduler_log_line_sha256": hashlib.sha256( + ( + "KV Transfer metrics: spark_cache_ranks_reporting=4, " + "spark_cache_digests_held=4" + ).encode() + ).hexdigest(), + "scheduler_step": _completion_receipt([bank[-2], bank[-1]]), + } + + +def test_publish_rejects_before_private_results_without_all_rank_holds( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + bank = list(range(100, 118)) + observed_lengths: list[int] = [] + scheduler_log = tmp_path / "scheduler.log" + scheduler_log.write_text("startup\n", encoding="utf-8") + monkeypatch.setattr(qualification, "discover_token_bank", lambda *_args: bank) + + def fake_completion( + _endpoint: str, _model: str, tokens: list[int], _timeout: float + ) -> dict: + observed_lengths.append(len(tokens)) + if len(tokens) == 2: + with scheduler_log.open("a", encoding="utf-8") as stream: + stream.write( + "KV Transfer metrics: spark_cache_ranks_reporting=4, " + "spark_cache_digests_held=3\n" + ) + return _completion_receipt(tokens) + + monkeypatch.setattr(qualification, "_completion", fake_completion) + + with pytest.raises(QualificationError, match="not held on all ranks"): + publish("http://rank0", "model", scheduler_log, 0.01) + assert observed_lengths == [BASE_TOKENS + 1, 2] + + +def test_replay_returns_complete_rejected_receipt_after_response_mismatches( + monkeypatch: pytest.MonkeyPatch, +) -> None: + bank = list(range(100, 118)) + _base, results, unrelated = prompts(bank) + published_results = [ + {"prompt_sha256": _completion_receipt(tokens)["prompt_sha256"], + "response_sha256": "a" * 64} + for tokens in results + ] + mismatch_prompt_sha256 = { + published_results[index]["prompt_sha256"] for index in (2, 11) + } + monkeypatch.setattr(qualification, "discover_token_bank", lambda *_args: bank) + + def fake_completion( + _endpoint: str, _model: str, tokens: list[int], _timeout: float + ) -> dict: + prompt_sha256 = _completion_receipt(tokens)["prompt_sha256"] + digest = "b" * 64 if prompt_sha256 in mismatch_prompt_sha256 else "a" * 64 + return _completion_receipt(tokens, digest) + + monkeypatch.setattr(qualification, "_completion", fake_completion) + receipt = replay( + "http://rank0", + "model", + {"results": published_results}, + 10.0, + ) + + assert receipt["status"] == "rejected" + assert receipt["response_mismatch_indices"] == [2, 11] + assert len(receipt["results"]) == PARTICIPANTS + assert [item["result_index"] for item in receipt["results"]] == list( + range(PARTICIPANTS) + ) + assert receipt["unrelated_later_request"]["prompt_sha256"] == ( + _completion_receipt(unrelated)["prompt_sha256"] + ) + + +def test_replay_cli_writes_rejected_receipt_before_nonzero_exit( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + output = tmp_path / "replay.json" + published = _write(tmp_path / "publish.json", {"results": []}) + rejected = { + "schema": RECEIPT_SCHEMA, + "kind": "replay", + "status": "rejected", + "results": [{"result_index": index} for index in range(PARTICIPANTS)], + "unrelated_later_request": {"http_status": 200}, + "response_mismatch_indices": [4], + } + monkeypatch.setattr(qualification, "replay", lambda *_args: rejected) + monkeypatch.setattr( + sys, + "argv", + [ + "qualification.py", + "replay", + "--endpoint", + "http://rank0", + "--model", + "model", + "--publish-receipt", + str(published), + "--output", + str(output), + ], + ) + + assert qualification.main() == 1 + assert json.loads(output.read_text(encoding="utf-8")) == rejected + + def test_manifest_inspection_requires_one_shared_base_and_private_deltas( tmp_path: Path, ) -> None: @@ -76,12 +249,15 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( tmp_path: Path, ) -> None: labels = { - "org.sparkcache.source-revision": "5a6613e473a713695948e69e0027fd67530028f8", - "org.sparkcache.source-tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", - "org.sparkcache.source-sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", + "org.sparkcache.source-revision": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "org.sparkcache.source-tree": "4d5b8eb8c5c13793ee7a1e67b2b34bd38fcf4ddb", + "org.sparkcache.source-sha256": "6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b", "org.sparkcache.cuda-placement-library-sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.page-base-read-flight-singleton-later-cohorts": ( + "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" + ), "org.sparkcache.cache-namespace-impact": "none", "org.sparkcache.diagnostic-fix": ( "page-header-source-bytes-fix=229d7d6;" @@ -94,7 +270,7 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( { "schema": "sparkcache-diagnostic-image-receipt/v1", "image": { - "id": "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0", + "id": "sha256:" + "1" * 64, "labels": labels, }, }, @@ -178,9 +354,7 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( ) assert verdict["schema"] == RECEIPT_SCHEMA assert verdict["status"] == "qualified" - assert verdict["image_id"] == ( - "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0" - ) + assert verdict["image_id"] == "sha256:" + "1" * 64 assert [item["verified_result_restores"] for item in verdict["rank_evidence"]] == [ 16, 16, diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md index 7a8b0e6b..16bc4dd6 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md @@ -5,7 +5,7 @@ Status: **implemented, not qualified**. This isolated image contract retains the vLLM, B12X, DFlash, recurrent publication, lease, and CUDA placement identities from SparkRing pull request #146 while installing SparkCache commit -`5a6613e473a713695948e69e0027fd67530028f8`. Its build receipt records the +`a1511d26a1fe2b17b24561bc52e376bf7f54b06a`. Its build receipt records the `sparkcache-page-base-restore-flight/v1` qualification contract. Live serving claims require the deterministic harness under `performance/harnesses/glm53_page_base_flight/`. @@ -13,7 +13,7 @@ claims require the deterministic harness under Build on Linux ARM64: ```bash -IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64' \ +IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singleton-arm64' \ BUILD_RECEIPT="$PWD/glm53-pr42-page-base-flight-image-receipt.json" \ bash runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh ``` diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh index 38c3d53f..31d59646 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh @@ -7,7 +7,7 @@ repo_root="$(git -C "${here}" rev-parse --show-toplevel)" pins="${here}/pins.json" shared_overlay="${repo_root}/runtime/glm53-flash-adaptive-mtp-python-overlay" engine="${CONTAINER_ENGINE:-docker}" -image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64}" +image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singleton-arm64}" receipt_path="${BUILD_RECEIPT:-${PWD}/glm53-pr42-page-base-flight-image-receipt.json}" fatal() { diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json index fcc62df7..247aaa61 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json @@ -18,7 +18,7 @@ }, "builder": { "arm_builder": "pytorch/manylinuxaarch64-builder@sha256:f91599c49f526c77d01b68286f2bf943a5fd6a432d7e3f0afcc5784825908fe9", - "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-sourcebytesfix-arm64" + "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singleton-arm64" }, "vllm": { "repository": "https://github.com/local-inference-lab/vllm.git", @@ -147,9 +147,9 @@ }, "sparkcache": { "repository": "https://github.com/FujitsuPolycom/sparkcache.git", - "commit": "5a6613e473a713695948e69e0027fd67530028f8", - "tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", - "source_tree_sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", + "commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "tree": "4d5b8eb8c5c13793ee7a1e67b2b34bd38fcf4ddb", + "source_tree_sha256": "6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b", "cuda_placement_library_sha256": "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c", "cuda_config_schema": "canonical-v1", "canonical_cuda_config_keys": [ @@ -220,7 +220,8 @@ "maximum_peak_reserved_bytes": 2147483648, "source_feature_commit": "6f3edede4b9f707ef9e8879359b05b0775ed5fee", "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01", - "artifact_receipt": { + "singleton_later_cohort_commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "historical_sourcebytesfix_artifact_receipt": { "schema": "sparkcache-sourcebytesfix-image-receipt/v1", "sha256": "31c226697752672cafe83b6d06793638fb64d6ad1abe9937edf89ee4814bca5a", "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-sourcebytesfix-arm64.json", diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py index 8fd14c9d..646481a6 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/prepare_context.py @@ -61,6 +61,7 @@ def _render_containerfile() -> str: marker + ' org.sparkcache.feature.page-base-read-flight="implemented-gpu-free-tested" \\\n' + ' org.sparkcache.feature.page-base-read-flight-pr="42" \\\n' + + ' org.sparkcache.page-base-read-flight-singleton-later-cohorts="a1511d26a1fe2b17b24561bc52e376bf7f54b06a" \\\n' + ' org.sparkcache.diagnostic-fix="page-header-source-bytes-fix=229d7d6;parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" \\\n' + ' org.sparkcache.page-header-source-bytes-fix="229d7d6" \\\n' + ' org.sparkcache.parent-image-id="sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8" \\\n' @@ -84,6 +85,8 @@ def _render_verify_image() -> str: + ' "org.sparkcache.feature.page-base-read-flight": ' + '"implemented-gpu-free-tested",\n' + ' "org.sparkcache.feature.page-base-read-flight-pr": "42",\n' + + ' "org.sparkcache.page-base-read-flight-singleton-later-cohorts": ' + + '"a1511d26a1fe2b17b24561bc52e376bf7f54b06a",\n' + ' "org.sparkcache.diagnostic-fix": ' + '"page-header-source-bytes-fix=229d7d6;parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f",\n' + ' "org.sparkcache.page-header-source-bytes-fix": "229d7d6",\n' diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py index 8c3c1d39..0b793962 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py @@ -25,10 +25,10 @@ def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: pins = json.loads(PINS.read_text(encoding="utf-8")) assert pins["sparkcache"] == { **pins["sparkcache"], - "commit": "5a6613e473a713695948e69e0027fd67530028f8", - "tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", + "commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "tree": "4d5b8eb8c5c13793ee7a1e67b2b34bd38fcf4ddb", "source_tree_sha256": ( - "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313" + "6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b" ), "cuda_placement_library_sha256": ( "d57509052b73853bcc8e3c3f47bb81748d87b9cbd8d908fc20d4c79a09aa400c" @@ -62,7 +62,8 @@ def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: "maximum_peak_reserved_bytes": 2147483648, "source_feature_commit": "6f3edede4b9f707ef9e8879359b05b0775ed5fee", "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01", - "artifact_receipt": { + "singleton_later_cohort_commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "historical_sourcebytesfix_artifact_receipt": { "schema": "sparkcache-sourcebytesfix-image-receipt/v1", "sha256": "31c226697752672cafe83b6d06793638fb64d6ad1abe9937edf89ee4814bca5a", "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-sourcebytesfix-arm64.json", @@ -97,6 +98,9 @@ def test_rendered_context_and_verifier_bind_feature_receipt_fields() -> None: "implemented-gpu-free-tested" ) assert labels["org.sparkcache.feature.page-base-read-flight-pr"] == "42" + assert labels[ + "org.sparkcache.page-base-read-flight-singleton-later-cohorts" + ] == "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" assert labels["org.sparkcache.diagnostic-fix"].startswith( "page-header-source-bytes-fix=229d7d6" ) @@ -105,6 +109,6 @@ def test_rendered_context_and_verifier_bind_feature_receipt_fields() -> None: def test_build_script_uses_isolated_default_outputs() -> None: script = (HERE / "build-image.sh").read_text(encoding="utf-8") - assert "dflash7-pr42-page-base-flight-sourcebytesfix-arm64" in script + assert "dflash7-pr42-page-base-flight-singleton-arm64" in script assert "glm53-pr42-page-base-flight-image-receipt.json" in script assert "runtime/glm53-flash-dflash7-pr42-page-base-flight" in script diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py index b82e2f09..264769c1 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/verify_image.py @@ -41,6 +41,9 @@ def expected_output_labels(pins: dict[str, Any]) -> dict[str, str]: "implemented-gpu-free-tested" ), "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.page-base-read-flight-singleton-later-cohorts": ( + "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" + ), "org.sparkcache.diagnostic-fix": ( "page-header-source-bytes-fix=229d7d6;" "parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f" diff --git a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json index e38a9d31..4d50c5e4 100644 --- a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json +++ b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json @@ -1,9 +1,9 @@ { "schema": "sparkring-runtime-profile/v1", - "profile_id": "glm53-flash-dflash7-pr42-page-base-flight-sourcebytesfix-fastsafetensors-sparkcache-tp4-dcp1", + "profile_id": "glm53-flash-dflash7-pr42-page-base-flight-singleton-fastsafetensors-sparkcache-tp4-dcp1", "model_family": "glm53-flash", "engine": "docker", - "container_name": "glm53-flash-dflash7-pr42-page-base-flight-sourcebytesfix-fastsafetensors-sparkcache-tp4", + "container_name": "glm53-flash-dflash7-pr42-page-base-flight-singleton-fastsafetensors-sparkcache-tp4", "image": "REPLACE_WITH_DFLASH7_PR42_PAGE_BASE_FLIGHT_IMAGE", "image_id": "sha256:0000000000000000000000000000000000000000000000000000000000000000", "model_host_path": "/REPLACE/TARGET_MODEL_HOST_PATH", @@ -51,7 +51,7 @@ }, "extra_vllm_args": [ "--served-model-name", - "glm-5.3-flash-nvfp4-dflash7-pr42-page-base-flight-sourcebytesfix-0b67266-on-da4d7be-b12x-b1d541f-tp4", + "glm-5.3-flash-nvfp4-dflash7-pr42-page-base-flight-singleton-0b67266-on-da4d7be-b12x-b1d541f-tp4", "--host", "0.0.0.0", "--pipeline-parallel-size", @@ -99,7 +99,7 @@ "--enable-prefix-caching", "--cudagraph-metrics", "--kv-transfer-config", - "{\"kv_connector\":\"SparkContextCacheConnector\",\"kv_connector_module_path\":\"sparkcache.spark_context_cache_connector\",\"kv_role\":\"kv_both\",\"kv_load_failure_policy\":\"recompute\",\"kv_connector_extra_config\":{\"spark_cache_root\":\"/cache/jit/sparkcache-context/dflash7-pr42-page-base-flight\",\"spark_cache_model_profile\":\"glm53-flash-hybrid\",\"spark_cache_publication_schema\":\"tail-cow-v1\",\"spark_cache_target_checkpoint_sha256\":\"a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9\",\"spark_cache_draft_checkpoint_sha256\":\"b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b\",\"spark_cache_draft_policy\":\"separate\",\"spark_cache_store\":true,\"spark_cache_restore\":true,\"spark_cache_scheduler_probe\":\"none\",\"spark_cache_streaming_snapshots\":false,\"spark_cache_cuda_restore\":true,\"spark_cache_max_bytes\":51539607552,\"spark_cache_low_watermark_bytes\":42949672960,\"spark_cache_ttl_seconds\":0,\"spark_cache_min_span_tokens\":4096,\"spark_cache_max_span_tokens\":524288,\"spark_cache_cuda_placement_library\":\"/opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so\",\"spark_cache_cuda_placement_library_sha256\":\"REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256\",\"spark_cache_cuda_placement_arena_bytes\":268435456,\"spark_cache_cuda_restore_io_workers\":8,\"spark_cache_load_threads\":2,\"spark_cache_clear_once\":\"sparkring-dflash7-pr42-page-base-flight-5a6613e-sourcebytesfix\"}}" + "{\"kv_connector\":\"SparkContextCacheConnector\",\"kv_connector_module_path\":\"sparkcache.spark_context_cache_connector\",\"kv_role\":\"kv_both\",\"kv_load_failure_policy\":\"recompute\",\"kv_connector_extra_config\":{\"spark_cache_root\":\"/cache/jit/sparkcache-context/dflash7-pr42-page-base-flight\",\"spark_cache_model_profile\":\"glm53-flash-hybrid\",\"spark_cache_publication_schema\":\"tail-cow-v1\",\"spark_cache_target_checkpoint_sha256\":\"a35e6bf2875c1875609b8deaec404c07c6cc80259e4222fc0b51e649498bd6b9\",\"spark_cache_draft_checkpoint_sha256\":\"b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b\",\"spark_cache_draft_policy\":\"separate\",\"spark_cache_store\":true,\"spark_cache_restore\":true,\"spark_cache_scheduler_probe\":\"none\",\"spark_cache_streaming_snapshots\":false,\"spark_cache_cuda_restore\":true,\"spark_cache_max_bytes\":51539607552,\"spark_cache_low_watermark_bytes\":42949672960,\"spark_cache_ttl_seconds\":0,\"spark_cache_min_span_tokens\":4096,\"spark_cache_max_span_tokens\":524288,\"spark_cache_cuda_placement_library\":\"/opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so\",\"spark_cache_cuda_placement_library_sha256\":\"REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256\",\"spark_cache_cuda_placement_arena_bytes\":268435456,\"spark_cache_cuda_restore_io_workers\":8,\"spark_cache_load_threads\":2,\"spark_cache_clear_once\":\"sparkring-dflash7-pr42-page-base-flight-a1511d26-singleton\"}}" ], "extra_volumes": [ { @@ -114,7 +114,7 @@ } ], "extra_labels": { - "org.sparkring.model-profile": "glm53-flash-dflash7-pr42-page-base-flight-sourcebytesfix-fastsafetensors-tp4-dcp1", + "org.sparkring.model-profile": "glm53-flash-dflash7-pr42-page-base-flight-singleton-fastsafetensors-tp4-dcp1", "org.sparkring.external-cache": "sparkcache", "org.sparkcache.publication-schema": "tail-cow-v1", "org.sparkring.speculator": "external-dflash7", @@ -150,9 +150,9 @@ "max_num_seqs": "32", "sparkcache_publication_schema": "tail-cow-v1", "sparkcache_effective_publication_schema": "page-tail-cow-v1", - "sparkcache_source_sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", - "sparkcache_source_revision": "5a6613e473a713695948e69e0027fd67530028f8", - "sparkcache_source_tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", + "sparkcache_source_sha256": "6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b", + "sparkcache_source_revision": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "sparkcache_source_tree": "4d5b8eb8c5c13793ee7a1e67b2b34bd38fcf4ddb", "vllm_native_revision": "da4d7be6c97434f6942292ed8abbf4b32dc44355", "vllm_python_revision": "0b67266a0f37d6146a8403fb8482403c62f412d5", "vllm_python_tree": "ba9484ccb33aa56e90ff2f447f15ca9b9da97639", @@ -164,7 +164,8 @@ "allowed_runtime_warnings": "modelopt_experimental_quantization,fp8_kv_cache_accuracy", "page_base_restore_flight_schema": "sparkcache-page-base-restore-flight/v1", "page_base_restore_flight_status": "implemented-unqualified", - "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01" + "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01", + "page_base_read_flight_singleton_commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" }, "required_image_labels": { "org.jovian.architecture": "linux-arm64-sm121", @@ -187,9 +188,9 @@ "org.sparkcache.deployment-profile": "glm53-flash-dflash7-python-overlay", "org.sparkcache.cuda-config-schema": "canonical-v1", "org.sparkcache.cuda-placement-library-sha256": "REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256", - "org.sparkcache.source-revision": "5a6613e473a713695948e69e0027fd67530028f8", - "org.sparkcache.source-tree": "5e74b3f9d484064d966ce6392dda1e0f7ff17190", - "org.sparkcache.source-sha256": "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313", + "org.sparkcache.source-revision": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "org.sparkcache.source-tree": "4d5b8eb8c5c13793ee7a1e67b2b34bd38fcf4ddb", + "org.sparkcache.source-sha256": "6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b", "org.sparkcache.vllm-contract-sha256": "8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9", "org.sparkring.runtime.removed-deep-ep-distribution": "deep_ep==2.0.0+local", "org.sparkring.runtime.deep-ep-removal-receipt-sha256": "65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3", @@ -199,6 +200,7 @@ "org.sparkring.nccl.patched-tree": "abdeb053b94c3f6d472cd55ae2b79ca821299009", "org.sparkcache.feature.page-base-read-flight": "implemented-gpu-free-tested", "org.sparkcache.feature.page-base-read-flight-pr": "42", + "org.sparkcache.page-base-read-flight-singleton-later-cohorts": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", "org.sparkcache.diagnostic-fix": "page-header-source-bytes-fix=229d7d6;parent=sha256:9f485c4408a56c0868c75f3e62b09432b2d908b5e4eb28915e0e6b4c4e4fe99f", "org.sparkcache.page-header-source-bytes-fix": "229d7d6", "org.sparkcache.parent-image-id": "sha256:ed60be066d6d9eadea267bc4597a0687869f3ddb95a3e5c6f86649893a838eb8", @@ -207,6 +209,6 @@ "attestation_hook": [ "/bin/sh", "-ec", - "test -f /models/target/config.json && test -f /models/target/model.safetensors.index.json && test \"$(sha256sum /models/target/config.json | cut -d ' ' -f1)\" = 676382abd1e90a6c85f0c8f33d45441ecd45fd514fd7b63ce5610e732d8e4996 && test \"$(sha256sum /models/target/model.safetensors.index.json | cut -d ' ' -f1)\" = 0d1d9e6b226e76520e182de10d4e7194cc885c5cb1bf885bb90de1916ce312cb && test -f /dflash-draft/config.json && test -f /dflash-draft/model.safetensors && test \"$(sha256sum /dflash-draft/config.json | cut -d ' ' -f1)\" = c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573 && test \"$(sha256sum /dflash-draft/model.safetensors | cut -d ' ' -f1)\" = b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b && test \"$(sha256sum /opt/sparkring/nccl/libnccl.so.2 | cut -d ' ' -f1)\" = 5f1c3f10d5ace66d4ba584415bbfe42b6ac1a0a9116a3b81dcbe50516ad924b3 && grep -q '\"tail-cow-v1\"' /opt/sparkcache-src/sparkcache/spark_context_cache_config.py && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/vllm-python-overlay.json | cut -d ' ' -f1)\" = e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/source-receipt.json | cut -d ' ' -f1)\" = REPLACE_WITH_SOURCE_RECEIPT_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_elf_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_ELF_MANIFEST_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_dispatch_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_DISPATCH_MANIFEST_SHA256 && test \"$(cat /opt/sparkring/runtime/python-overlay/sparkcache-source-tree.sha256)\" = 446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313 && test \"$(sha256sum /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json | cut -d ' ' -f1)\" = 8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9 && test \"$(sha256sum /opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so | cut -d ' ' -f1)\" = REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256 && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/deep-ep-removal-receipt.json | cut -d ' ' -f1)\" = 65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3 && python3 -c 'import importlib.util; assert importlib.util.find_spec(\"deep_ep\") is None' && python3 /opt/sparkcache-src/sparkcache/runtime_patches/verify_lease_contract.py --vllm-root /usr/local/lib/python3.12/dist-packages --contract /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json" + "test -f /models/target/config.json && test -f /models/target/model.safetensors.index.json && test \"$(sha256sum /models/target/config.json | cut -d ' ' -f1)\" = 676382abd1e90a6c85f0c8f33d45441ecd45fd514fd7b63ce5610e732d8e4996 && test \"$(sha256sum /models/target/model.safetensors.index.json | cut -d ' ' -f1)\" = 0d1d9e6b226e76520e182de10d4e7194cc885c5cb1bf885bb90de1916ce312cb && test -f /dflash-draft/config.json && test -f /dflash-draft/model.safetensors && test \"$(sha256sum /dflash-draft/config.json | cut -d ' ' -f1)\" = c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573 && test \"$(sha256sum /dflash-draft/model.safetensors | cut -d ' ' -f1)\" = b33c03475ba7322cf398828f2d8d1be376df30dc05c6b40c28c8ea8da23e410b && test \"$(sha256sum /opt/sparkring/nccl/libnccl.so.2 | cut -d ' ' -f1)\" = 5f1c3f10d5ace66d4ba584415bbfe42b6ac1a0a9116a3b81dcbe50516ad924b3 && grep -q '\"tail-cow-v1\"' /opt/sparkcache-src/sparkcache/spark_context_cache_config.py && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/vllm-python-overlay.json | cut -d ' ' -f1)\" = e5e528288b173399611a4930fecc4182b7208bc1564881d52ca5d2c5c4ae0f6a && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/source-receipt.json | cut -d ' ' -f1)\" = REPLACE_WITH_SOURCE_RECEIPT_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_elf_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_ELF_MANIFEST_SHA256 && test \"$(python3 -c 'import json; print(json.load(open(\"/opt/sparkring/runtime/python-overlay/retained-native.json\", encoding=\"utf-8\"))[\"native_dispatch_manifest_sha256\"])')\" = REPLACE_WITH_VLLM_NATIVE_DISPATCH_MANIFEST_SHA256 && test \"$(cat /opt/sparkring/runtime/python-overlay/sparkcache-source-tree.sha256)\" = 6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b && test \"$(sha256sum /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json | cut -d ' ' -f1)\" = 8adbdfa3fd4b06b213c3aab45255a0b039f1c9940a4b1fad0efd004d263227c9 && test \"$(sha256sum /opt/sparkcache-src/sparkcache/native/build-cuda/libspark_cache_placement.so | cut -d ' ' -f1)\" = REPLACE_WITH_CUDA_PLACEMENT_LIBRARY_SHA256 && test \"$(sha256sum /opt/sparkring/runtime/python-overlay/deep-ep-removal-receipt.json | cut -d ' ' -f1)\" = 65514f44829e7d176b0b2cacc9559ed22724e525b7041a8bcd4d2e02d1f372e3 && python3 -c 'import importlib.util; assert importlib.util.find_spec(\"deep_ep\") is None' && python3 /opt/sparkcache-src/sparkcache/runtime_patches/verify_lease_contract.py --vllm-root /usr/local/lib/python3.12/dist-packages --contract /opt/sparkcache-src/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json" ] } diff --git a/scripts/prepare_glm53_pr42_page_base_flight_profile.py b/scripts/prepare_glm53_pr42_page_base_flight_profile.py index d2ca1964..d6eac225 100644 --- a/scripts/prepare_glm53_pr42_page_base_flight_profile.py +++ b/scripts/prepare_glm53_pr42_page_base_flight_profile.py @@ -25,10 +25,10 @@ def _module(): base = _module() base.IMAGE_PLACEHOLDER = "REPLACE_WITH_DFLASH7_PR42_PAGE_BASE_FLIGHT_IMAGE" -base.SPARKCACHE_COMMIT = "5a6613e473a713695948e69e0027fd67530028f8" -base.SPARKCACHE_TREE = "5e74b3f9d484064d966ce6392dda1e0f7ff17190" +base.SPARKCACHE_COMMIT = "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" +base.SPARKCACHE_TREE = "4d5b8eb8c5c13793ee7a1e67b2b34bd38fcf4ddb" base.SPARKCACHE_SOURCE_SHA256 = ( - "446c5bdd5a3efae8a4c4955cfbb577be1d8672a91d47770db63115cb25889313" + "6651f2823c816fac93779cbca54a8f19c0ed262830953149f3a87d189d1f833b" ) _base_resolve = base.resolve diff --git a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py index ef1a7aca..8b160ebf 100644 --- a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py +++ b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py @@ -37,7 +37,7 @@ def test_pr42_profile_is_operationally_isolated_without_identity_geometry_change extra = transfer["kv_connector_extra_config"] assert extra["spark_cache_root"].endswith("dflash7-pr42-page-base-flight") assert extra["spark_cache_clear_once"] == ( - "sparkring-dflash7-pr42-page-base-flight-5a6613e-sourcebytesfix" + "sparkring-dflash7-pr42-page-base-flight-a1511d26-singleton" ) assert extra["spark_cache_publication_schema"] == "tail-cow-v1" assert extra["spark_cache_model_profile"] == "glm53-flash-hybrid" @@ -64,7 +64,7 @@ def test_pr42_profile_resolves_exact_source_and_feature_labels() -> None: ) assert resolved_site["runtime"]["container_image"] == resolved["image"] assert resolved["identity"]["sparkcache_source_revision"] == ( - "5a6613e473a713695948e69e0027fd67530028f8" + "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" ) labels = resolved["required_image_labels"] assert labels["org.sparkcache.deployment-profile"] == ( @@ -78,6 +78,9 @@ def test_pr42_profile_resolves_exact_source_and_feature_labels() -> None: "page-header-source-bytes-fix=229d7d6" ) assert labels["org.sparkcache.page-header-source-bytes-fix"] == "229d7d6" + assert labels[ + "org.sparkcache.page-base-read-flight-singleton-later-cohorts" + ] == "a1511d26a1fe2b17b24561bc52e376bf7f54b06a" assert labels["org.sparkcache.cuda-placement-library-sha256"] == ( DIGESTS["cuda_placement_library_sha256"] ) From 120250019f255b643b1a6795e7bc699a289f6e18 Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 10:32:51 -0500 Subject: [PATCH 5/9] Pin the verified PR42 singleton-flight image --- .../README.md | 10 ++++++- .../build-image.sh | 2 +- .../pins.json | 24 ++++++++++++++-- .../test_pr42_page_base_flight_contract.py | 28 ++++++++++++++++++- ...fetensors-sparkcache-tp4-dcp1.example.json | 4 +-- ...are_glm53_pr42_page_base_flight_profile.py | 7 +++++ 6 files changed, 67 insertions(+), 8 deletions(-) diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md index 16bc4dd6..ed40488a 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md @@ -13,7 +13,7 @@ claims require the deterministic harness under Build on Linux ARM64: ```bash -IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singleton-arm64' \ +IMAGE='sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64' \ BUILD_RECEIPT="$PWD/glm53-pr42-page-base-flight-image-receipt.json" \ bash runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh ``` @@ -21,3 +21,11 @@ bash runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh The builder contacts no serving host. A verified local image and receipt are construction evidence only; the runtime remains unqualified until the four-rank procedure is separately authorized and completed. + +The offline-verified ARM64 artifact is +`sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64` +with image ID +`sha256:35b58a7bf414059c65b8f74e4e4b17ee6a81b7008e1bffbc9bd298b5e08c739e`. +Its build receipt SHA-256 is +`ec51c5b99227fe14709977df026e25e3e60f220b81ae252155d048556e8ea90a`. +This construction evidence does not establish four-rank serving behavior. diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh index 31d59646..cd25dec2 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh @@ -7,7 +7,7 @@ repo_root="$(git -C "${here}" rev-parse --show-toplevel)" pins="${here}/pins.json" shared_overlay="${repo_root}/runtime/glm53-flash-adaptive-mtp-python-overlay" engine="${CONTAINER_ENGINE:-docker}" -image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singleton-arm64}" +image="${IMAGE:-sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64}" receipt_path="${BUILD_RECEIPT:-${PWD}/glm53-pr42-page-base-flight-image-receipt.json}" fatal() { diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json index 247aaa61..96f9112e 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json @@ -18,7 +18,7 @@ }, "builder": { "arm_builder": "pytorch/manylinuxaarch64-builder@sha256:f91599c49f526c77d01b68286f2bf943a5fd6a432d7e3f0afcc5784825908fe9", - "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singleton-arm64" + "output_name": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64" }, "vllm": { "repository": "https://github.com/local-inference-lab/vllm.git", @@ -221,6 +221,24 @@ "source_feature_commit": "6f3edede4b9f707ef9e8879359b05b0775ed5fee", "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01", "singleton_later_cohort_commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "singleton_artifact_receipt": { + "schema": "sparkcache-singletonfix-image-receipt/v1", + "sha256": "ec51c5b99227fe14709977df026e25e3e60f220b81ae252155d048556e8ea90a", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-singletonfix-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64", + "image_id": "sha256:35b58a7bf414059c65b8f74e4e4b17ee6a81b7008e1bffbc9bd298b5e08c739e", + "builder": "spark-aa42", + "parent_image_id": "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0", + "cache_namespace_impact": "none", + "archive_receipt": { + "schema": "sparkcache-singletonfix-archive-receipt/v1", + "path": "/home/code/image-build-receipts/pr42-singletonfix-archive-receipt.json", + "sha256": "729b220d050f67fa043c123c394aaa1e2353f31e9858e8d4c8b9c5d6d5203857", + "archive_path": "/var/tmp/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-singletonfix-arm64.35b58a7b.oci.tar", + "archive_sha256": "d6b29b2a3f8595a70890e1795a50c1d65951280f7a302a3b0e1edc0417e6ab55", + "archive_bytes": 20828999168 + } + }, "historical_sourcebytesfix_artifact_receipt": { "schema": "sparkcache-sourcebytesfix-image-receipt/v1", "sha256": "31c226697752672cafe83b6d06793638fb64d6ad1abe9937edf89ee4814bca5a", @@ -246,8 +264,8 @@ "TRITON_CACHE_DIR": "/cache/jit/triton/dflash7-pr42-page-base-flight" }, "outputs": { - "image": null, - "image_id": null, + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64", + "image_id": "sha256:35b58a7bf414059c65b8f74e4e4b17ee6a81b7008e1bffbc9bd298b5e08c739e", "image_digest": null, "native_elf_manifest_sha256": null, "native_dispatch_manifest_sha256": null, diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py index 0b793962..12cc48de 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py @@ -23,6 +23,14 @@ def _module(name: str, path: Path): def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: pins = json.loads(PINS.read_text(encoding="utf-8")) + assert pins["builder"]["output_name"] == ( + "sparkring-glm53-sparkcache:" + "dflash7-pr42-page-base-flight-singletonfix-arm64" + ) + assert pins["outputs"]["image"] == pins["builder"]["output_name"] + assert pins["outputs"]["image_id"] == ( + "sha256:35b58a7bf414059c65b8f74e4e4b17ee6a81b7008e1bffbc9bd298b5e08c739e" + ) assert pins["sparkcache"] == { **pins["sparkcache"], "commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", @@ -63,6 +71,24 @@ def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: "source_feature_commit": "6f3edede4b9f707ef9e8879359b05b0775ed5fee", "page_header_source_bytes_fix": "229d7d6158261e9510ab99d7e82d532abb9ade01", "singleton_later_cohort_commit": "a1511d26a1fe2b17b24561bc52e376bf7f54b06a", + "singleton_artifact_receipt": { + "schema": "sparkcache-singletonfix-image-receipt/v1", + "sha256": "ec51c5b99227fe14709977df026e25e3e60f220b81ae252155d048556e8ea90a", + "builder_path": "/home/code/image-build-receipts/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-singletonfix-arm64.json", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64", + "image_id": "sha256:35b58a7bf414059c65b8f74e4e4b17ee6a81b7008e1bffbc9bd298b5e08c739e", + "builder": "spark-aa42", + "parent_image_id": "sha256:cc2c0e2f812f4b78d5b91f863aaf46fd8e8e505844245aa50911af1fb8e061c0", + "cache_namespace_impact": "none", + "archive_receipt": { + "schema": "sparkcache-singletonfix-archive-receipt/v1", + "path": "/home/code/image-build-receipts/pr42-singletonfix-archive-receipt.json", + "sha256": "729b220d050f67fa043c123c394aaa1e2353f31e9858e8d4c8b9c5d6d5203857", + "archive_path": "/var/tmp/sparkring-glm53-sparkcache-dflash7-pr42-page-base-flight-singletonfix-arm64.35b58a7b.oci.tar", + "archive_sha256": "d6b29b2a3f8595a70890e1795a50c1d65951280f7a302a3b0e1edc0417e6ab55", + "archive_bytes": 20828999168, + }, + }, "historical_sourcebytesfix_artifact_receipt": { "schema": "sparkcache-sourcebytesfix-image-receipt/v1", "sha256": "31c226697752672cafe83b6d06793638fb64d6ad1abe9937edf89ee4814bca5a", @@ -109,6 +135,6 @@ def test_rendered_context_and_verifier_bind_feature_receipt_fields() -> None: def test_build_script_uses_isolated_default_outputs() -> None: script = (HERE / "build-image.sh").read_text(encoding="utf-8") - assert "dflash7-pr42-page-base-flight-singleton-arm64" in script + assert "dflash7-pr42-page-base-flight-singletonfix-arm64" in script assert "glm53-pr42-page-base-flight-image-receipt.json" in script assert "runtime/glm53-flash-dflash7-pr42-page-base-flight" in script diff --git a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json index 4d50c5e4..1e9577ec 100644 --- a/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json +++ b/scripts/config/glm53-flash-dflash7-pr42-page-base-flight-fastsafetensors-sparkcache-tp4-dcp1.example.json @@ -4,8 +4,8 @@ "model_family": "glm53-flash", "engine": "docker", "container_name": "glm53-flash-dflash7-pr42-page-base-flight-singleton-fastsafetensors-sparkcache-tp4", - "image": "REPLACE_WITH_DFLASH7_PR42_PAGE_BASE_FLIGHT_IMAGE", - "image_id": "sha256:0000000000000000000000000000000000000000000000000000000000000000", + "image": "sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64", + "image_id": "sha256:35b58a7bf414059c65b8f74e4e4b17ee6a81b7008e1bffbc9bd298b5e08c739e", "model_host_path": "/REPLACE/TARGET_MODEL_HOST_PATH", "model_container_path": "/models/target", "shm_size": "32g", diff --git a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py index 8b160ebf..cdd0fa5c 100644 --- a/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py +++ b/scripts/test_prepare_glm53_pr42_page_base_flight_profile.py @@ -30,6 +30,13 @@ def _argument(profile: dict, option: str) -> str: def test_pr42_profile_is_operationally_isolated_without_identity_geometry_change() -> None: profile = json.loads(PROFILE.read_text(encoding="utf-8")) + assert profile["image"] == ( + "sparkring-glm53-sparkcache:" + "dflash7-pr42-page-base-flight-singletonfix-arm64" + ) + assert profile["image_id"] == ( + "sha256:35b58a7bf414059c65b8f74e4e4b17ee6a81b7008e1bffbc9bd298b5e08c739e" + ) assert profile["profile_id"].startswith("glm53-flash-dflash7-pr42-page-base-flight") assert "pr42-page-base-flight" in profile["container_name"] assert "pr42-page-base-flight" in _argument(profile, "--served-model-name") From c39627054ff61a6c733a8a83e93042c14803c46f Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 11:30:07 -0500 Subject: [PATCH 6/9] Use stable codeword oracles for page-base qualification Construct exact-boundary prompts with lane-specific natural-language codeword instructions, qualify normalized oracle values instead of ambiguous raw next-token hashes, and retain raw hashes as diagnostics. Retry scheduler readiness through at most eight recorded sub-threshold requests before publishing private tails. Receipt schema v2 rejects older synthetic evidence. Cache identity and on-disk namespaces are unchanged. Validation: 13 focused tests and Ruff. --- .../glm53_page_base_flight/README.md | 19 +- .../glm53_page_base_flight/qualification.py | 268 +++++++++++++++--- .../test_qualification.py | 184 ++++++++++-- .../README.md | 2 +- 4 files changed, 408 insertions(+), 65 deletions(-) diff --git a/performance/harnesses/glm53_page_base_flight/README.md b/performance/harnesses/glm53_page_base_flight/README.md index 0126b6fc..17b75509 100644 --- a/performance/harnesses/glm53_page_base_flight/README.md +++ b/performance/harnesses/glm53_page_base_flight/README.md @@ -3,16 +3,21 @@ Status: **implemented, not qualified**. `qualification.py` publishes one 98,304-token base and sixteen independently -authenticated 131,072-token result roots with private 32,768-token tails. It -records prompt and response hashes without response content. It never starts, -stops, or restarts a service. +authenticated 131,072-token result roots with private 32,768-token tails. Each +private tail ends with an intact natural-language instruction naming one +single-token codeword. Publication and replay must return the lane's exact +codeword after Unicode normalization, surrounding-whitespace removal, and +case folding. Raw response hashes remain diagnostic evidence; speculative +decoding may change an ambiguous raw next token without proving cache-state +divergence. The harness never starts, stops, or restarts a service. Run `semantic` and capture rank 0's container log continuously to a local file before invoking `publish --scheduler-log PATH`. After the base commit, the -publisher submits one two-token scheduler step and reads only log bytes written -after publication began. It requires one `KV Transfer metrics` record with four -ranks reporting and four held digests before it submits any private-tail -request. Inspect each rank's isolated manifest root and retain the receipts. A +publisher submits bounded two-token scheduler steps and reads only log bytes +written after publication began. Every attempt is recorded. It requires one +`KV Transfer metrics` record with four ranks reporting and four held digests +before it submits any private-tail request. Inspect each rank's isolated +manifest root and retain the receipts. A service restart is a separate operator action and must not occur without authorization. After that action, run `replay`, capture bounded rank logs for only that cohort, and run `verify` with four manifest diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py index 4c82b34f..02c82039 100644 --- a/performance/harnesses/glm53_page_base_flight/qualification.py +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Produce and verify deterministic GLM-5.3 page-base-flight evidence.""" +"""Produce and verify GLM-5.3 page-base-flight evidence with stable oracles.""" from __future__ import annotations @@ -9,6 +9,7 @@ import json import re import time +import unicodedata import urllib.error import urllib.request from pathlib import Path @@ -22,7 +23,31 @@ TP_RANKS = 4 FLIGHT_SCHEMA = "sparkcache-page-base-restore-flight/v1" RESTORE_SCHEMA = "sparkcache-restore-timing/v1" -RECEIPT_SCHEMA = "sparkring-glm53-pr42-page-base-flight-qualification/v1" +RECEIPT_SCHEMA = "sparkring-glm53-pr42-page-base-flight-qualification/v2" +BASE_CODEWORD = "base" +LANE_CODEWORDS = ( + "red", + "blue", + "green", + "black", + "white", + "gold", + "silver", + "orange", + "purple", + "yellow", + "brown", + "gray", + "pink", + "cyan", + "coral", + "apple", +) +UNRELATED_CODEWORD = "quartz" +INSTRUCTION_TEMPLATE = "Reply with exactly the lowercase word {word}.\nAnswer:" +READINESS_RETRY_SECONDS = 1.0 +READINESS_MAX_ATTEMPTS = 8 +READINESS_TOTAL_SECONDS = 60.0 PROMPT_SEED = ( "SparkCache deterministic token bank: alpha beta gamma delta epsilon zeta " "eta theta iota kappa lambda mu nu xi omicron pi rho sigma tau upsilon." @@ -30,7 +55,7 @@ class QualificationError(RuntimeError): - """The deterministic qualification evidence is incomplete or contradictory.""" + """The qualification evidence is incomplete or contradictory.""" def _canonical(value: object) -> bytes: @@ -96,24 +121,93 @@ def discover_token_bank(endpoint: str, model: str, timeout: float) -> list[int]: return unique[: PARTICIPANTS + 2] -def prompts(token_bank: list[int]) -> tuple[list[int], list[list[int]], list[int]]: +def _instruction(word: str) -> str: + return INSTRUCTION_TEMPLATE.format(word=word) + + +def discover_instruction_tokens( + endpoint: str, model: str, timeout: float +) -> dict[str, list[int]]: + instructions: dict[str, list[int]] = {} + for word in (BASE_CODEWORD, *LANE_CODEWORDS, UNRELATED_CODEWORD): + document = _post( + endpoint, + "/tokenize", + {"model": model, "prompt": _instruction(word)}, + timeout, + ) + observed = document.get("tokens") or document.get("token_ids") + if ( + not isinstance(observed, list) + or len(observed) < 2 + or len(observed) > 64 + or any(not isinstance(value, int) or value < 0 for value in observed) + ): + raise QualificationError( + f"tokenizer returned an invalid instruction for {word!r}" + ) + instructions[word] = list(observed) + return instructions + + +def _prompt_spec_sha256(instructions: dict[str, list[int]]) -> str: + return _sha256( + _canonical( + { + "instruction_template": INSTRUCTION_TEMPLATE, + "base_codeword": BASE_CODEWORD, + "lane_codewords": LANE_CODEWORDS, + "unrelated_codeword": UNRELATED_CODEWORD, + "instruction_tokens": instructions, + } + ) + ) + + +def prompts( + token_bank: list[int], + instructions: dict[str, list[int]], +) -> tuple[list[int], list[list[int]], list[int]]: if len(token_bank) < PARTICIPANTS + 2: raise QualificationError("token bank must contain at least 18 distinct IDs") - common, terminator = token_bank[0], token_bank[-1] - base = [common] * BASE_TOKENS + [terminator] - results = [ - [common] * BASE_TOKENS + [token_bank[index + 1]] * TAIL_TOKENS + [terminator] - for index in range(PARTICIPANTS) - ] - unrelated = [token_bank[-2]] * 4096 + [terminator] + required_words = {BASE_CODEWORD, *LANE_CODEWORDS, UNRELATED_CODEWORD} + if set(instructions) != required_words: + raise QualificationError("instruction-token lanes are incomplete") + common = token_bank[0] + base_instruction = instructions[BASE_CODEWORD] + base_fill = BASE_TOKENS - len(base_instruction) + 1 + if base_fill <= 0: + raise QualificationError("base instruction exceeds the publication boundary") + base_prefix = [common] * base_fill + base_instruction[:-1] + base = base_prefix + [base_instruction[-1]] + results = [] + for index, word in enumerate(LANE_CODEWORDS): + instruction = instructions[word] + private_fill = TAIL_TOKENS - len(instruction) + 1 + if private_fill <= 0: + raise QualificationError(f"lane instruction {word!r} exceeds its tail") + results.append( + base_prefix + [token_bank[index + 1]] * private_fill + instruction + ) + unrelated_instruction = instructions[UNRELATED_CODEWORD] + unrelated_fill = 4096 - len(unrelated_instruction) + 1 + if unrelated_fill <= 0: + raise QualificationError("unrelated instruction exceeds its request boundary") + unrelated = [token_bank[-2]] * unrelated_fill + unrelated_instruction return base, results, unrelated +def _normalize_oracle(text: str) -> str: + return unicodedata.normalize("NFKC", text).strip().casefold() + + def _completion( endpoint: str, model: str, token_ids: list[int], timeout: float, + *, + expected_oracle: str | None = None, ) -> dict[str, Any]: started = time.perf_counter() response = _post( @@ -134,7 +228,7 @@ def _completion( if not isinstance(text, str): raise QualificationError("completion response omits text") usage = response.get("usage") or {} - return { + receipt = { "http_status": 200, "prompt_tokens": len(token_ids), "prompt_sha256": _token_hash(token_ids), @@ -143,6 +237,14 @@ def _completion( "finish_reason": choices[0].get("finish_reason"), "elapsed_seconds": round(time.perf_counter() - started, 6), } + if expected_oracle is not None: + observed_oracle = _normalize_oracle(text) + receipt.update( + expected_oracle=expected_oracle, + observed_oracle=observed_oracle, + oracle_match=observed_oracle == expected_oracle, + ) + return receipt def _confirm_base_held_on_all_ranks( @@ -153,18 +255,26 @@ def _confirm_base_held_on_all_ranks( scheduler_log_offset: int, timeout: float, ) -> dict[str, Any]: - # One request below SparkCache's publication threshold gives the scheduler - # a step in which to absorb the workers' post-commit held-digest reports. - scheduler_step = _completion( - endpoint, - model, - [token_bank[-2], token_bank[-1]], - timeout, - ) - deadline = time.monotonic() + timeout + deadline = time.monotonic() + min(timeout, READINESS_TOTAL_SECONDS) last_counts: tuple[int, int] | None = None matched_line: str | None = None + scheduler_steps: list[dict[str, Any]] = [] + next_trigger = 0.0 while time.monotonic() < deadline: + now = time.monotonic() + if now >= next_trigger and len(scheduler_steps) < READINESS_MAX_ATTEMPTS: + scheduler_steps.append( + { + "attempt": len(scheduler_steps) + 1, + **_completion( + endpoint, + model, + [token_bank[-2], token_bank[-1]], + timeout, + ), + } + ) + next_trigger = time.monotonic() + READINESS_RETRY_SECONDS try: size = scheduler_log.stat().st_size offset = scheduler_log_offset if size >= scheduler_log_offset else 0 @@ -202,7 +312,7 @@ def _confirm_base_held_on_all_ranks( "ranks_reporting": TP_RANKS, "digests_held": TP_RANKS, "scheduler_log_line_sha256": _sha256(matched_line.encode()), - "scheduler_step": scheduler_step, + "scheduler_steps": scheduler_steps, } @@ -217,8 +327,15 @@ def publish( except OSError as exc: raise QualificationError(f"scheduler log cannot be read: {scheduler_log}") from exc bank = discover_token_bank(endpoint, model, timeout) - base, results, _unrelated = prompts(bank) - base_result = _completion(endpoint, model, base, timeout) + instructions = discover_instruction_tokens(endpoint, model, timeout) + base, results, _unrelated = prompts(bank, instructions) + base_result = _completion( + endpoint, + model, + base, + timeout, + expected_oracle=BASE_CODEWORD, + ) base_readiness = _confirm_base_held_on_all_ranks( endpoint, model, @@ -228,21 +345,37 @@ def publish( timeout, ) result_receipts = [ - {"result_index": index, **_completion(endpoint, model, prompt, timeout)} - for index, prompt in enumerate(results) + { + "result_index": index, + **_completion( + endpoint, + model, + prompt, + timeout, + expected_oracle=word, + ), + } + for index, (prompt, word) in enumerate( + zip(results, LANE_CODEWORDS, strict=True) + ) + ] + oracle_mismatch_indices = [ + item["result_index"] for item in result_receipts if not item["oracle_match"] ] return { "schema": RECEIPT_SCHEMA, "kind": "publish", - "status": "observed", + "status": "rejected" if oracle_mismatch_indices else "observed", "model": model, "token_bank_sha256": _token_hash(bank), + "prompt_spec_sha256": _prompt_spec_sha256(instructions), "base_publication_tokens": BASE_TOKENS, "result_publication_tokens": RESULT_TOKENS, "private_tail_tokens": TAIL_TOKENS, "base_request": base_result, "base_readiness": base_readiness, "results": result_receipts, + "oracle_mismatch_indices": oracle_mismatch_indices, } @@ -274,36 +407,61 @@ def replay( timeout: float, ) -> dict[str, Any]: bank = discover_token_bank(endpoint, model, timeout) - _base, results, unrelated = prompts(bank) + instructions = discover_instruction_tokens(endpoint, model, timeout) + prompt_spec_sha256 = _prompt_spec_sha256(instructions) + if publish_receipt.get("prompt_spec_sha256") != prompt_spec_sha256: + raise QualificationError("prompt specification differs from publication") + _base, results, unrelated = prompts(bank, instructions) expected = [item["prompt_sha256"] for item in publish_receipt["results"]] observed = [_token_hash(item) for item in results] if observed != expected: raise QualificationError("reconstructed prompt hashes differ from publication") with concurrent.futures.ThreadPoolExecutor(max_workers=PARTICIPANTS + 1) as pool: futures = [ - pool.submit(_completion, endpoint, model, prompt, timeout) - for prompt in results + pool.submit( + _completion, + endpoint, + model, + prompt, + timeout, + expected_oracle=word, + ) + for prompt, word in zip(results, LANE_CODEWORDS, strict=True) ] time.sleep(0.05) - unrelated_future = pool.submit(_completion, endpoint, model, unrelated, timeout) + unrelated_future = pool.submit( + _completion, + endpoint, + model, + unrelated, + timeout, + expected_oracle=UNRELATED_CODEWORD, + ) receipts = [future.result() for future in futures] unrelated_receipt = unrelated_future.result() response_mismatch_indices: list[int] = [] + oracle_mismatch_indices: list[int] = [] for index, item in enumerate(receipts): item["result_index"] = index if item["response_sha256"] != publish_receipt["results"][index][ "response_sha256" ]: response_mismatch_indices.append(index) + if not item["oracle_match"]: + oracle_mismatch_indices.append(index) + if not unrelated_receipt["oracle_match"]: + oracle_mismatch_indices.append(PARTICIPANTS) return { "schema": RECEIPT_SCHEMA, "kind": "replay", - "status": "rejected" if response_mismatch_indices else "verified", + "status": "rejected" if oracle_mismatch_indices else "verified", "model": model, "token_bank_sha256": _token_hash(bank), + "prompt_spec_sha256": prompt_spec_sha256, "results": receipts, "unrelated_later_request": unrelated_receipt, "response_mismatch_indices": response_mismatch_indices, + "oracle_mismatch_indices": oracle_mismatch_indices, } @@ -428,8 +586,28 @@ def verify_evidence( raise QualificationError("artifact receipt contains a contradictory contract") if semantic_document.get("status") != "verified": raise QualificationError("semantic canary is not verified") + if published.get("schema") != RECEIPT_SCHEMA or replayed.get("schema") != RECEIPT_SCHEMA: + raise QualificationError("publication and replay require qualification schema v2") + readiness = published.get("base_readiness") + if not isinstance(readiness, dict) or readiness.get("status") != "verified": + raise QualificationError("base publication readiness is not verified") + scheduler_steps = readiness.get("scheduler_steps") + if ( + not isinstance(scheduler_steps, list) + or not scheduler_steps + or len(scheduler_steps) > READINESS_MAX_ATTEMPTS + or [item.get("attempt") for item in scheduler_steps] + != list(range(1, len(scheduler_steps) + 1)) + ): + raise QualificationError("base readiness scheduler attempts are incomplete") if replayed.get("status") != "verified": raise QualificationError("replay receipt is not verified") + if published.get("prompt_spec_sha256") != replayed.get("prompt_spec_sha256"): + raise QualificationError("publication and replay prompt specifications differ") + if published.get("oracle_mismatch_indices") or replayed.get( + "oracle_mismatch_indices" + ): + raise QualificationError("publication or replay has an oracle mismatch") published_results = published.get("results", []) replayed_results = replayed.get("results", []) if len(published_results) != PARTICIPANTS or len(replayed_results) != PARTICIPANTS: @@ -438,10 +616,28 @@ def verify_evidence( item["prompt_sha256"] for item in replayed_results ]: raise QualificationError("publication and replay prompt hashes differ") - if [item["response_sha256"] for item in published_results] != [ - item["response_sha256"] for item in replayed_results - ]: - raise QualificationError("publication and replay response hashes differ") + for index, word in enumerate(LANE_CODEWORDS): + for label, item in ( + ("publication", published_results[index]), + ("replay", replayed_results[index]), + ): + if ( + item.get("expected_oracle") != word + or item.get("observed_oracle") != word + or item.get("oracle_match") is not True + ): + raise QualificationError( + f"{label} result {index} does not match oracle {word!r}" + ) + unrelated = replayed.get("unrelated_later_request") + if ( + not isinstance(unrelated, dict) + or unrelated.get("http_status") != 200 + or unrelated.get("expected_oracle") != UNRELATED_CODEWORD + or unrelated.get("observed_oracle") != UNRELATED_CODEWORD + or unrelated.get("oracle_match") is not True + ): + raise QualificationError("unrelated request oracle is not verified") manifests = [json.loads(path.read_text(encoding="utf-8")) for path in manifest_receipts] if len(manifests) != 4 or any(item.get("status") != "verified" for item in manifests): raise QualificationError("four verified rank manifest receipts are required") diff --git a/performance/harnesses/glm53_page_base_flight/test_qualification.py b/performance/harnesses/glm53_page_base_flight/test_qualification.py index e442e220..13671c22 100644 --- a/performance/harnesses/glm53_page_base_flight/test_qualification.py +++ b/performance/harnesses/glm53_page_base_flight/test_qualification.py @@ -9,12 +9,15 @@ import qualification from qualification import ( + BASE_CODEWORD, BASE_TOKENS, FLIGHT_SCHEMA, + LANE_CODEWORDS, PARTICIPANTS, RECEIPT_SCHEMA, RESULT_TOKENS, TAIL_TOKENS, + UNRELATED_CODEWORD, QualificationError, inspect_manifests, publish, @@ -24,6 +27,11 @@ ) +def _instructions() -> dict[str, list[int]]: + words = (BASE_CODEWORD, *LANE_CODEWORDS, UNRELATED_CODEWORD) + return {word: [900 + index, 999] for index, word in enumerate(words)} + + def _write(path: Path, value: object) -> Path: path.write_text(json.dumps(value), encoding="utf-8") return path @@ -34,19 +42,33 @@ def _canonical(value: object) -> bytes: def test_prompt_geometry_is_exact_and_distinct() -> None: - base, results, unrelated = prompts(list(range(100, 118))) + instructions = _instructions() + base, results, unrelated = prompts(list(range(100, 118)), instructions) assert len(base) == BASE_TOKENS + 1 assert len(results) == PARTICIPANTS assert all(len(result) == RESULT_TOKENS + 1 for result in results) assert all(result[:BASE_TOKENS] == base[:BASE_TOKENS] for result in results) + assert all( + result[-len(instructions[word]) :] == instructions[word] + for result, word in zip(results, LANE_CODEWORDS, strict=True) + ) + assert all(result[BASE_TOKENS] == 101 + index for index, result in enumerate(results)) + assert base[-len(instructions[BASE_CODEWORD]) :] == instructions[BASE_CODEWORD] + assert unrelated[-len(instructions[UNRELATED_CODEWORD]) :] == instructions[ + UNRELATED_CODEWORD + ] assert len({hashlib.sha256(_canonical(result)).hexdigest() for result in results}) == 16 assert len(unrelated) == 4097 assert unrelated[:4096] != base[:4096] assert TAIL_TOKENS == 32768 -def _completion_receipt(tokens: list[int], response_sha256: str = "a" * 64) -> dict: - return { +def _completion_receipt( + tokens: list[int], + response_sha256: str = "a" * 64, + expected_oracle: str | None = None, +) -> dict: + receipt = { "http_status": 200, "prompt_tokens": len(tokens), "prompt_sha256": hashlib.sha256(_canonical(tokens)).hexdigest(), @@ -55,6 +77,13 @@ def _completion_receipt(tokens: list[int], response_sha256: str = "a" * 64) -> d "finish_reason": "length", "elapsed_seconds": 0.125, } + if expected_oracle is not None: + receipt.update( + expected_oracle=expected_oracle, + observed_oracle=expected_oracle, + oracle_match=True, + ) + return receipt def test_publish_waits_for_all_rank_held_digest_report_before_results( @@ -62,6 +91,7 @@ def test_publish_waits_for_all_rank_held_digest_report_before_results( monkeypatch: pytest.MonkeyPatch, ) -> None: bank = list(range(100, 118)) + instructions = _instructions() observed_lengths: list[int] = [] scheduler_log = tmp_path / "scheduler.log" scheduler_log.write_text( @@ -71,25 +101,36 @@ def test_publish_waits_for_all_rank_held_digest_report_before_results( ) monkeypatch.setattr(qualification, "discover_token_bank", lambda *_args: bank) + monkeypatch.setattr( + qualification, "discover_instruction_tokens", lambda *_args: instructions + ) + scheduler_attempts = 0 def fake_completion( - _endpoint: str, _model: str, tokens: list[int], _timeout: float + _endpoint: str, + _model: str, + tokens: list[int], + _timeout: float, + *, + expected_oracle: str | None = None, ) -> dict: + nonlocal scheduler_attempts observed_lengths.append(len(tokens)) if len(tokens) == 2: + scheduler_attempts += 1 with scheduler_log.open("a", encoding="utf-8") as stream: stream.write( "KV Transfer metrics: spark_cache_ranks_reporting=4, " - "spark_cache_digests_held=4\n" + f"spark_cache_digests_held={3 if scheduler_attempts == 1 else 4}\n" ) - return _completion_receipt(tokens) + return _completion_receipt(tokens, expected_oracle=expected_oracle) monkeypatch.setattr(qualification, "_completion", fake_completion) receipt = publish("http://rank0", "model", scheduler_log, 10.0) - assert observed_lengths[:3] == [BASE_TOKENS + 1, 2, RESULT_TOKENS + 1] - assert observed_lengths[2:] == [RESULT_TOKENS + 1] * PARTICIPANTS + assert observed_lengths[:4] == [BASE_TOKENS + 1, 2, 2, RESULT_TOKENS + 1] + assert observed_lengths[3:] == [RESULT_TOKENS + 1] * PARTICIPANTS assert receipt["base_readiness"] == { "status": "verified", "required_ranks": 4, @@ -101,8 +142,12 @@ def fake_completion( "spark_cache_digests_held=4" ).encode() ).hexdigest(), - "scheduler_step": _completion_receipt([bank[-2], bank[-1]]), + "scheduler_steps": [ + {"attempt": 1, **_completion_receipt([bank[-2], bank[-1]])}, + {"attempt": 2, **_completion_receipt([bank[-2], bank[-1]])}, + ], } + assert all(item["oracle_match"] for item in receipt["results"]) def test_publish_rejects_before_private_results_without_all_rank_holds( @@ -110,13 +155,22 @@ def test_publish_rejects_before_private_results_without_all_rank_holds( monkeypatch: pytest.MonkeyPatch, ) -> None: bank = list(range(100, 118)) + instructions = _instructions() observed_lengths: list[int] = [] scheduler_log = tmp_path / "scheduler.log" scheduler_log.write_text("startup\n", encoding="utf-8") monkeypatch.setattr(qualification, "discover_token_bank", lambda *_args: bank) + monkeypatch.setattr( + qualification, "discover_instruction_tokens", lambda *_args: instructions + ) def fake_completion( - _endpoint: str, _model: str, tokens: list[int], _timeout: float + _endpoint: str, + _model: str, + tokens: list[int], + _timeout: float, + *, + expected_oracle: str | None = None, ) -> dict: observed_lengths.append(len(tokens)) if len(tokens) == 2: @@ -125,7 +179,7 @@ def fake_completion( "KV Transfer metrics: spark_cache_ranks_reporting=4, " "spark_cache_digests_held=3\n" ) - return _completion_receipt(tokens) + return _completion_receipt(tokens, expected_oracle=expected_oracle) monkeypatch.setattr(qualification, "_completion", fake_completion) @@ -134,38 +188,56 @@ def fake_completion( assert observed_lengths == [BASE_TOKENS + 1, 2] -def test_replay_returns_complete_rejected_receipt_after_response_mismatches( +def test_replay_accepts_raw_hash_drift_when_lane_oracles_match( monkeypatch: pytest.MonkeyPatch, ) -> None: bank = list(range(100, 118)) - _base, results, unrelated = prompts(bank) + instructions = _instructions() + _base, results, unrelated = prompts(bank, instructions) published_results = [ - {"prompt_sha256": _completion_receipt(tokens)["prompt_sha256"], - "response_sha256": "a" * 64} - for tokens in results + { + "prompt_sha256": _completion_receipt(tokens)["prompt_sha256"], + "response_sha256": "a" * 64, + "expected_oracle": word, + "observed_oracle": word, + "oracle_match": True, + } + for tokens, word in zip(results, LANE_CODEWORDS, strict=True) ] mismatch_prompt_sha256 = { published_results[index]["prompt_sha256"] for index in (2, 11) } monkeypatch.setattr(qualification, "discover_token_bank", lambda *_args: bank) + monkeypatch.setattr( + qualification, "discover_instruction_tokens", lambda *_args: instructions + ) def fake_completion( - _endpoint: str, _model: str, tokens: list[int], _timeout: float + _endpoint: str, + _model: str, + tokens: list[int], + _timeout: float, + *, + expected_oracle: str | None = None, ) -> dict: prompt_sha256 = _completion_receipt(tokens)["prompt_sha256"] digest = "b" * 64 if prompt_sha256 in mismatch_prompt_sha256 else "a" * 64 - return _completion_receipt(tokens, digest) + return _completion_receipt(tokens, digest, expected_oracle) monkeypatch.setattr(qualification, "_completion", fake_completion) receipt = replay( "http://rank0", "model", - {"results": published_results}, + { + "prompt_spec_sha256": qualification._prompt_spec_sha256(instructions), + "results": published_results, + }, 10.0, ) - assert receipt["status"] == "rejected" + assert receipt["status"] == "verified" assert receipt["response_mismatch_indices"] == [2, 11] + assert receipt["oracle_mismatch_indices"] == [] assert len(receipt["results"]) == PARTICIPANTS assert [item["result_index"] for item in receipt["results"]] == list( range(PARTICIPANTS) @@ -175,6 +247,56 @@ def fake_completion( ) +def test_replay_returns_complete_rejected_receipt_after_oracle_mismatch( + monkeypatch: pytest.MonkeyPatch, +) -> None: + bank = list(range(100, 118)) + instructions = _instructions() + _base, results, _unrelated = prompts(bank, instructions) + published_results = [ + { + "prompt_sha256": _completion_receipt(tokens)["prompt_sha256"], + "response_sha256": "a" * 64, + "expected_oracle": word, + "observed_oracle": word, + "oracle_match": True, + } + for tokens, word in zip(results, LANE_CODEWORDS, strict=True) + ] + monkeypatch.setattr(qualification, "discover_token_bank", lambda *_args: bank) + monkeypatch.setattr( + qualification, "discover_instruction_tokens", lambda *_args: instructions + ) + + def fake_completion( + _endpoint: str, + _model: str, + tokens: list[int], + _timeout: float, + *, + expected_oracle: str | None = None, + ) -> dict: + receipt = _completion_receipt(tokens, expected_oracle=expected_oracle) + if expected_oracle == LANE_CODEWORDS[6]: + receipt.update(observed_oracle="spark", oracle_match=False) + return receipt + + monkeypatch.setattr(qualification, "_completion", fake_completion) + receipt = replay( + "http://rank0", + "model", + { + "prompt_spec_sha256": qualification._prompt_spec_sha256(instructions), + "results": published_results, + }, + 10.0, + ) + + assert receipt["status"] == "rejected" + assert receipt["oracle_mismatch_indices"] == [6] + assert len(receipt["results"]) == PARTICIPANTS + + def test_replay_cli_writes_rejected_receipt_before_nonzero_exit( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, @@ -289,19 +411,39 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( "http_status": 200, "prompt_sha256": f"{index + 1:064x}", "response_sha256": f"{index + 101:064x}", + "expected_oracle": LANE_CODEWORDS[index], + "observed_oracle": LANE_CODEWORDS[index], + "oracle_match": True, } for index in range(PARTICIPANTS) ] - published = _write(tmp_path / "publish.json", {"results": results}) + published = _write( + tmp_path / "publish.json", + { + "schema": RECEIPT_SCHEMA, + "prompt_spec_sha256": "c" * 64, + "base_readiness": { + "status": "verified", + "scheduler_steps": [{"attempt": 1}], + }, + "results": results, + }, + ) replayed = _write( tmp_path / "replay.json", { + "schema": RECEIPT_SCHEMA, "status": "verified", + "prompt_spec_sha256": "c" * 64, + "oracle_mismatch_indices": [], "results": results, "unrelated_later_request": { "http_status": 200, "prompt_sha256": "f" * 64, "response_sha256": "0" * 64, + "expected_oracle": UNRELATED_CODEWORD, + "observed_oracle": UNRELATED_CODEWORD, + "oracle_match": True, }, }, ) diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md index ed40488a..a3ca78c1 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md @@ -7,7 +7,7 @@ publication, lease, and CUDA placement identities from SparkRing pull request #146 while installing SparkCache commit `a1511d26a1fe2b17b24561bc52e376bf7f54b06a`. Its build receipt records the `sparkcache-page-base-restore-flight/v1` qualification contract. Live serving -claims require the deterministic harness under +claims require the codeword-oracle harness under `performance/harnesses/glm53_page_base_flight/`. Build on Linux ARM64: From fcff3ee82939c7acd081440c7245c6debee99d1a Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 11:42:47 -0500 Subject: [PATCH 7/9] Strengthen long-context codeword instructions Repeat each lane's required codeword immediately before the completion cue so the oracle remains stable after a 32,768-token private tail. Five previously unstable lanes returned their exact codewords at the full 131,072-token geometry. Cache identity and storage formats are unchanged. Validation: 13 focused tests and Ruff. --- performance/harnesses/glm53_page_base_flight/qualification.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py index 02c82039..aad3a723 100644 --- a/performance/harnesses/glm53_page_base_flight/qualification.py +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -44,7 +44,9 @@ "apple", ) UNRELATED_CODEWORD = "quartz" -INSTRUCTION_TEMPLATE = "Reply with exactly the lowercase word {word}.\nAnswer:" +INSTRUCTION_TEMPLATE = ( + "The required answer is {word}. Reply with exactly {word}.\nAnswer:" +) READINESS_RETRY_SECONDS = 1.0 READINESS_MAX_ATTEMPTS = 8 READINESS_TOTAL_SECONDS = 60.0 From bcaa2e7a060e6d16b8be135a435c0864ca4d128c Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 11:53:29 -0500 Subject: [PATCH 8/9] Preserve the proven shared-base prompt Use the original stable base instruction while retaining the strengthened lane instructions that passed the five full-length private-tail controls. This keeps the 98,304-token shared base identical to the successful control geometry. Cache identity and storage formats are unchanged. Validation: 13 focused tests and Ruff. --- .../harnesses/glm53_page_base_flight/qualification.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py index aad3a723..6bf50487 100644 --- a/performance/harnesses/glm53_page_base_flight/qualification.py +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -44,7 +44,8 @@ "apple", ) UNRELATED_CODEWORD = "quartz" -INSTRUCTION_TEMPLATE = ( +BASE_INSTRUCTION_TEMPLATE = "Reply with exactly the lowercase word {word}.\nAnswer:" +LANE_INSTRUCTION_TEMPLATE = ( "The required answer is {word}. Reply with exactly {word}.\nAnswer:" ) READINESS_RETRY_SECONDS = 1.0 @@ -124,7 +125,10 @@ def discover_token_bank(endpoint: str, model: str, timeout: float) -> list[int]: def _instruction(word: str) -> str: - return INSTRUCTION_TEMPLATE.format(word=word) + template = ( + BASE_INSTRUCTION_TEMPLATE if word == BASE_CODEWORD else LANE_INSTRUCTION_TEMPLATE + ) + return template.format(word=word) def discover_instruction_tokens( @@ -156,7 +160,8 @@ def _prompt_spec_sha256(instructions: dict[str, list[int]]) -> str: return _sha256( _canonical( { - "instruction_template": INSTRUCTION_TEMPLATE, + "base_instruction_template": BASE_INSTRUCTION_TEMPLATE, + "lane_instruction_template": LANE_INSTRUCTION_TEMPLATE, "base_codeword": BASE_CODEWORD, "lane_codewords": LANE_CODEWORDS, "unrelated_codeword": UNRELATED_CODEWORD, From 5781951088d10b20a89f4d8fa7873804443b93dd Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 12:55:49 -0500 Subject: [PATCH 9/9] Record PR42 page-delta results as research evidence --- .../glm53_page_base_flight/README.md | 71 +++++++++++-------- .../glm53_page_base_flight/qualification.py | 6 +- .../test_qualification.py | 5 +- .../README.md | 23 ++++-- .../pins.json | 33 ++++++++- .../test_pr42_page_base_flight_contract.py | 32 +++++++++ 6 files changed, 127 insertions(+), 43 deletions(-) diff --git a/performance/harnesses/glm53_page_base_flight/README.md b/performance/harnesses/glm53_page_base_flight/README.md index 17b75509..88bde4e3 100644 --- a/performance/harnesses/glm53_page_base_flight/README.md +++ b/performance/harnesses/glm53_page_base_flight/README.md @@ -1,31 +1,40 @@ -# GLM-5.3 opaque-page base-flight qualification - -Status: **implemented, not qualified**. - -`qualification.py` publishes one 98,304-token base and sixteen independently -authenticated 131,072-token result roots with private 32,768-token tails. Each -private tail ends with an intact natural-language instruction naming one -single-token codeword. Publication and replay must return the lane's exact -codeword after Unicode normalization, surrounding-whitespace removal, and -case folding. Raw response hashes remain diagnostic evidence; speculative -decoding may change an ambiguous raw next token without proving cache-state -divergence. The harness never starts, stops, or restarts a service. - -Run `semantic` and capture rank 0's container log continuously to a local file -before invoking `publish --scheduler-log PATH`. After the base commit, the -publisher submits bounded two-token scheduler steps and reads only log bytes -written after publication began. Every attempt is recorded. It requires one -`KV Transfer metrics` record with four ranks reporting and four held digests -before it submits any private-tail request. Inspect each rank's isolated -manifest root and retain the receipts. A -service restart is a separate operator action and -must not occur without authorization. After that action, run `replay`, capture -bounded rank logs for only that cohort, and run `verify` with four manifest -receipts and four logs. The verifier requires one -`sparkcache-page-base-restore-flight/v1` summary per rank with 16 participants, -one physical base read, 15 avoided reads, and outcome `verified`, plus 16 -independently verified result restores on every rank. - -The unrelated request submitted after the cohort uses no common prefix and -must complete successfully. This is a bounded isolation check, not a latency -claim. +# GLM-5.3 opaque-page base-flight research evidence + +Status: **research-only**. + +SparkCache's persistent base-segment I/O mechanism is **implemented** and has +GPU-free regression coverage. The retained live observations do not qualify +page-delta restore for GLM-5.3 serving. + +## Retained observations + +| Condition | Mechanical result | Semantic result | Conclusion | +|---|---|---|---| +| Sixteen concurrent 131,072-token page-delta requests with one shared 98,304-token base | Every rank emitted one `sparkcache-page-base-restore-flight/v1` record with 16 participants, one physical base read, and 15 avoided reads | Codeword responses were not reliable | Host-I/O coalescing worked, but the workload exceeded the 20 GiB GLM hybrid-cache residency available per rank and cannot support a correctness claim | +| Two concurrent 131,072-token page-delta requests within resident capacity | One admitted restored request returned the wrong codeword; a request recomputed without admitted restore returned the correct codeword | The failure occurred with both SparkCache CUDA placement enabled and disabled | The defect is in a path common to reconstructed page-delta restore; the evidence does not isolate CUDA placement | +| One 131,072-token flat snapshot stored as 13 authenticated macro objects | Restore completed in 1.55–1.70 seconds | The exact `red` codeword was returned | Full-snapshot restore is the verified operational fallback for this evidence scope | + +The mechanism evidence proves bounded host reads, authenticated manifests, and +request accounting. It does not prove that reconstructed page-delta state is +safe to admit for GLM-5.3 generation. + +## Harness contract + +`qualification.py` is retained as a deterministic research harness. It uses +stable single-token codeword oracles, records raw response hashes as diagnostic +data, and never starts, stops, or restarts a service. A mechanically complete +verdict has `kind=research-verdict` and `status=research-only`; the harness +cannot emit a qualification status. + +Publication records the rank-0 scheduler-log offset before the base request. +It submits bounded two-token scheduler steps and reads only later log bytes +until one `KV Transfer metrics` record reports four ranks and four held +digests. This readiness check remains required before private-tail requests. + +Replay collects every result and the unrelated later request before returning. +It preserves rejected receipts and exits nonzero after writing them. Manifest +inspection and bounded rank logs remain required to associate responses with +the exact page-delta roots and base-flight records. + +The 16 × 131,072-token case is retained to reproduce the observed mechanical +coalescing and residency failure. It is not a supported qualification workload. diff --git a/performance/harnesses/glm53_page_base_flight/qualification.py b/performance/harnesses/glm53_page_base_flight/qualification.py index 6bf50487..f64c3983 100644 --- a/performance/harnesses/glm53_page_base_flight/qualification.py +++ b/performance/harnesses/glm53_page_base_flight/qualification.py @@ -697,8 +697,8 @@ def verify_evidence( ] return { "schema": RECEIPT_SCHEMA, - "kind": "qualification-verdict", - "status": "qualified", + "kind": "research-verdict", + "status": "research-only", "image_id": image_id, "sparkcache_revision": labels["org.sparkcache.source-revision"], "semantic_prompt_sha256": semantic_document["prompt_sha256"], @@ -763,7 +763,7 @@ def main() -> int: ) _write(args.output, document) print(json.dumps(document, indent=2, sort_keys=True)) - return 0 if document.get("status") in {"observed", "verified", "qualified"} else 1 + return 0 if document.get("status") in {"observed", "verified", "research-only"} else 1 if __name__ == "__main__": diff --git a/performance/harnesses/glm53_page_base_flight/test_qualification.py b/performance/harnesses/glm53_page_base_flight/test_qualification.py index 13671c22..d463eca6 100644 --- a/performance/harnesses/glm53_page_base_flight/test_qualification.py +++ b/performance/harnesses/glm53_page_base_flight/test_qualification.py @@ -367,7 +367,7 @@ def test_manifest_inspection_requires_one_shared_base_and_private_deltas( assert len(receipt["delta_sha256"]) == 16 -def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( +def test_verdict_records_research_evidence_for_complete_mechanical_inputs( tmp_path: Path, ) -> None: labels = { @@ -495,7 +495,8 @@ def test_verdict_requires_one_flight_and_sixteen_result_restores_per_rank( logs, ) assert verdict["schema"] == RECEIPT_SCHEMA - assert verdict["status"] == "qualified" + assert verdict["kind"] == "research-verdict" + assert verdict["status"] == "research-only" assert verdict["image_id"] == "sha256:" + "1" * 64 assert [item["verified_result_restores"] for item in verdict["rank_evidence"]] == [ 16, diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md index a3ca78c1..0533fbf6 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/README.md @@ -1,14 +1,14 @@ # GLM-5.3 DFlash7 SparkCache PR42 image -Status: **implemented, not qualified**. +Status: **implemented construction; research-only serving evidence**. This isolated image contract retains the vLLM, B12X, DFlash, recurrent publication, lease, and CUDA placement identities from SparkRing pull request #146 while installing SparkCache commit `a1511d26a1fe2b17b24561bc52e376bf7f54b06a`. Its build receipt records the -`sparkcache-page-base-restore-flight/v1` qualification contract. Live serving -claims require the codeword-oracle harness under -`performance/harnesses/glm53_page_base_flight/`. +`sparkcache-page-base-restore-flight/v1` research contract. The codeword-oracle +harness under `performance/harnesses/glm53_page_base_flight/` records mechanism +and semantic evidence without emitting a qualification verdict. Build on Linux ARM64: @@ -19,8 +19,7 @@ bash runtime/glm53-flash-dflash7-pr42-page-base-flight/build-image.sh ``` The builder contacts no serving host. A verified local image and receipt are -construction evidence only; the runtime remains unqualified until the -four-rank procedure is separately authorized and completed. +construction evidence only. The offline-verified ARM64 artifact is `sparkring-glm53-sparkcache:dflash7-pr42-page-base-flight-singletonfix-arm64` @@ -29,3 +28,15 @@ with image ID Its build receipt SHA-256 is `ec51c5b99227fe14709977df026e25e3e60f220b81ae252155d048556e8ea90a`. This construction evidence does not establish four-rank serving behavior. + +Live research established that a 16-request, 131,072-token cohort performed +one base read and avoided 15 reads on every rank, but exceeded the 20 GiB GLM +hybrid-cache residency and failed its codeword checks. A resident-safe +two-request page-delta run also produced one wrong admitted response with both +Python and SparkCache CUDA placement, while recomputation returned the correct +response. Reconstructed page-delta admission is unsupported by this evidence. + +The verified fallback is a 131,072-token flat snapshot stored as 13 macro +objects. Its restore completed in 1.55–1.70 seconds and returned the exact +`red` codeword. These observations are **research-only** and do not qualify the +image or runtime. diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json index 96f9112e..a72c693c 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/pins.json @@ -1,7 +1,7 @@ { "schema": "sparkring-glm53-dflash7-pr42-page-base-flight/v1", "status": "implemented", - "qualification": "Image construction and GPU-free qualification tooling are implemented. Four-rank model loading, semantic generation, persistent publication, restart, base-flight reuse, result restore, isolation, and response checks have no live qualification.", + "qualification": "Image construction and GPU-free mechanism tests are implemented. Live page-delta observations are research-only and failed semantic checks. Full-snapshot restore is the verified operational fallback for the recorded GLM-5.3 conditions.", "platform": "linux/arm64", "public_base": { "reference": "ghcr.io/fujitsupolycom/sparkring-glm53-runtime@sha256:864adfe68f458223e186a19844ac80c7adc7365e5db1f25e109b85fc19850dcd", @@ -256,6 +256,37 @@ "archive_sha256": "9e1876207e7cbb3a85ac121fd91c21974eb73298af2638813a3a2fc5a27dc2ab", "archive_bytes": 20822443008 } + }, + "research_evidence": { + "status": "research-only", + "c16_page_delta": { + "participants": 16, + "result_tokens_per_request": 131072, + "shared_base_tokens": 98304, + "physical_base_reads_per_rank": 1, + "avoided_base_reads_per_rank": 15, + "residency": "exceeded-20-gib-hybrid-pool", + "semantic_result": "rejected" + }, + "resident_safe_c2_page_delta": { + "participants": 2, + "result_tokens_per_request": 131072, + "placement_modes_with_failure": [ + "python", + "sparkcache-cuda" + ], + "admitted_restore_semantic_result": "rejected", + "recomputed_request_semantic_result": "verified" + }, + "flat_snapshot_fallback": { + "tokens": 131072, + "macro_objects": 13, + "restore_seconds_min": 1.55, + "restore_seconds_max": 1.70, + "expected_oracle": "red", + "semantic_result": "verified" + }, + "conclusion": "The persistent base-read mechanism is implemented, but reconstructed page-delta admission is unsupported for GLM-5.3 by this evidence." } }, "runtime_cache_roots": { diff --git a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py index 12cc48de..ea31aa2d 100644 --- a/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py +++ b/runtime/glm53-flash-dflash7-pr42-page-base-flight/test_pr42_page_base_flight_contract.py @@ -107,6 +107,38 @@ def test_pins_bind_pr42_without_changing_runtime_contracts() -> None: "archive_bytes": 20822443008, }, }, + "research_evidence": { + "status": "research-only", + "c16_page_delta": { + "participants": 16, + "result_tokens_per_request": 131072, + "shared_base_tokens": 98304, + "physical_base_reads_per_rank": 1, + "avoided_base_reads_per_rank": 15, + "residency": "exceeded-20-gib-hybrid-pool", + "semantic_result": "rejected", + }, + "resident_safe_c2_page_delta": { + "participants": 2, + "result_tokens_per_request": 131072, + "placement_modes_with_failure": ["python", "sparkcache-cuda"], + "admitted_restore_semantic_result": "rejected", + "recomputed_request_semantic_result": "verified", + }, + "flat_snapshot_fallback": { + "tokens": 131072, + "macro_objects": 13, + "restore_seconds_min": 1.55, + "restore_seconds_max": 1.70, + "expected_oracle": "red", + "semantic_result": "verified", + }, + "conclusion": ( + "The persistent base-read mechanism is implemented, but" + " reconstructed page-delta admission is unsupported for GLM-5.3" + " by this evidence." + ), + }, }