passages: swept tube evaluates the exact route on in-bound cache misses (L100, v216)
L99 treated a missing exact-grid sweep sample as "no route here", so off-grid queries exposed the FI/TN boundary band inside passage 1-2 (flat ceiling/floor). In-bound misses now evaluate the exact route; a conservative route-feature bound still skips out-of-extent misses. Composition order unchanged (graph -> bands -> passage -> stamps -> floor caps). Comparison now counts added/removed crossings and triangles: 0/0 crossings on all four strates (FI +56 triangles). 1-2 mid-tunnel: L98->L100 changes 32k px (L99 changed 1.14M). Near-ready @W12 (L98/L99/L100): FI 2.62/1.78/2.05, TN 2.36/1.55/1.80, SW 1.17/0.95/1.04, VS 1.16/1.03/1.08 s. All walk audits pass; 24/24 Clang/GCC W1/W8/W12 determinism; fast tier PASS. 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
fa6363b31a
commit
2d5822cdf7
47 files changed
+1433
-22
No files matched your search
@@ -0,0 +1,144 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare the direct passage evaluator with the bounded L100 swept tube."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / "Saved/Linux/l100/density-compare"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
HEADLESS = ROOT / "Saved/Linux/l100/bin/VoxelForgeCoreHeadless-l100-clang"
|
||||
CAMERAS = {
|
||||
"SW": (8.0, 16.0, -372.2626953125),
|
||||
"FI": (25.8369140625, 3.19921875, -737.0),
|
||||
"TN": (19.166015625, -14.2001953125, -753.3740234375),
|
||||
"VS": (-20.0625, -5.068359375, -900.353515625),
|
||||
}
|
||||
SUMMARY = re.compile(r"^\[L93PassageReachSummary\] reach_m=4\.00 (.*)$", re.M)
|
||||
COVERAGE = re.compile(r"^\[L93PassageReachCoverage\] (.*)$", re.M)
|
||||
TILE = re.compile(
|
||||
r"^\[L93PassageReachTile\] reach_m=4\.00 key=\(([-\d]+),([-\d]+),([-\d]+),lod(\d+)\) "
|
||||
r"samples=(\d+) changed=(\d+) sign_flips=(\d+) moved_edges=(\d+) "
|
||||
r"added_crossings=(\d+) removed_crossings=(\d+) "
|
||||
r"added_surface_triangles=(\d+) removed_surface_triangles=(\d+) "
|
||||
r"max_displacement_cm=([\deE+.-]+) max_displacement_xyz_vox=\(([^)]*)\) "
|
||||
r"displacement_region=(\d+) normal_vertices=(\d+) max_normal_degrees=([\deE+.-]+) "
|
||||
r"max_normal_xyz_vox=\(([^)]*)\) normal_region=(\d+) changed_mesh=(\d+)$", re.M)
|
||||
VOXEL_SIZE_M = 0.25
|
||||
|
||||
|
||||
def xyz(text: str) -> list[float]:
|
||||
return [float(part) for part in text.split(",")]
|
||||
|
||||
|
||||
def parse_locations(output: str, strate: str) -> tuple[list[dict], list[dict]]:
|
||||
rows = []
|
||||
for match in TILE.finditer(output):
|
||||
(x, y, z, lod, samples, changed, flips, moved, added, removed,
|
||||
added_triangles, removed_triangles, displacement, displacement_xyz,
|
||||
displacement_region, normal_vertices, angle, normal_xyz, normal_region,
|
||||
changed_mesh) = match.groups()
|
||||
disp_vox = xyz(displacement_xyz)
|
||||
normal_vox = xyz(normal_xyz)
|
||||
rows.append({
|
||||
"strate": strate, "tile": [int(x), int(y), int(z), int(lod)],
|
||||
"samples": int(samples), "changed_samples": int(changed),
|
||||
"sign_flips": int(flips), "moved_edges": int(moved),
|
||||
"surface_added_crossings": int(added),
|
||||
"surface_removed_crossings": int(removed),
|
||||
"surface_added_triangles": int(added_triangles),
|
||||
"surface_removed_triangles": int(removed_triangles),
|
||||
"max_displacement_cm": float(displacement),
|
||||
"displacement_location_voxels": disp_vox,
|
||||
"displacement_location_metres": [value * VOXEL_SIZE_M for value in disp_vox],
|
||||
"displacement_region": int(displacement_region),
|
||||
"normal_vertices": int(normal_vertices), "max_normal_degrees": float(angle),
|
||||
"normal_location_voxels": normal_vox,
|
||||
"normal_location_metres": [value * VOXEL_SIZE_M for value in normal_vox],
|
||||
"normal_region": int(normal_region), "changed_mesh": bool(int(changed_mesh)),
|
||||
})
|
||||
top_displacement = sorted(rows, key=lambda row: row["max_displacement_cm"], reverse=True)[:5]
|
||||
top_normals = sorted(rows, key=lambda row: row["max_normal_degrees"], reverse=True)[:5]
|
||||
return top_displacement, top_normals
|
||||
|
||||
|
||||
def top_unique(rows: list[dict], value_key: str, location_key: str) -> list[dict]:
|
||||
chosen, seen = [], set()
|
||||
for row in sorted(rows, key=lambda item: item[value_key], reverse=True):
|
||||
if row[value_key] <= 0.0:
|
||||
continue
|
||||
location = tuple(round(value, 4) for value in row[location_key])
|
||||
if location in seen:
|
||||
continue
|
||||
seen.add(location)
|
||||
chosen.append(row)
|
||||
if len(chosen) == 5:
|
||||
break
|
||||
return chosen
|
||||
|
||||
|
||||
def run(strate: str) -> dict:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
log = OUT / f"reach-{strate.lower()}.log"
|
||||
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
|
||||
command = [
|
||||
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
||||
"timeout", "1740s", str(HEADLESS), str(DATA), "--world-assembler-prototype",
|
||||
"--stream-benchmark", "--stream-pipeline", "--workers=8", "--clip-radius=3",
|
||||
"--max-clip-level=8", "--max-level=8", f"--camera={camera}",
|
||||
"--audit-passage-carve-reach",
|
||||
]
|
||||
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")
|
||||
summary_match, coverage_match = SUMMARY.search(output), COVERAGE.search(output)
|
||||
if summary_match is None or coverage_match is None or result.returncode in (-9, 124):
|
||||
raise RuntimeError(f"incomplete carve-reach audit: exit={result.returncode} {log}")
|
||||
reach = dict(re.findall(r"([a-zA-Z0-9_]+)=([^ ]+)", summary_match.group(1)))
|
||||
coverage = dict(re.findall(r"([a-zA-Z0-9_]+)=([^ ]+)", coverage_match.group(1)))
|
||||
top_displacement, top_normals = parse_locations(output, strate)
|
||||
row = {
|
||||
"strate": strate, "exit_code": result.returncode,
|
||||
"wall_s": round(time.monotonic() - start, 3), "coverage": coverage,
|
||||
"bounded_sweep_summary": reach,
|
||||
"bounded_sweep_tile_rows": len(TILE.findall(output)),
|
||||
"top_displacement_tiles": top_displacement,
|
||||
"top_normal_tiles": top_normals,
|
||||
"log": str(log.relative_to(ROOT)),
|
||||
}
|
||||
print("[L100DensityCompareRun] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
return row
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if not HEADLESS.is_file() or not DATA.is_file():
|
||||
raise SystemExit(f"missing input: {HEADLESS if not HEADLESS.is_file() else DATA}")
|
||||
if "--summarize-only" in sys.argv:
|
||||
rows = json.loads((OUT / "runs-partial.json").read_text(encoding="utf-8"))
|
||||
else:
|
||||
rows = []
|
||||
for strate in CAMERAS:
|
||||
rows.append(run(strate))
|
||||
(OUT / "runs-partial.json").write_text(json.dumps(rows, indent=2) + "\n",
|
||||
encoding="utf-8")
|
||||
all_displacements = [row for result in rows for row in result["top_displacement_tiles"]]
|
||||
all_normals = [row for result in rows for row in result["top_normal_tiles"]]
|
||||
top_displacement = top_unique(all_displacements, "max_displacement_cm",
|
||||
"displacement_location_metres")
|
||||
top_normals = top_unique(all_normals, "max_normal_degrees", "normal_location_metres")
|
||||
summary = {"runs": rows, "top_displacement_tiles": top_displacement,
|
||||
"top_normal_tiles": top_normals}
|
||||
(OUT / "summary.json").write_text(json.dumps(summary, indent=2) + "\n",
|
||||
encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user