Files
Fr0zkaandClaude Opus 5.5 9d5455ec68 skip: passage proof bounds include wall/floor relief (L75 soundness fix); FI -7.6%
L74's passage bound omitted the 0.21 m wall relief and 0.20 m floor relief, so its whole-tile
proof was unsound in principle (no tested view hit it). Passage support is now bounded per route
segment by four parameter-subinterval boxes using Catmull-Rom derivative extrema, local max
radius and relief padding. Stratum slicing only at LOD0-2 in FI/VS. Legacy sub-tile block
certificates are audit-only (runtime version was slower). TN regression (-80,-20,-3218) kept.

Exact full-grid vs skip hashes on every tile, 4 views, Clang/GCC, W1/W8/W12; control caught;
80-camera sweep 0 violations. Whole view vs c67b200: SW -1.3%, FI -7.6%, TN -2.3%, VS +0.2%.
Compiles in the Linux UE host (VFHostEditor, 27/27 actions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 14:34:49 +01:00

164 lines
7.2 KiB
Python

#!/usr/bin/env python3
"""Exact full-grid versus whole-tile skip sweep at 20 camera positions per stratum."""
from __future__ import annotations
import json
import re
import statistics
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l75/logs"
DATA = ROOT / "Standalone/data/owner_world.json"
BIN = ROOT / "Saved/Linux/l75/bin/VoxelForgeCoreHeadless-l75-clang"
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),
}
OFFSETS = [(x, y) for y in (0.1, 4.1, 8.1, 12.1)
for x in (0.1, 4.1, 8.1, 12.1, 16.1)]
HASH = re.compile(
r"\[PipelineTileHash\] lod=(\d+) x=(-?\d+) y=(-?\d+) z=(-?\d+) "
r"density=(0x[0-9a-fA-F]+) mesh=(0x[0-9a-fA-F]+) "
r"payload=(0x[0-9a-fA-F]+) topology=(0x[0-9a-fA-F]+)"
)
EMPTY_DENSITY_HASH = "0xcbf29ce484222325"
PIPELINE = re.compile(r"\[StreamPipeline\] (.*)")
TILE_PIPELINE = re.compile(r"\[WorldAssemblerTilePipeline\] (.*)")
PAIR = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
def read_hashes(path: Path) -> tuple[dict, set[tuple[int, int, int, int]]]:
hashes = {}
generated = set()
for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
match = HASH.search(line)
if match:
lod, x, y, z = (int(match.group(index)) for index in range(1, 5))
hashes[(lod, x, y, z)] = {
"density": match.group(5).lower(), "mesh": match.group(6).lower(),
"payload": match.group(7).lower(), "topology": match.group(8).lower(),
}
if match.group(5).lower() != EMPTY_DENSITY_HASH:
generated.add((lod, x, y, z))
return hashes, generated
def parse_summary(path: Path) -> dict:
content = path.read_text(encoding="utf-8", errors="replace")
pipeline = PIPELINE.search(content)
tile_pipeline = TILE_PIPELINE.search(content)
if pipeline is None or tile_pipeline is None:
raise SystemExit(f"pipeline summaries missing; see {path}")
values = dict(PAIR.findall(pipeline.group(1)))
tile_values = dict(PAIR.findall(tile_pipeline.group(1)))
tiles = values.get("whole_tiles", "0/0").split("/")
return {
"tiles": int(tiles[1]) if len(tiles) == 2 else 0,
"whole_tile_skips": int(tile_values.get("whole_tile_skips", "0")),
"classification_worker_ms": float(tile_values.get("classification_worker_ms", "0")),
}
def run(mode: str, view: int, position: int, offset: tuple[float, float]) -> dict:
base = CAMERAS[view]
xyz = (base[0] + offset[0], base[1] + offset[1], base[2])
camera = ",".join(f"{value:.12f}" for value in xyz) + ",0,0"
log = OUT / f"sweep-{mode}-s{view}-p{position:02d}.log"
hash_flag = "--stream-hash-tiles" if mode == "reference" \
else "--stream-hash-tiles-allow-skips"
command = [
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", "timeout",
"1740s", str(BIN), str(DATA), "--world-assembler-prototype", "--stream-benchmark",
"--stream-pipeline", "--force-generate", "--workers=8", "--clip-radius=3",
"--max-clip-level=8", "--max-level=8", f"--camera={camera}", hash_flag,
]
started = time.monotonic()
with log.open("w", encoding="utf-8") as output:
result = subprocess.run(command, cwd=ROOT, stdout=output, stderr=subprocess.STDOUT,
check=False, timeout=1740)
hashes, _ = read_hashes(log)
if result.returncode != 0 or not hashes:
raise SystemExit(f"{mode} hash generation failed; see {log}")
summary = parse_summary(log)
row = {
"mode": mode, "strate": view, "position": position, "offset_m": list(offset),
"camera_m": list(xyz), "exit_code": result.returncode,
"wall_s": round(time.monotonic() - started, 3), "hash_rows": len(hashes),
**summary, "log": str(log.relative_to(ROOT)),
}
print("[L75HashSweepRun] " + json.dumps(row, sort_keys=True), flush=True)
return row
def compare(reference: Path, candidate: Path) -> dict:
expected, _ = read_hashes(reference)
actual, candidate_generated = read_hashes(candidate)
missing = expected.keys() - actual.keys()
extra = actual.keys() - expected.keys()
mismatches = {field: 0 for field in ("mesh", "payload", "topology", "density_processed")}
for key in expected.keys() & actual.keys():
fields = ["mesh", "payload", "topology"]
if key in candidate_generated:
fields.append("density")
for field in fields:
if expected[key][field] != actual[key][field]:
mismatches["density_processed" if field == "density" else field] += 1
return {
"reference": str(reference.relative_to(ROOT)),
"candidate": str(candidate.relative_to(ROOT)),
"reference_tiles": len(expected), "candidate_tiles": len(actual),
"missing_keys": len(missing), "extra_keys": len(extra),
"mismatches": mismatches,
"equal": not missing and not extra and not any(mismatches.values()),
}
def main() -> int:
if not DATA.is_file() or not BIN.is_file():
raise SystemExit("missing owner world or L75 Clang headless binary")
references, candidates, comparisons = [], [], []
for view in range(4):
for position, offset in enumerate(OFFSETS):
reference = run("reference", view, position, offset)
candidate = run("skip", view, position, offset)
comparison = compare(ROOT / reference["log"], ROOT / candidate["log"])
comparison.update(strate=view, position=position)
references.append(reference)
candidates.append(candidate)
comparisons.append(comparison)
print("[L75HashSweepCompare] " + json.dumps(comparison, sort_keys=True), flush=True)
if not comparison["equal"]:
raise SystemExit(f"whole-tile proof falsified; see {comparison['candidate']}")
summaries = []
for view in range(4):
rows = [row for row in candidates if row["strate"] == view]
skips = sum(row["whole_tile_skips"] for row in rows)
tiles = sum(row["tiles"] for row in rows)
costs = [row["classification_worker_ms"] for row in rows]
summaries.append({
"strate": view, "camera_positions": len(rows), "hash_comparisons": len(rows),
"violations": sum(not row["equal"] for row in comparisons
if row["strate"] == view),
"whole_tile_proof_hits": skips, "tiles_visited": tiles,
"proof_hit_pct": round(100.0 * skips / max(tiles, 1), 2),
"classifier_ms_p50": round(statistics.median(costs), 3),
"classifier_ms_p95": round(sorted(costs)[int(0.95 * (len(costs) - 1))], 3),
})
result = {"runs": {"reference": references, "skip": candidates},
"comparisons": comparisons, "summary": summaries}
(OUT / "hash-sweep.json").write_text(json.dumps(result, indent=2) + "\n",
encoding="utf-8")
for row in summaries:
print("[L75HashSweepSummary] " + json.dumps(row, sort_keys=True), flush=True)
return 0
if __name__ == "__main__":
raise SystemExit(main())