Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Linux87/RunL87Hashes.py
T
Fr0zkaandClaude Opus 5.5 0fe7f371f7 diag: corrected passage-off ceiling + cold worker/tile timelines (L87); passages ARE the gate
L86's switch left ApplyResolvedStratePassageCarves running (near-tile service unchanged at ~21
worker-s), so its "no change" ceiling was wrong. Corrected (bands + carves off): FI LOD0-2
2.34 -> 0.66 s, whole 3.47 -> 1.49 s @W12; TN 2.27 -> 0.74 / 3.28 -> 1.52 s. Near-tile service
15.6-22.5 -> 2.6-3.8 worker-s. Critical chain: shape/base compile -> LOD0-1 -> far-parent build
(107-153 ms, pipeline thread) -> LOD2. Workers 81-85% busy in the direct window.
No production scheduling change; hashes equal L85. Fast tier PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 03:07:30 +01:00

97 lines
4.4 KiB
Python

#!/usr/bin/env python3
"""Verify L87 per-tile and whole-view hashes against the L85 baseline."""
from __future__ import annotations
import json
import re
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l87/hashes"
DATA = ROOT / "Standalone/data/owner_world.json"
BINARY = ROOT / "Saved/Linux/l87/bin/VoxelForgeCoreHeadless-clang19"
SOURCE_STAMP = "ac3d8ea64e9ac4bd5526c61990070fb504528ff56dae52d33c1937327374032b"
BASELINE = ROOT / "Saved/Linux/l85/hash-check-final"
STRATA = {
"FI": {"id": 1, "camera": (25.8369140625, 3.19921875, -737.0), "tiles": 2249},
"TN": {"id": 2, "camera": (19.166015625, -14.2001953125, -753.3740234375), "tiles": 2233},
}
STAMP = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=(\S+)$", re.M)
TILE_HASH = re.compile(
r"^\[PipelineTileHash\] lod=(-?\d+) x=(-?\d+) y=(-?\d+) z=(-?\d+) "
r"density=(0x[0-9a-f]+) mesh=(0x[0-9a-f]+) payload=(0x[0-9a-f]+) "
r"topology=(0x[0-9a-f]+)$", re.M)
WHOLE_HASH = re.compile(
r"^\[PipelineWholeViewHash\] tiles=(\d+) density=(0x[0-9a-f]+) "
r"mesh=(0x[0-9a-f]+) payload=(0x[0-9a-f]+) topology=(0x[0-9a-f]+)$", re.M)
def hashes_from(text: str) -> dict[tuple[int, int, int, int], tuple[str, ...]]:
return {
tuple(int(match.group(index)) for index in range(1, 5)): match.group(5, 6, 7, 8)
for match in TILE_HASH.finditer(text)
}
def run(stratum: str) -> dict:
OUT.mkdir(parents=True, exist_ok=True)
spec = STRATA[stratum]
camera = ",".join(f"{value:.12f}" for value in spec["camera"]) + ",0,0"
log = OUT / f"{stratum.lower()}-w8.log"
command = [
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", "env",
"VOXELFORGE_L81_PASSAGE_BOUND_PADDING_VOXELS=0", "timeout", "1740s",
str(BINARY), str(DATA), "--world-assembler-prototype", "--stream-benchmark",
"--stream-pipeline", "--workers=8", "--clip-radius=3", "--max-clip-level=8",
"--max-level=8", f"--camera={camera}", "--stream-scheduler-policy=3",
"--stream-hash-tiles",
]
started = time.monotonic()
with log.open("w", encoding="utf-8") as stream:
result = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, check=False, timeout=1740)
output = log.read_text(encoding="utf-8", errors="replace")
stamp, whole = STAMP.search(output), WHOLE_HASH.search(output)
if result.returncode or stamp is None or whole is None:
raise RuntimeError(f"hash run failed: exit={result.returncode} {log}")
if stamp.group(1) != SOURCE_STAMP:
raise RuntimeError(f"source stamp mismatch in {log}: {stamp.group(1)}")
actual_tiles = hashes_from(output)
baseline_log = BASELINE / f"l85-s{spec['id']}.log"
baseline_tiles = hashes_from(baseline_log.read_text(encoding="utf-8", errors="replace"))
mismatches = sorted(
key for key in set(actual_tiles) | set(baseline_tiles)
if actual_tiles.get(key) != baseline_tiles.get(key)
)
actual_whole = whole.group(1, 2, 3, 4, 5)
baseline_whole_match = WHOLE_HASH.search(
baseline_log.read_text(encoding="utf-8", errors="replace"))
baseline_whole = baseline_whole_match.group(1, 2, 3, 4, 5)
row = {
"stratum": stratum, "workers": 8, "exit_code": result.returncode,
"wall_s": round(time.monotonic() - started, 3), "tile_count": len(actual_tiles),
"expected_tiles": spec["tiles"], "whole_hash": actual_whole,
"baseline_whole_hash": baseline_whole, "tile_hashes_identical": not mismatches,
"whole_hash_identical": actual_whole == baseline_whole,
"mismatch_count": len(mismatches), "first_mismatches": mismatches[:12],
"source_stamp": stamp.group(1), "log": str(log.relative_to(ROOT)),
"baseline_log": str(baseline_log.relative_to(ROOT)),
}
if len(actual_tiles) != spec["tiles"] or len(baseline_tiles) != spec["tiles"]:
raise RuntimeError(f"incomplete hash view: {json.dumps(row)}")
print("[L87HashComparison] " + json.dumps(row, sort_keys=True), flush=True)
return row
def main() -> int:
rows = [run(stratum) for stratum in STRATA]
(OUT / "summary.json").write_text(json.dumps(rows, indent=2) + "\n", encoding="utf-8")
return 0 if all(row["tile_hashes_identical"] and row["whole_hash_identical"]
for row in rows) else 1
if __name__ == "__main__":
raise SystemExit(main())