From 49c517ed76e09dd2f7e78eb3ad5fe83382bda6fb Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Sun, 30 Aug 2026 01:38:22 -0500 Subject: [PATCH] Make the recurrent lease state coherent The GLM recurrent lease document now names one final runtime state across all eleven files. Four recurrent postimages and seven unchanged files therefore share a coherent verifier state; the impossible pre-producer state is no longer advertised.\n\nThe four SparkCache patches remain exact preimages for the separate recurrent producer. Add regression coverage for coherent final-state verification and state that the final contract is valid only after producer composition.\n\nCache namespace impact: none. CacheIdentity values, digest salts, chunk geometry, manifest schemas, and page-delta bytes are unchanged.\n\nValidation: python -m pytest sparkcache -q (760 passed, 7 skipped); python -m pytest deploy -q (108 passed, 1 skipped); python -m ruff check . --- deploy/deepseek_v4/tp4_profile.json | 2 +- deploy/glm52_35bpw/profile.json | 2 +- .../source-receipt.json | 4 +- sparkcache/runtime_patches/README.md | 8 ++- ...st_glm53_b12x_kda_adaptive_mtp_contract.py | 63 +++++++++++++++---- ...-contract-glm53-b12x-kda-adaptive-mtp.json | 18 +++--- 6 files changed, 67 insertions(+), 30 deletions(-) diff --git a/deploy/deepseek_v4/tp4_profile.json b/deploy/deepseek_v4/tp4_profile.json index 155efff..c586573 100644 --- a/deploy/deepseek_v4/tp4_profile.json +++ b/deploy/deepseek_v4/tp4_profile.json @@ -4,7 +4,7 @@ "cache_model_profile": "deepseek-v4-fp8-hma", "published_runtime_base": "ghcr.io/fujitsupolycom/gb10-vllm-serving@sha256:6fc26fdad81a18f0fff67ce0a05f6d90165625ea2e1cac8a6f39bfb462017028", "sparkcache": { - "source_sha256": "88633ef676b4dfe258a6fa9b788ddeb22cad68349d0cae0c503ee404d1724f7b" + "source_sha256": "83853050f790b18af95d424fec837abeb1a9a33f0538b5e4b97c16fb9c681781" }, "model": { "repository": "deepseek-ai/DeepSeek-V4-Flash-0731", diff --git a/deploy/glm52_35bpw/profile.json b/deploy/glm52_35bpw/profile.json index 35f1571..547ad8b 100644 --- a/deploy/glm52_35bpw/profile.json +++ b/deploy/glm52_35bpw/profile.json @@ -5,7 +5,7 @@ "published_runtime_base": "ghcr.io/fujitsupolycom/gb10-vllm-serving@sha256:6fc26fdad81a18f0fff67ce0a05f6d90165625ea2e1cac8a6f39bfb462017028", "base_image_requirement": "exact GLM-5.2 3.5-bpw R7 image recorded by the source container inspection", "sparkcache": { - "source_sha256": "88633ef676b4dfe258a6fa9b788ddeb22cad68349d0cae0c503ee404d1724f7b" + "source_sha256": "83853050f790b18af95d424fec837abeb1a9a33f0538b5e4b97c16fb9c681781" }, "model": { "repository": "brandonmusic/GLM-5.2-EXL3-TR3v4-3.5bpw-MTP78", diff --git a/patches/vllm-glm53-b12x-kda-adaptive-mtp/source-receipt.json b/patches/vllm-glm53-b12x-kda-adaptive-mtp/source-receipt.json index b32aa50..f4a4d28 100644 --- a/patches/vllm-glm53-b12x-kda-adaptive-mtp/source-receipt.json +++ b/patches/vllm-glm53-b12x-kda-adaptive-mtp/source-receipt.json @@ -62,7 +62,7 @@ ], "contract": { "path": "sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json", - "sha256": "45d7a92b38b836a4f829f02df85e339cfeea860e1080e4663a8340af6c125125" + "sha256": "f36ed14eaf1f97a5dffa94bda8151b1e0fa182afc0d121b757b70bebc6a43811" }, - "result": "All four patches apply in order to the LF source tree, and the eleven-file SparkCache contract verifies the resulting source bytes, including the live-tensor B12X KDA implementation." + "result": "All four SparkCache patches apply in order to the LF source tree and produce the exact preimages required by the recurrent-boundary producer. The eleven-file final-runtime contract verifies only after that producer creates its four recurrent postimages; it also covers the unchanged live-tensor B12X KDA surface." } diff --git a/sparkcache/runtime_patches/README.md b/sparkcache/runtime_patches/README.md index f13d033..9b2596b 100644 --- a/sparkcache/runtime_patches/README.md +++ b/sparkcache/runtime_patches/README.md @@ -63,8 +63,12 @@ exact-input overlays under `patches/vllm-glm53-b12x-kda-adaptive-mtp`. The three KDA commits after `e10536a` change only the KDA implementation and its model tests. Ten SparkCache ownership files remain byte-identical, while the eleventh contract file binds the live-tensor B12X KDA implementation. -The contract has **implemented** status. Four-rank TP4/DCP1 serving remains -unqualified until a receipt names an immutable image built from this revision. +The four SparkCache patches produce the exact preimages consumed by the +recurrent-boundary producer. The contract names one coherent final runtime +state across all eleven files and is valid only after that producer creates its +four recurrent postimages. It has **implemented** status. Four-rank TP4/DCP1 +serving remains unqualified until a receipt names an immutable image built from +this revision. ```bash python -m sparkcache.runtime_patches.verify_lease_contract \ diff --git a/sparkcache/runtime_patches/test_glm53_b12x_kda_adaptive_mtp_contract.py b/sparkcache/runtime_patches/test_glm53_b12x_kda_adaptive_mtp_contract.py index a7547e7..85a7d3e 100644 --- a/sparkcache/runtime_patches/test_glm53_b12x_kda_adaptive_mtp_contract.py +++ b/sparkcache/runtime_patches/test_glm53_b12x_kda_adaptive_mtp_contract.py @@ -79,10 +79,7 @@ def test_glm53_b12x_kda_adaptive_mtp_contract_attests_the_complete_sparkcache_vl KDA_PATH, } for record in contract["files"]: - expected_roles = {SOURCE_ROLE} - if record["path"] in RECURRENT_BOUNDARY_FILES: - expected_roles.add(RECURRENT_BOUNDARY_ROLE) - assert set(record["accepted_sha256"]) == expected_roles + assert set(record["accepted_sha256"]) == {RECURRENT_BOUNDARY_ROLE} assert all(record["required_symbols"] for record in contract["files"]) by_path = {record["path"]: record for record in contract["files"]} @@ -147,11 +144,11 @@ def test_glm53_b12x_kda_adaptive_mtp_overlay_has_exact_preimage_and_postimage_re assert patch_positions == sorted(patch_positions) -def test_glm53_b12x_kda_adaptive_mtp_patch_sequence_terminates_at_attested_contract_postimages() -> None: +def test_glm53_b12x_kda_adaptive_mtp_patch_sequence_precedes_the_final_contract() -> None: receipts = json.loads(PREIMAGES.read_text(encoding="utf-8")) contract = json.loads(CONTRACT.read_text(encoding="utf-8")) accepted = { - record["path"]: record["accepted_sha256"][SOURCE_ROLE] + record["path"]: record["accepted_sha256"][RECURRENT_BOUNDARY_ROLE] for record in contract["files"] } scheduler_recovery = receipts["030-sparkcache-hma-load-failure.patch"] @@ -163,13 +160,53 @@ def test_glm53_b12x_kda_adaptive_mtp_patch_sequence_terminates_at_attested_contr scheduler_recovery["accepted_postimage_sha256"][SOURCE_ROLE] == scheduler_attach["accepted_preimage_sha256"][SOURCE_ROLE] ) - assert ( - scheduler_attach["accepted_postimage_sha256"][SOURCE_ROLE] - == accepted[scheduler_attach["target_path"]] - ) - assert ( - manager_lease["accepted_postimage_sha256"][SOURCE_ROLE] - == accepted[manager_lease["target_path"]] + assert scheduler_attach["accepted_postimage_sha256"][SOURCE_ROLE] != accepted[ + scheduler_attach["target_path"] + ] + assert manager_lease["accepted_postimage_sha256"][SOURCE_ROLE] != accepted[ + manager_lease["target_path"] + ] + + +def test_glm53_recurrent_contract_verifies_one_coherent_final_source_state( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, +) -> None: + contract = json.loads(CONTRACT.read_text(encoding="utf-8")) + accepted_by_path: dict[Path, str] = {} + for record in contract["files"]: + relative = Path(record["path"]) + accepted_by_path[relative] = record["accepted_sha256"][ + RECURRENT_BOUNDARY_ROLE + ] + classes: dict[str, list[str]] = {} + for symbol in record["required_symbols"]: + class_name, member_name = symbol.split(".") + classes.setdefault(class_name, []).append(member_name) + source = tmp_path / relative + source.parent.mkdir(parents=True, exist_ok=True) + source.write_text( + "\n\n".join( + "class " + + class_name + + ":\n" + + "\n".join( + f" def {member_name}(self):\n pass" + for member_name in members + ) + for class_name, members in classes.items() + ) + + "\n", + encoding="utf-8", + ) + + def exact_composed_digest(path: Path) -> str: + return accepted_by_path[path.resolve().relative_to(tmp_path.resolve())] + + monkeypatch.setattr(verifier, "_sha256", exact_composed_digest) + verified = verifier.verify_contract(tmp_path, CONTRACT) + assert [path.relative_to(tmp_path) for path in verified] == list( + accepted_by_path ) diff --git a/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json b/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json index 9ac1dd6..7de6ead 100644 --- a/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json +++ b/sparkcache/runtime_patches/vllm-kv-block-lease-contract-glm53-b12x-kda-adaptive-mtp.json @@ -5,7 +5,7 @@ { "path": "vllm/distributed/kv_transfer/kv_connector/v1/base.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "bc1965431087676876f58360cd9cc07ab6c06febe6d747695f10b051fd85c412" + "recurrent_boundary_contract": "bc1965431087676876f58360cd9cc07ab6c06febe6d747695f10b051fd85c412" }, "required_symbols": [ "KVConnectorBase_V1.handle_preemptions", @@ -16,7 +16,7 @@ { "path": "vllm/distributed/kv_transfer/kv_connector/utils.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "115512dca36b0711223f55f5ff304abffccc6d078923ba4c6bbb3cdb7fdd39a2" + "recurrent_boundary_contract": "115512dca36b0711223f55f5ff304abffccc6d078923ba4c6bbb3cdb7fdd39a2" }, "required_symbols": [ "KVOutputAggregator.from_connector", @@ -26,7 +26,6 @@ { "path": "vllm/v1/core/sched/scheduler.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "6d397c97f31e67a75efc01b5ddd89fa58db425de14fa43965ef2d6146b6b9bdb", "recurrent_boundary_contract": "260f36ce8fabf70c193b20009ea465eea7b1b6c8e9fb72f2307a01ba8fcf7b2a" }, "required_symbols": [ @@ -42,7 +41,6 @@ { "path": "vllm/v1/core/kv_cache_manager.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "ee03dc9ce2b720c0be6e9f572d23580ba96eff68fe3406250557e83071654af0", "recurrent_boundary_contract": "c5b83d382c96b2bf8c466a993ed77123a14a971e2661797128533319388d0b5f" }, "required_symbols": [ @@ -60,7 +58,6 @@ { "path": "vllm/v1/core/sched/output.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "65235eba652e5a3ccee18bf3cbfeac9bf4da8fb9c61e961580f612cfb7e593bc", "recurrent_boundary_contract": "9911b3f9d21815a185285852b5a6176e5484e1ab0ff5c30f7caaa68ea0fab543" }, "required_symbols": [ @@ -72,7 +69,7 @@ { "path": "vllm/v1/worker/gpu_model_runner.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "5ac63bf43acc6b254282426a8a9b989cc07fcdbd07223101bdc99f91f4e4ce5f" + "recurrent_boundary_contract": "5ac63bf43acc6b254282426a8a9b989cc07fcdbd07223101bdc99f91f4e4ce5f" }, "required_symbols": [ "GPUModelRunner.execute_model", @@ -82,7 +79,7 @@ { "path": "vllm/v1/core/block_pool.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "ddee56dccb2208411b3a035918e917ce8f56a9858471e9ca12b420d5d79bc69c" + "recurrent_boundary_contract": "ddee56dccb2208411b3a035918e917ce8f56a9858471e9ca12b420d5d79bc69c" }, "required_symbols": [ "BlockPool.touch", @@ -92,7 +89,7 @@ { "path": "vllm/v1/core/kv_cache_coordinator.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "37be4bb55d40d78e2210b28c0a3f55e1027872af21335de5ca3c61f09c3856af" + "recurrent_boundary_contract": "37be4bb55d40d78e2210b28c0a3f55e1027872af21335de5ca3c61f09c3856af" }, "required_symbols": [ "KVCacheCoordinator.allocate_new_computed_blocks", @@ -103,7 +100,6 @@ { "path": "vllm/v1/core/single_type_kv_cache_manager.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "e4b1c5c38b63b708fd55aa40a9ab0d008b266d006a63dcfcef55890ac1371cb8", "recurrent_boundary_contract": "f67a1850a7e0288baaa6d42e7ec55b22b09c156720767e23acaabedcae333c8a" }, "required_symbols": [ @@ -120,7 +116,7 @@ { "path": "vllm/v1/kv_cache_interface.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "72acc5ae3f61f7ecbebdb3a3a16b7c69c064d6fd7af23a1fcc3cf946bdaee952" + "recurrent_boundary_contract": "72acc5ae3f61f7ecbebdb3a3a16b7c69c064d6fd7af23a1fcc3cf946bdaee952" }, "required_symbols": [ "MambaSpec.max_num_blocks_per_req" @@ -129,7 +125,7 @@ { "path": "vllm/model_executor/layers/mamba/gdn/kimi_gdn_linear_attn.py", "accepted_sha256": { - "source_built_glm53_b12x_kda_adaptive_mtp": "8bf8bc579dd4a80224dc1633e7513f2a0c58e07db72a736c7e41d28d3c35f3b9" + "recurrent_boundary_contract": "8bf8bc579dd4a80224dc1633e7513f2a0c58e07db72a736c7e41d28d3c35f3b9" }, "required_symbols": [ "KimiGatedDeltaNetAttention._initialize_b12x_kda_decode",