Exact through LOD2 (all near tile hashes equal L82). W8 LOD0-2: SW 1.09->1.06, FI 2.47->2.34, TN 2.39->2.43 (noise), VS 1.20->1.18 s. Fast tier PASS. Scaling W4/W8/W12/W16 (LOD0-2, FI): 3.59 / 2.48 / 2.33 / 2.34 s - flattens past W8-W12. Estimated infinite-worker floor ~1.0 s FI/TN = shape compile (0.35-0.41 s, not overlapped: no shape-free tiles in these views) + slowest single LOD0 tile service (0.51-0.59 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
95 lines
4.1 KiB
Python
95 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Compare all LOD0-2 near tile hashes per stratum against L82."""
|
|
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/l83/hash-check"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARIES = {
|
|
"L82": ROOT / "Saved/Linux/l82/bin/VoxelForgeCoreHeadless-clang19",
|
|
"L83": ROOT / "Saved/Linux/l83/bin/VoxelForgeCoreHeadless-l83-clang19",
|
|
}
|
|
CAMERAS = {
|
|
0: (8.0, 16.0, -372.2626953125),
|
|
1: (25.8369140625, 3.19921875, -737.0),
|
|
2: (19.166015625, -14.2001953125, -753.3740234375),
|
|
3: (-20.0625, -5.068359375, -900.353515625),
|
|
}
|
|
EXPECTED_NEAR = {0: 1408, 1: 1216, 2: 1344, 3: 1344}
|
|
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 run(strate: int, version: str) -> dict:
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
log = OUT / f"{version.lower()}-s{strate}.log"
|
|
camera = ",".join(f"{v:.12f}" for v in CAMERAS[strate]) + ",0,0"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"env", "VOXELFORGE_L81_PASSAGE_BOUND_PADDING_VOXELS=0", "timeout", "1740s",
|
|
str(BINARIES[version]), str(DATA), "--world-assembler-prototype",
|
|
"--stream-benchmark", "--stream-pipeline", "--workers=8", "--clip-radius=3",
|
|
"--max-clip-level=8", "--max-level=2", f"--camera={camera}",
|
|
"--stream-hash-tiles",
|
|
]
|
|
start = 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")
|
|
hashes = {
|
|
(int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4))): m.group(5, 6, 7, 8)
|
|
for m in TILE_HASH.finditer(output)
|
|
}
|
|
whole = WHOLE_HASH.search(output)
|
|
if result.returncode or whole is None or len(hashes) != EXPECTED_NEAR[strate]:
|
|
raise RuntimeError(f"hash run failed or incomplete: exit={result.returncode} {log}")
|
|
return {
|
|
"version": version, "strate": strate, "exit_code": result.returncode,
|
|
"wall_s": round(time.monotonic() - start, 3), "tile_hash_count": len(hashes),
|
|
"whole_hash": whole.group(1, 2, 3, 4, 5), "hashes": hashes,
|
|
"log": str(log.relative_to(ROOT)),
|
|
}
|
|
|
|
|
|
def main() -> int:
|
|
for path in (*BINARIES.values(), DATA):
|
|
if not path.is_file():
|
|
raise SystemExit(f"missing input: {path}")
|
|
comparisons, runs = [], []
|
|
for strate in range(4):
|
|
pair = {version: run(strate, version) for version in ("L82", "L83")}
|
|
a, b = pair["L82"], pair["L83"]
|
|
mismatch_keys = sorted(key for key in set(a["hashes"]) | set(b["hashes"])
|
|
if a["hashes"].get(key) != b["hashes"].get(key))
|
|
comparison = {
|
|
"strate": strate, "tiles": len(a["hashes"]),
|
|
"tile_hashes_identical": not mismatch_keys,
|
|
"whole_hash_identical": a["whole_hash"] == b["whole_hash"],
|
|
"mismatch_count": len(mismatch_keys), "first_mismatches": mismatch_keys[:8],
|
|
"l82_whole_hash": a["whole_hash"], "l83_whole_hash": b["whole_hash"],
|
|
}
|
|
comparisons.append(comparison)
|
|
runs.extend({k: v for k, v in row.items() if k != "hashes"} for row in pair.values())
|
|
print("[L83HashComparison] " + json.dumps(comparison, sort_keys=True), flush=True)
|
|
(OUT / "summary.json").write_text(
|
|
json.dumps({"comparisons": comparisons, "runs": runs}, indent=2) + "\n",
|
|
encoding="utf-8")
|
|
return 0 if all(row["tile_hashes_identical"] and row["whole_hash_identical"]
|
|
for row in comparisons) else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|