core: A/A noise floor (±1%) and small hot-path trims for the cave planner (L137, output = v236)
Identical builds differ <=0.6% median; residual near-ready vs assembler/world is real: Surface World +2.9..+3.6%, Vertical Shafts +4.0..+4.3%, Tunnel Network -3.6/+6.8%. Profile points at column-cache reads and the sweep lookup. Removed an unused sample field and per-lookup shared_ptr refcounting. 16/16 seeds, fast tier, Clang/GCC green. 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
08cc3bd89b
commit
05e78331fe
9 files changed
+786
-24
No files matched your search
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env python3
|
||||
"""All-LOD inclusive L77 samples for assembler/world and L137 HEAD."""
|
||||
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/l137/profile"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
BINARIES = {
|
||||
"assembler-world": ROOT / "Saved/Linux/l137/profile-bin/VoxelForgeCoreHeadless-l137-profile-base",
|
||||
"head": ROOT / "Saved/Linux/l137/profile-bin/VoxelForgeCoreHeadless-l137-profile-head",
|
||||
}
|
||||
STAMPS = {
|
||||
"assembler-world": "4499fb2a8a4ede7d6cbc68d1b794f104658cdaae93ed9cacbc91fe7ff3fc3621",
|
||||
"head": "dcf2ffa55fd6d62b3c7faf76229c3b99c635868dc1b694fc6e8f39e738775a4e",
|
||||
}
|
||||
CAMERA = "8.000000000000,16.000000000000,-372.262695312500,0,0"
|
||||
STAMP_RE = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M)
|
||||
SAMPLER_RE = re.compile(r"^\[L77Sampler\] action=stop (.*)$", re.M)
|
||||
SAMPLE_RE = re.compile(
|
||||
r"^\[L77Sample\] pc=(0x\w+) lod=(\d+) stage=(\S+) route=(\S+) "
|
||||
r"phase=(\S+) halo=(\d+) weight=(\d+)$", re.M)
|
||||
|
||||
|
||||
def run(version: str, replicate: int) -> dict:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
log = OUT / f"sw-{version}-r{replicate}.log"
|
||||
command = [
|
||||
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
||||
"timeout", "1740s", str(BINARIES[version]), str(DATA),
|
||||
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
|
||||
"--workers=8", "--clip-radius=3", "--max-clip-level=8", "--max-level=8",
|
||||
f"--camera={CAMERA}", "--profile-lod-work", "--stream-scheduler-policy=3",
|
||||
"--linux77-profile",
|
||||
]
|
||||
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)
|
||||
content = log.read_text(encoding="utf-8", errors="replace")
|
||||
stamp, sampler = STAMP_RE.search(content), SAMPLER_RE.search(content)
|
||||
samples = SAMPLE_RE.findall(content)
|
||||
if (result.returncode or stamp is None or sampler is None
|
||||
or stamp.group(1) != STAMPS[version] or "status=PASS" not in sampler.group(1)):
|
||||
raise SystemExit(f"L77 profile failed or stamp mismatch: {log}; exit={result.returncode}")
|
||||
sam = dict(re.findall(r"([a-zA-Z0-9_]+)=([^ ]+)", sampler.group(1)))
|
||||
lods = sorted({int(row[1]) for row in samples})
|
||||
row = {
|
||||
"world": "Surface World", "version": version, "replicate": replicate,
|
||||
"source_stamp": stamp.group(1), "workers": 8, "lods_sampled": lods,
|
||||
"stored_samples": len(samples), "expanded_ticks": int(sam["expanded_ticks"]),
|
||||
"lost": int(sam["lost"]), "timer_threads": int(sam["timer_threads"]),
|
||||
"profiled_thread_cpu_s": float(sam["profiled_thread_cpu_s"]),
|
||||
"handler_cpu_ms": float(sam["handler_cpu_ms"]),
|
||||
"wall_s": round(time.monotonic() - started, 3),
|
||||
"log": str(log.relative_to(ROOT)),
|
||||
}
|
||||
print("[L137ProfileRun] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
return row
|
||||
|
||||
|
||||
def main() -> int:
|
||||
missing = [str(path) for path in [DATA, *BINARIES.values()] if not path.is_file()]
|
||||
if missing:
|
||||
raise SystemExit("missing L137 profile input: " + ", ".join(missing))
|
||||
rows = []
|
||||
for replicate, order in enumerate((
|
||||
("assembler-world", "head"), ("head", "assembler-world"),
|
||||
("assembler-world", "head")), 1):
|
||||
for version in order:
|
||||
rows.append(run(version, replicate))
|
||||
(OUT / "runs-partial.json").write_text(
|
||||
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
||||
(OUT / "runs.json").write_text(json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user