Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Linux104/CompareL104HashesToL103.py
T
Fr0zkaandClaude Opus 5.5 6a80cb0ab3 far shells: 3D cell bins for HasDownwardHit/HasUpwardHit candidates (L104, exact)
Near tiles legitimately need floor/ceiling boundary patches, but every hit query scanned the
tile's whole XY column. Direction-specific 3D cell bins conservatively index triangle bounds; the
existing predicates still decide every hit. Candidate visits per query -88..-99%; identical query
and hit counts. Hit-function cost ~1.7-1.9 -> ~0.35 s per FI/TN run. Near-ready @W12: FI 1.63 ->
1.52, TN 1.51 -> 1.38, VS 1.00 -> 0.92 s. All tile/whole hashes equal L103 (Clang/GCC W1/W8/W12).
The 24-28% "idle" is in the serial base-shape (~0.24 s) and far-parent (~0.13 s) phases; the
LOD0-1 drain is >= 99.4% busy. Fast tier PASS; Linux UE builds; FI Unreal arrival 1.96-1.98 s.

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

67 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""Compare every L104 tile hash against its L103 Clang/GCC W1/W8/W12 peer."""
from __future__ import annotations
import json
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
BEFORE = ROOT / "Saved/Linux/l103/hashes"
AFTER = ROOT / "Saved/Linux/l104/hashes"
TILE = 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 = 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 parse(path: Path) -> tuple[dict, tuple[str, ...]]:
content = path.read_text(encoding="utf-8", errors="replace")
tiles = {(int(lod), int(x), int(y), int(z)): values
for lod, x, y, z, *values in TILE.findall(content)}
whole = WHOLE.search(content)
if not tiles or whole is None:
raise RuntimeError(f"hash data missing in {path}")
return tiles, whole.groups()
def main() -> int:
runs = json.loads((AFTER / "summary.json").read_text(encoding="utf-8"))["runs"]
comparisons = []
for run in runs:
stem = f"{run['stratum'].lower()}-{run['compiler'].lower()}-w{run['workers']}.log"
old_tiles, old_whole = parse(BEFORE / stem)
new_tiles, new_whole = parse(ROOT / run["log"])
keys = set(old_tiles) | set(new_tiles)
tile_mismatches = sum(old_tiles.get(key) != new_tiles.get(key) for key in keys)
comparisons.append({
"stratum": run["stratum"], "compiler": run["compiler"],
"workers": run["workers"], "tiles_before": len(old_tiles),
"tiles_after": len(new_tiles), "tile_mismatch_keys": tile_mismatches,
"missing_after": len(set(old_tiles) - set(new_tiles)),
"extra_after": len(set(new_tiles) - set(old_tiles)),
"whole_hash_before": old_whole, "whole_hash_after": new_whole,
"whole_hash_match": old_whole == new_whole,
})
passed = len(comparisons) == 24 and all(
row["tiles_before"] == row["tiles_after"] and row["tile_mismatch_keys"] == 0
and row["missing_after"] == 0 and row["extra_after"] == 0
and row["whole_hash_match"] for row in comparisons)
result = {"all_24_l103_peer_comparisons_identical": passed,
"comparisons": comparisons}
(AFTER / "baseline-comparison.json").write_text(
json.dumps(result, indent=2) + "\n", encoding="utf-8")
print("[L104HashBaselineComparison] " + json.dumps(
{"pass": passed, "comparisons": len(comparisons),
"tile_mismatch_keys": sum(r["tile_mismatch_keys"] for r in comparisons),
"whole_hash_mismatches": sum(not r["whole_hash_match"] for r in comparisons)},
sort_keys=True), flush=True)
return 0 if passed else 1
if __name__ == "__main__":
raise SystemExit(main())