passages: prepared per-segment data + per-column XY projection cache (L98, exact)
Per-world prepared chord/length/radius/Catmull-Rom/floor-profile data (310 segments, ~66 KB, <0.04 ms); same expression grouping, divisions and square roots, so output is bit-identical (zero density/tile mismatches, Clang vs GCC equal). No measurable readiness gain - the cost is the number of samples running passage work, not per-sample arithmetic. Note: the report's world labels are shifted by one row (the 2,850-tile row is SurfaceWorld). Fast tier PASS; Linux UE host builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
1 parent
9d9504ae4e
commit
36140b573f
7 files changed
+1087
-180
No files matched your search
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare L97 baseline and L98 Clang/GCC whole-view tile hashes at LOD0-2."""
|
||||
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/l98/hashes"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
BINARIES = {
|
||||
"HEAD": ROOT / "Saved/Linux/l98/pre-bin/VoxelForgeCoreHeadless-l98-pre-clang",
|
||||
"L98-Clang": ROOT / "Saved/Linux/l98/bin/VoxelForgeCoreHeadless-l98-clang19",
|
||||
"L98-GCC": ROOT / "Saved/Linux/l98/bin/VoxelForgeCoreHeadless-l98-gcc",
|
||||
}
|
||||
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),
|
||||
}
|
||||
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)
|
||||
FIELDS = ("density", "mesh", "payload", "topology")
|
||||
|
||||
|
||||
def run(strate: int, label: str) -> dict:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
log = OUT / f"{label.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_L98_PASSAGE_PREP_TRACE=1", "timeout", "1740s",
|
||||
str(BINARIES[label]), 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-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) != int(whole.group(1)):
|
||||
raise RuntimeError(f"hash run failed or incomplete: exit={result.returncode} {log}")
|
||||
prep = re.findall(r"^\[L98PassagePrepare\] (.*)$", output, re.M)
|
||||
mouth_prep = re.findall(r"^\[L98PassageMouthPrepare\] (.*)$", output, re.M)
|
||||
row = {
|
||||
"binary": label, "strate": strate, "exit_code": result.returncode,
|
||||
"wall_s": round(time.monotonic() - start, 3), "tile_hash_count": len(hashes),
|
||||
"tile_hashes_by_lod": {str(lod): sum(1 for key in hashes if key[0] == lod)
|
||||
for lod in sorted({key[0] for key in hashes})},
|
||||
"whole_hash": whole.group(1, 2, 3, 4, 5), "hashes": hashes,
|
||||
"prepare_traces": prep, "mouth_prepare_traces": mouth_prep,
|
||||
"log": str(log.relative_to(ROOT)),
|
||||
}
|
||||
print("[L98HashRun] " + json.dumps(
|
||||
{k: v for k, v in row.items() if k != "hashes"},
|
||||
sort_keys=True), flush=True)
|
||||
return row
|
||||
|
||||
|
||||
def compare(strate: int, left_label: str, right_label: str,
|
||||
left: dict, right: dict) -> dict:
|
||||
mismatch_keys = sorted(key for key in set(left["hashes"]) | set(right["hashes"])
|
||||
if left["hashes"].get(key) != right["hashes"].get(key))
|
||||
component_mismatches = {}
|
||||
for component_index, component in enumerate(FIELDS):
|
||||
component_mismatches[component] = sum(
|
||||
left["hashes"].get(key, (None,) * 4)[component_index]
|
||||
!= right["hashes"].get(key, (None,) * 4)[component_index]
|
||||
for key in set(left["hashes"]) | set(right["hashes"]))
|
||||
near_density_mismatches = sum(
|
||||
key[0] <= 2 and left["hashes"].get(key, (None,) * 4)[0]
|
||||
!= right["hashes"].get(key, (None,) * 4)[0]
|
||||
for key in set(left["hashes"]) | set(right["hashes"]))
|
||||
item = {
|
||||
"strate": strate, "left": left_label, "right": right_label,
|
||||
"tiles_left": len(left["hashes"]), "tiles_right": len(right["hashes"]),
|
||||
"whole_hash_identical": left["whole_hash"] == right["whole_hash"],
|
||||
"tile_hashes_identical": not mismatch_keys,
|
||||
"mismatch_tile_count": len(mismatch_keys),
|
||||
"component_mismatch_tile_counts": component_mismatches,
|
||||
"lod0_2_density_mismatch_tile_count": near_density_mismatches,
|
||||
"first_mismatches": mismatch_keys[:8],
|
||||
"left_whole_hash": left["whole_hash"], "right_whole_hash": right["whole_hash"],
|
||||
}
|
||||
print("[L98HashComparison] " + json.dumps(item, sort_keys=True), flush=True)
|
||||
return item
|
||||
|
||||
|
||||
def main() -> int:
|
||||
for binary in (*BINARIES.values(), DATA):
|
||||
if not binary.is_file():
|
||||
raise SystemExit(f"missing input: {binary}")
|
||||
runs, comparisons = [], []
|
||||
for strate in CAMERAS:
|
||||
by_binary = {label: run(strate, label) for label in BINARIES}
|
||||
comparisons.append(compare(strate, "HEAD", "L98-Clang",
|
||||
by_binary["HEAD"], by_binary["L98-Clang"]))
|
||||
comparisons.append(compare(strate, "L98-Clang", "L98-GCC",
|
||||
by_binary["L98-Clang"], by_binary["L98-GCC"]))
|
||||
runs.extend({key: value for key, value in row.items() if key != "hashes"}
|
||||
for row in by_binary.values())
|
||||
summary = {"comparisons": comparisons, "runs": runs}
|
||||
(OUT / "summary.json").write_text(json.dumps(summary, indent=2) + "\n",
|
||||
encoding="utf-8")
|
||||
return 0 if all(item["tile_hashes_identical"] and item["whole_hash_identical"]
|
||||
for item in comparisons) else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user