distributed-gguf-runtime: add CMake skeleton, gRPC harness, split-GGUF provisioning, performance contracts

DGR-019  Lock alpha/beta performance contracts (evidence + contract framework)
DGR-020  Run controlled whole-model GGUF baseline (benchmark results & contracts)
DGR-024  Real generated-gRPC protocol harness (shard_runtime_server.py + tests)
DGR-026  split-GGUF provisioning outside /home (provision script + manifest + tests)
DGR-028  Numbered patch-stack apply & verify (llama_cpp_dependency.py + UPSTREAM_LOCK.json)
DGR-029  Native CMake skeleton + deterministic CPU lane (UPSTREAM_LOCK.json + cmake gating)

New modules:
  packages/node/meshnet_node/dgr_performance/  — performance contract framework
  packages/node/meshnet_node/split_gguf/        — split-GGUF manifest & provisioning
  scripts/provision_split_gguf.py               — artifact provisioning CLI
  tests/test_dgr_performance_contract.py        — contract validation tests
  tests/test_split_gguf_manifest.py             — manifest tests
  tests/test_split_gguf_provision.py            — provisioning tests
  tests/test_shard_runtime_harness.py           — gRPC harness tests
This commit is contained in:
Dobromir Popov
2026-07-23 09:55:00 +03:00
parent 47bad0b7e1
commit 966aa10854
36 changed files with 7225 additions and 374 deletions

View File

@@ -6,9 +6,12 @@ import hashlib
import importlib.util
import json
import pathlib
import shutil
import subprocess
import sys
import pytest
ROOT = pathlib.Path(__file__).resolve().parents[1]
LLAMA_DIR = ROOT / "packages/node/native/llama"
@@ -19,6 +22,26 @@ def _sha256(path: pathlib.Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def _load_dependency_module():
spec = importlib.util.spec_from_file_location("llama_cpp_dependency_ctest", SCRIPT)
assert spec and spec.loader
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
def _cmake_available() -> bool:
if shutil.which("cmake"):
return True
sibling = pathlib.Path(sys.executable).parent / "cmake"
return sibling.is_file()
requires_cmake = pytest.mark.skipif(
not _cmake_available(), reason="cmake toolchain is required to build the native CTest lane"
)
def test_lock_and_patch_manifest_are_self_consistent_and_exact() -> None:
lock = json.loads((LLAMA_DIR / "UPSTREAM_LOCK.json").read_text())
commit = (LLAMA_DIR / "UPSTREAM_COMMIT").read_text().strip()
@@ -255,3 +278,59 @@ def test_patch_stack_does_not_contain_meshnet_control_plane_code() -> None:
for name in (LLAMA_DIR / "patches/series").read_text().splitlines()
)
assert not any(term in patch_text for term in forbidden)
def test_build_config_locks_an_explicit_cpu_only_deterministic_lane() -> None:
lock = json.loads((LLAMA_DIR / "UPSTREAM_LOCK.json").read_text())
build = lock["build"]
flag_values = dict(flag[len("-D"):].split("=", 1) for flag in build["configure_flags"])
assert flag_values["GGML_CPU"] == "ON"
for backend in ("GGML_CUDA", "GGML_HIP", "GGML_VULKAN", "GGML_METAL", "GGML_BLAS"):
assert flag_values[backend] == "OFF"
assert flag_values["LLAMA_BUILD_TESTS"] == "ON"
assert build["ctest_regex"] == "^test-meshnet-range-ownership$"
assert "test-meshnet-range-ownership" in build["native_targets"]
assert pathlib.Path(build["smoke_binary"]).name in build["native_targets"]
assert "tests/test-meshnet-range-ownership.cpp" in lock["patched_paths"]
@requires_cmake
def test_ctest_lane_raises_an_actionable_error_for_a_failing_named_test(tmp_path: pathlib.Path) -> None:
dependency = _load_dependency_module()
project = tmp_path / "project"
project.mkdir()
(project / "CMakeLists.txt").write_text(
"cmake_minimum_required(VERSION 3.14)\n"
"project(ctest_lane_fixture NONE)\n"
"enable_testing()\n"
"add_test(NAME meshnet-fixture-pass COMMAND ${CMAKE_COMMAND} -E true)\n"
"add_test(NAME meshnet-fixture-fail COMMAND ${CMAKE_COMMAND} -E false)\n"
)
build_dir = tmp_path / "build"
subprocess.run(
[dependency._cmake(), "-S", str(project), "-B", str(build_dir)],
check=True,
capture_output=True,
text=True,
)
base_lock = json.loads((LLAMA_DIR / "UPSTREAM_LOCK.json").read_text())
def _lock_with_regex(regex: str):
patched = dict(base_lock)
patched["build"] = {**base_lock["build"], "ctest_regex": regex}
return patched
dependency._load_lock = lambda: _lock_with_regex("^meshnet-fixture-pass$")
dependency.ctest_lane(build_dir)
dependency._load_lock = lambda: _lock_with_regex("^meshnet-fixture-fail$")
try:
dependency.ctest_lane(build_dir)
except dependency.DependencyError as error:
assert "meshnet-fixture-fail" in str(error)
else:
raise AssertionError("a failing named CTest lane must raise DependencyError")