profile: per-LOD whole-view breakdown for the four-strate owner world (L73, no world change)

FI/TN/VS (legacy compiled-analytic) skip ZERO tiles at every LOD and evaluate ~44k density
points per LOD0/1 tile; SW skips 359/512 at LOD0. The whole-tile skip requires a native
tile with a uniform verdict, and the legacy paths return Mixed/unknown (R39 notes attached).
Opt-in stage timers, sampled field timer, per-LOD classification and composer counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-27 08:48:57 +01:00
1 parent d970d75be8
commit bd1b2a8f1d
10 files changed
+702 -5

No files matched your search

@@ -0,0 +1,180 @@
#!/usr/bin/env python3
"""Run interleaved clean/profiled whole views for the four owner arrivals."""
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/l73/breakdown"
DATA = ROOT / "Standalone/data/owner_world.json"
CLEAN_BIN = ROOT / "Saved/Linux/l72/bin-final-clang/VoxelForgeCoreHeadless-l72-final-clang"
PROFILE_BIN = ROOT / "Saved/Linux/l73/bin/VoxelForgeCoreHeadless-l73-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),
}
PAIR_ORDER = (("clean", "profile"), ("profile", "clean"), ("clean", "profile"))
KV = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
def parse_profile_log(path: Path) -> dict:
pipeline = {}
worker_by_lod: dict[str, dict] = {}
classes_by_lod: dict[str, dict] = {}
costs_by_lod: dict[str, dict] = {}
stages_by_lod: dict[str, dict] = {}
island_by_lod: dict[str, dict] = {}
passage_by_lod: dict[str, dict] = {}
plan_hash = None
layout_identity = None
whole_tiles = None
with path.open(encoding="utf-8", errors="replace") as stream:
for line in stream:
if line.startswith("[WorldAssemblerPlanSource]"):
plan_hash = re.search(r"manifest_hash=(\S+)", line).group(1)
elif line.startswith("[ResolvedLayoutSnapshot]"):
layout_identity = re.search(r"stable_identity=(\S+)", line).group(1)
elif line.startswith("[WorldAssemblerLODWorker]"):
row = dict(KV.findall(line))
worker_by_lod[row["lod"]] = row
elif line.startswith("[WorldAssemblerLODClassification]"):
row = dict(KV.findall(line))
classes_by_lod[row["lod"]] = row
elif line.startswith("[WorldAssemblerLODCostDetail]"):
row = dict(KV.findall(line))
costs_by_lod[row["lod"]] = row
elif line.startswith("[CpuTileStages]"):
row = dict(KV.findall(line))
key = row.get("key", "")
match = re.search(r"lod(\d+)", key)
if match:
target = stages_by_lod.setdefault(match.group(1), {})
for name in ("payload_ms", "classify_ms"):
target[name] = target.get(name, 0.0) + float(row.get(name, "0"))
elif line.startswith("[FiFieldAttribution]"):
row = dict(KV.findall(line))
match = re.search(r"lod(\d+)", row.get("key", ""))
if match:
target = island_by_lod.setdefault(match.group(1), {})
for name, value in row.items():
if name.endswith("_ns_est"):
target[name] = target.get(name, 0) + int(value.split("/", 1)[0])
elif line.startswith("[PassageComposerTile]"):
row = dict(KV.findall(line))
key = row.get("key", "")
match = re.search(r"lod(\d+)", key)
if match:
target = passage_by_lod.setdefault(match.group(1), {})
for name, value in row.items():
if name in ("native_field_calls", "queries", "passage_iterations",
"carve_segment_visits", "smooth_carve_joins",
"support_segment_visits", "smooth_support_joins",
"mouth_route_segment_checks", "relief_field_calls",
"smoothstep_evaluations"):
target[name] = target.get(name, 0) + int(value.split("/", 1)[0])
elif line.startswith("[StreamPipeline]"):
pipeline = dict(KV.findall(line))
whole_tiles = re.search(r"whole_tiles=(\d+)/(\d+)", line)
worker_seconds = sum(float(row.get("worker_sum_s", 0))
for row in worker_by_lod.values())
return {
"pipeline": pipeline,
"whole_tiles": int(whole_tiles.group(1)) if whole_tiles else None,
"plan_hash": plan_hash,
"layout_identity": layout_identity,
"worker_seconds": worker_seconds,
"worker_by_lod": worker_by_lod,
"classification_by_lod": classes_by_lod,
"cost_by_lod": costs_by_lod,
"stages_by_lod": stages_by_lod,
"floating_island_attribution_by_lod": island_by_lod,
"passage_composer_by_lod": passage_by_lod,
}
def run(strate: int, pair: int, mode: str) -> dict:
binary = CLEAN_BIN if mode == "clean" else PROFILE_BIN
label = f"strate{strate}-pair{pair}-{mode}"
folder = OUT / f"strate{strate}"
folder.mkdir(parents=True, exist_ok=True)
log = folder / f"{label}.log"
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
command = [
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", str(binary), 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}",
]
if mode == "profile":
command += ["--profile-lod-work", "--instrument-tile-drain",
"--profile-passage-composer"]
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)
process_wall = time.monotonic() - started
parsed = parse_profile_log(log)
pipeline = parsed["pipeline"]
row = {
"strate": strate,
"pair": pair,
"mode": mode,
"exit_code": result.returncode,
"process_wall_s": process_wall,
"whole_view_ready_s": float(pipeline["whole_view_ready"][:-1])
if "whole_view_ready" in pipeline else None,
"worker_seconds": parsed["worker_seconds"],
"whole_tiles": parsed["whole_tiles"],
"plan_hash": parsed["plan_hash"],
"layout_identity": parsed["layout_identity"],
"log": str(log.relative_to(ROOT)),
"details": parsed if mode == "profile" else None,
}
result_path = folder / f"{label}.json"
result_path.write_text(json.dumps(row, indent=2) + "\n", encoding="utf-8")
print("[L73Run] " + json.dumps({key: value for key, value in row.items()
if key != "details"}, sort_keys=True), flush=True)
return row
def main() -> int:
missing = [str(path) for path in (DATA, CLEAN_BIN, PROFILE_BIN) if not path.is_file()]
if missing:
raise SystemExit("missing input: " + ", ".join(missing))
rows = []
for strate in range(4):
for pair, order in enumerate(PAIR_ORDER, start=1):
for mode in order:
row = run(strate, pair, mode)
rows.append(row)
if row["exit_code"] != 0 or row["whole_view_ready_s"] is None:
break
else:
continue
break
if any(row["strate"] == strate and (row["exit_code"] != 0
or row["whole_view_ready_s"] is None) for row in rows):
break
summary = OUT / "summary.json"
summary.write_text(json.dumps(rows, indent=2) + "\n", encoding="utf-8")
complete = len(rows) == 24 and all(
row["exit_code"] == 0 and row["whole_view_ready_s"] is not None
and row["whole_tiles"] is not None for row in rows)
print(f"[L73Breakdown] runs={len(rows)}/24 complete={str(complete).lower()} "
f"summary={summary.relative_to(ROOT)}", flush=True)
return 0 if complete else 2
if __name__ == "__main__":
raise SystemExit(main())