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,120 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Symbolize L137 L77 samples and compare inclusive worker functions."""
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / "Saved/Linux/l137/profile"
|
||||
BINARIES = {
|
||||
"assembler-world": ROOT / "Saved/Linux/l137/profile-bin/VoxelForgeCoreHeadless-l137-profile-base",
|
||||
"head": ROOT / "Saved/Linux/l137/profile-bin/VoxelForgeCoreHeadless-l137-profile-head",
|
||||
}
|
||||
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 samples(version: str) -> tuple[list[dict], set[str]]:
|
||||
rows, pcs = [], set()
|
||||
for replicate in (1, 2, 3):
|
||||
path = OUT / f"sw-{version}-r{replicate}.log"
|
||||
for pc, lod, stage, route, phase, halo, weight in SAMPLE_RE.findall(
|
||||
path.read_text(encoding="utf-8", errors="replace")):
|
||||
lod_value = int(lod)
|
||||
if not 0 <= lod_value <= 8:
|
||||
continue
|
||||
pcs.add(pc)
|
||||
rows.append({"version": version, "replicate": replicate,
|
||||
"pc": pc, "lod": lod_value, "stage": stage,
|
||||
"route": route, "phase": phase, "halo": int(halo),
|
||||
"weight": int(weight)})
|
||||
return rows, pcs
|
||||
|
||||
|
||||
def symbolize(version: str, pcs: set[str]) -> dict[str, str]:
|
||||
command = ["llvm-symbolizer-19", "--demangle", "--inlines", "--output-style=JSON",
|
||||
f"--obj={BINARIES[version]}"]
|
||||
result = subprocess.run(command, input="\n".join(sorted(pcs)) + "\n",
|
||||
capture_output=True, text=True, check=True)
|
||||
decoder = json.JSONDecoder()
|
||||
offset, output = 0, {}
|
||||
while offset < len(result.stdout):
|
||||
while offset < len(result.stdout) and result.stdout[offset].isspace():
|
||||
offset += 1
|
||||
if offset == len(result.stdout):
|
||||
break
|
||||
item, offset = decoder.raw_decode(result.stdout, offset)
|
||||
frames = item.get("Symbol", [])
|
||||
output[item["Address"]] = (
|
||||
frames[0].get("FunctionName", "?") if frames else "?")
|
||||
if output.keys() != pcs:
|
||||
raise RuntimeError(f"{version}: symbolizer resolved {len(output)}/{len(pcs)} PCs")
|
||||
return output
|
||||
|
||||
|
||||
def main() -> int:
|
||||
totals: dict[str, Counter] = {}
|
||||
lod_totals: dict[str, Counter] = {}
|
||||
detail_rows = []
|
||||
for version in BINARIES:
|
||||
rows, pcs = samples(version)
|
||||
symbols = symbolize(version, pcs)
|
||||
totals[version] = Counter()
|
||||
lod_totals[version] = Counter()
|
||||
for row in rows:
|
||||
function = symbols[row["pc"]]
|
||||
weight = row["weight"]
|
||||
totals[version][function] += weight
|
||||
lod_totals[version][row["lod"]] += weight
|
||||
detail_rows.append({**row, "function": function})
|
||||
total_by_version = {key: sum(counter.values()) for key, counter in totals.items()}
|
||||
functions = set(totals["assembler-world"]) | set(totals["head"])
|
||||
result = []
|
||||
for function in functions:
|
||||
base_ticks = totals["assembler-world"][function]
|
||||
head_ticks = totals["head"][function]
|
||||
base_pct = 100.0 * base_ticks / total_by_version["assembler-world"]
|
||||
head_pct = 100.0 * head_ticks / total_by_version["head"]
|
||||
result.append({
|
||||
"function": function,
|
||||
"assembler_world_ticks": base_ticks,
|
||||
"assembler_world_share_pct": round(base_pct, 3),
|
||||
"head_ticks": head_ticks,
|
||||
"head_share_pct": round(head_pct, 3),
|
||||
"share_delta_pp": round(head_pct - base_pct, 3),
|
||||
})
|
||||
result.sort(key=lambda row: abs(row["share_delta_pp"]), reverse=True)
|
||||
with (OUT / "function-diff.csv").open("w", encoding="utf-8", newline="") as stream:
|
||||
writer = csv.DictWriter(stream, fieldnames=list(result[0]))
|
||||
writer.writeheader()
|
||||
writer.writerows(result)
|
||||
with (OUT / "symbolized-samples.csv").open(
|
||||
"w", encoding="utf-8", newline="") as stream:
|
||||
writer = csv.DictWriter(stream, fieldnames=list(detail_rows[0]))
|
||||
writer.writeheader()
|
||||
writer.writerows(detail_rows)
|
||||
summary = {
|
||||
"scope": "worker samples LOD0-8, all LODs included; lod=255 main-thread samples excluded",
|
||||
"runs_per_version": 3,
|
||||
"weighted_ticks": total_by_version,
|
||||
"lod_weighted_ticks": {version: dict(sorted(values.items()))
|
||||
for version, values in lod_totals.items()},
|
||||
"function_diff": result,
|
||||
}
|
||||
(OUT / "function-diff.json").write_text(
|
||||
json.dumps(summary, indent=2) + "\n", encoding="utf-8")
|
||||
print("[L137ProfileDiff] " + json.dumps({
|
||||
"scope": summary["scope"], "weighted_ticks": total_by_version,
|
||||
"lod_weighted_ticks": summary["lod_weighted_ticks"],
|
||||
"largest_share_deltas": result[:20]}, sort_keys=True))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,26 @@
|
||||
# Linux137 report
|
||||
|
||||
## Measurement
|
||||
|
||||
Two `assembler/world` binaries had identical SHA-256. On Surface World, their L80 near-ready medians differed by +0.52% at W8 and −0.59% at W12. The no-op v228 control differed by −0.37% and −0.05%; its stream hashes matched v227. Use ±1% as the median noise floor. Individual paired controls varied by up to about 2.5% (3.6% for one no-op pair).
|
||||
|
||||
The three-run L77 profile sampled LOD 0–8 with no lost samples. Function share changes, `HEAD` versus `assembler/world`: `CachedColumn` +0.93 pp, shared column `TryRead` +0.58 pp, `prepareSweptTubeBase` +0.38 pp, and `sweptSample` +0.17 pp. `ApplyResolvedStratePassageCarves` fell by 0.97 pp and `FindBoundStratumForManagerZ` by 0.39 pp. The profile points more toward column-cache work and the sweep lookup than mouth-profile work; it does not isolate one cause for every world.
|
||||
|
||||
Changes retained: removed the unused `floorShellSignedDistance` sample field; removed per-lookup shared-pointer refcounting and batched diagnostic counters per query scope.
|
||||
|
||||
## L80 near-ready medians
|
||||
|
||||
Each delta is candidate versus `assembler/world`; the A/A median noise floor is ±1%.
|
||||
|
||||
| World | W8 delta | W12 delta |
|
||||
|---|---:|---:|
|
||||
| Surface World | +3.58% (±1%) | +2.90% (±1%) |
|
||||
| Floating Islands | +0.19% (±1%) | +2.20% (±1%) |
|
||||
| Tunnel Network | −3.60% (±1%) | +6.84% (±1%) |
|
||||
| Vertical Shafts | +4.31% (±1%) | +3.96% (±1%) |
|
||||
|
||||
The requested targets are not met except Floating Islands W8 and Tunnel Network W8. Whole-view medians were within −8.39% to +0.27% of baseline.
|
||||
|
||||
## Verification
|
||||
|
||||
Fast tier passed (273 checks); the composed sweep passed 16/16 seeds with seams and blocked controls; Clang/GCC W1/W8/W12 matched all 13 hashes. Linux UE host build passed with `-NoUBA -MaxParallelActions=4` and no `prlimit`. Output audits stayed green, so version and baselines were left unchanged. No commit, push, or stash.
|
||||
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env python3
|
||||
"""L80 Surface World A/A and no-op evaluator-version control timings."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import statistics
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / "Saved/Linux/l137/timing/aa"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
BINARIES = {
|
||||
"aa_a": ROOT / "Saved/Linux/l137/bin/VoxelForgeCoreHeadless-l137-aa-a",
|
||||
"aa_b": ROOT / "Saved/Linux/l137/bin/VoxelForgeCoreHeadless-l137-aa-b",
|
||||
"v228": ROOT / "Saved/Linux/l137/bin/VoxelForgeCoreHeadless-l137-v228",
|
||||
}
|
||||
CAMERA = "8.000000000000,16.000000000000,-372.262695312500,0,0"
|
||||
PIPELINE = re.compile(r"^\[StreamPipeline\] (.*)$", re.M)
|
||||
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
|
||||
NEAR = re.compile(
|
||||
r"^\[WorldAssemblerNearLODReady\] lods=0-2 tiles=(\d+)/(\d+) cold_ready_s=([0-9.]+)$",
|
||||
re.M)
|
||||
STAMP = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M)
|
||||
|
||||
|
||||
def run(workers: int, version: str, phase: str, replicate: int) -> dict:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
label = f"sw-w{workers}-{version}-{phase}{replicate}"
|
||||
log = OUT / f"{label}.log"
|
||||
command = [
|
||||
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
||||
"timeout", "1740s", str(BINARIES[version]), str(DATA),
|
||||
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
|
||||
f"--workers={workers}", "--clip-radius=3", "--max-clip-level=8",
|
||||
"--max-level=8", f"--camera={CAMERA}", "--profile-lod-work",
|
||||
"--stream-scheduler-policy=3",
|
||||
]
|
||||
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")
|
||||
pipeline, near, stamp = PIPELINE.search(content), NEAR.search(content), STAMP.search(content)
|
||||
if result.returncode or pipeline is None or near is None or stamp is None:
|
||||
raise SystemExit(f"L80 run failed or trace missing: {log}; exit={result.returncode}")
|
||||
fields = dict(FIELDS.findall(pipeline.group(1)))
|
||||
row = {
|
||||
"strate": 0, "workers": workers, "version": version,
|
||||
"phase": phase, "replicate": replicate, "source_stamp": stamp.group(1),
|
||||
"lod02_ready_s": float(near.group(3)),
|
||||
"whole_view_ready_s": float(fields["whole_view_ready"].removesuffix("s")),
|
||||
"whole_tiles": int(fields["whole_tiles"].split("/")[0]),
|
||||
"wall_s": round(time.monotonic() - started, 3),
|
||||
"log": str(log.relative_to(ROOT)),
|
||||
}
|
||||
print("[L137AARun] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
return row
|
||||
|
||||
|
||||
def quiet_machine() -> tuple[float, float]:
|
||||
load_1m = os.getloadavg()[0]
|
||||
|
||||
def totals() -> tuple[int, int]:
|
||||
fields = Path("/proc/stat").read_text().splitlines()[0].split()
|
||||
values = [int(value) for value in fields[1:]]
|
||||
return sum(values), values[3] + values[4]
|
||||
|
||||
before = totals()
|
||||
time.sleep(2.0)
|
||||
after = totals()
|
||||
idle = 100.0 * (after[1] - before[1]) / max(1, after[0] - before[0])
|
||||
return load_1m, idle
|
||||
|
||||
|
||||
def main() -> int:
|
||||
missing = [str(path) for path in [DATA, *BINARIES.values()] if not path.is_file()]
|
||||
if missing:
|
||||
raise SystemExit("missing L137 A/A input: " + ", ".join(missing))
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
load_1m, idle = quiet_machine()
|
||||
(OUT / "machine-load-before.txt").write_text(
|
||||
f"1-minute load: {load_1m:.2f}\n2-second CPU idle: {idle:.1f}%\n")
|
||||
print(f"[L137AAGate] load_1m={load_1m:.2f} cpu_idle_2s={idle:.1f}%", flush=True)
|
||||
if load_1m >= 0.9 or idle < 97.0:
|
||||
raise SystemExit("timing refused: machine is above the L80 quiet-load gate")
|
||||
|
||||
rows = []
|
||||
versions = tuple(BINARIES)
|
||||
for workers in (8, 12):
|
||||
for version in versions:
|
||||
run(workers, version, "warmup", 0)
|
||||
orders = (versions, ("v228", "aa_b", "aa_a"),
|
||||
("aa_b", "aa_a", "v228"), ("aa_a", "v228", "aa_b"),
|
||||
("v228", "aa_a", "aa_b"))
|
||||
for replicate, order in enumerate(orders, 1):
|
||||
for version in order:
|
||||
rows.append(run(workers, version, "measured", replicate))
|
||||
(OUT / "runs-partial.json").write_text(
|
||||
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
||||
|
||||
summary = []
|
||||
for workers in (8, 12):
|
||||
group = [row for row in rows if row["workers"] == workers]
|
||||
medians = {
|
||||
version: {
|
||||
key: statistics.median(row[key] for row in group
|
||||
if row["version"] == version)
|
||||
for key in ("lod02_ready_s", "whole_view_ready_s")
|
||||
}
|
||||
for version in versions
|
||||
}
|
||||
item = {"strate": 0, "workers": workers, "replicates_per_version": 5,
|
||||
"medians": medians}
|
||||
for metric in ("lod02_ready_s", "whole_view_ready_s"):
|
||||
for lhs, rhs in (("aa_b", "aa_a"), ("v228", "aa_a")):
|
||||
item[f"{lhs}_vs_{rhs}_{metric}_delta_pct"] = round(
|
||||
100.0 * (medians[lhs][metric] / medians[rhs][metric] - 1.0), 3)
|
||||
paired = []
|
||||
for replicate in range(1, 6):
|
||||
values = {row["version"]: row[metric] for row in group
|
||||
if row["phase"] == "measured" and row["replicate"] == replicate}
|
||||
paired.append({"replicate": replicate,
|
||||
"aa_b_vs_aa_a_pct": round(
|
||||
100.0 * (values["aa_b"] / values["aa_a"] - 1.0), 3),
|
||||
"v228_vs_aa_a_pct": round(
|
||||
100.0 * (values["v228"] / values["aa_a"] - 1.0), 3)})
|
||||
item[f"{metric}_paired_deltas_pct"] = paired
|
||||
summary.append(item)
|
||||
(OUT / "summary.json").write_text(
|
||||
json.dumps({"runs": rows, "summary": summary}, indent=2) + "\n",
|
||||
encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare L137 Clang/GCC composed hashes at W1, W8, and W12."""
|
||||
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/determinism"
|
||||
DATA = ROOT / "Standalone/data/regression/owner_world_2strate_l61.json"
|
||||
BINARIES = {
|
||||
"clang": ROOT / "Saved/Linux/l137/fast/bin/VoxelForgeCoreHeadless-fast-clang",
|
||||
"gcc": ROOT / "Saved/Linux/l137/fast/bin/VoxelForgeCoreHeadless-fast-gcc",
|
||||
}
|
||||
STAMP = "dcf2ffa55fd6d62b3c7faf76229c3b99c635868dc1b694fc6e8f39e738775a4e"
|
||||
CAMERA = "-4.688214,38.662384,-505.781342,-28.446,0"
|
||||
HASH_RE = re.compile(
|
||||
r"^\[Pipeline(?:FullDetailHash|WholeViewHash|MaterialHash|LODHash|ExactQueryHash)\].*$",
|
||||
re.M)
|
||||
STAMP_RE = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if any(not path.is_file() for path in (DATA, *BINARIES.values())):
|
||||
raise SystemExit("missing L137 determinism binary or owner fixture")
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
rows = []
|
||||
baseline: tuple[str, ...] | None = None
|
||||
for compiler, binary in BINARIES.items():
|
||||
for workers in (1, 8, 12):
|
||||
label = f"determinism-{compiler}-w{workers}"
|
||||
log = OUT / f"{label}.log"
|
||||
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
||||
"timeout", "1740s", str(binary), str(DATA),
|
||||
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
|
||||
f"--workers={workers}", "--clip-radius=3", "--max-clip-level=0",
|
||||
"--max-level=0", f"--camera={CAMERA}", "--stream-hash-tiles",
|
||||
"--force-generate", "--recipe=surface-world", "--render-distance-chunks=0",
|
||||
"--landmark-chamber-demo", "--ore-veins-demo"]
|
||||
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 = STAMP_RE.search(content)
|
||||
hashes = tuple(HASH_RE.findall(content))
|
||||
passed = (result.returncode == 0 and stamp is not None
|
||||
and stamp.group(1) == STAMP and len(hashes) >= 4)
|
||||
if baseline is None and passed:
|
||||
baseline = hashes
|
||||
elif baseline is not None:
|
||||
passed &= hashes == baseline
|
||||
row = {"compiler": compiler, "workers": workers, "exit": result.returncode,
|
||||
"stamp": stamp.group(1) if stamp else None, "hash_lines": len(hashes),
|
||||
"hashes_match_first": hashes == baseline, "passed": bool(passed),
|
||||
"elapsed_s": round(time.monotonic() - started, 3),
|
||||
"log": str(log.relative_to(ROOT))}
|
||||
rows.append(row)
|
||||
print("[L137DeterminismRun] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
if not passed:
|
||||
(OUT / "summary.json").write_text(json.dumps(
|
||||
{"status": "FAIL", "stamp": STAMP, "runs": rows}, indent=2) + "\n")
|
||||
raise SystemExit(f"determinism mismatch; see {log}")
|
||||
(OUT / "summary.json").write_text(json.dumps(
|
||||
{"status": "PASS", "stamp": STAMP, "runs": rows}, indent=2) + "\n")
|
||||
print(f"[L137DeterminismSummary] runs={len(rows)} stamp={STAMP} status=PASS")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Five interleaved L80 timings for assembler/world and the L137 candidate."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import statistics
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / "Saved/Linux/l137/timing/final"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
BINARIES = {
|
||||
"assembler-world": (
|
||||
ROOT / "Saved/Linux/l137/bin/VoxelForgeCoreHeadless-l137-aa-a",
|
||||
"4499fb2a8a4ede7d6cbc68d1b794f104658cdaae93ed9cacbc91fe7ff3fc3621"),
|
||||
"l137": (
|
||||
ROOT / "Saved/Linux/l137/fast/bin/VoxelForgeCoreHeadless-fast-clang",
|
||||
"dcf2ffa55fd6d62b3c7faf76229c3b99c635868dc1b694fc6e8f39e738775a4e"),
|
||||
}
|
||||
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),
|
||||
}
|
||||
PIPELINE = re.compile(r"^\[StreamPipeline\] (.*)$", re.M)
|
||||
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
|
||||
NEAR = re.compile(
|
||||
r"^\[WorldAssemblerNearLODReady\] lods=0-2 tiles=(\d+)/(\d+) cold_ready_s=([0-9.]+)$",
|
||||
re.M)
|
||||
STAMP = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M)
|
||||
|
||||
|
||||
def run(strate: int, workers: int, version: str, phase: str, replicate: int) -> dict:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
binary, expected_stamp = BINARIES[version]
|
||||
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
|
||||
label = f"s{strate}-w{workers}-{version}-{phase}{replicate}"
|
||||
log = OUT / f"{label}.log"
|
||||
command = [
|
||||
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
||||
"timeout", "1740s", str(binary), str(DATA), "--world-assembler-prototype",
|
||||
"--stream-benchmark", "--stream-pipeline", f"--workers={workers}",
|
||||
"--clip-radius=3", "--max-clip-level=8", "--max-level=8",
|
||||
f"--camera={camera}", "--profile-lod-work", "--stream-scheduler-policy=3",
|
||||
]
|
||||
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")
|
||||
pipeline, near, stamp = PIPELINE.search(content), NEAR.search(content), STAMP.search(content)
|
||||
if (result.returncode or pipeline is None or near is None or stamp is None
|
||||
or stamp.group(1) != expected_stamp):
|
||||
raise SystemExit(f"L80 timing failed or stamp mismatch: {log}; exit={result.returncode}")
|
||||
fields = dict(FIELDS.findall(pipeline.group(1)))
|
||||
row = {
|
||||
"strate": strate, "workers": workers, "version": version,
|
||||
"phase": phase, "replicate": replicate, "source_stamp": stamp.group(1),
|
||||
"lod02_ready_s": float(near.group(3)),
|
||||
"whole_view_ready_s": float(fields["whole_view_ready"].removesuffix("s")),
|
||||
"whole_tiles": int(fields["whole_tiles"].split("/")[0]),
|
||||
"wall_s": round(time.monotonic() - started, 3),
|
||||
"log": str(log.relative_to(ROOT)),
|
||||
}
|
||||
print("[L137FinalTimingRun] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
return row
|
||||
|
||||
|
||||
def quiet_machine() -> tuple[float, float]:
|
||||
load_1m = os.getloadavg()[0]
|
||||
|
||||
def totals() -> tuple[int, int]:
|
||||
fields = Path("/proc/stat").read_text().splitlines()[0].split()
|
||||
values = [int(value) for value in fields[1:]]
|
||||
return sum(values), values[3] + values[4]
|
||||
|
||||
before = totals()
|
||||
time.sleep(2.0)
|
||||
after = totals()
|
||||
idle = 100.0 * (after[1] - before[1]) / max(1, after[0] - before[0])
|
||||
return load_1m, idle
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if any(not path.is_file() for path in [DATA, *(entry[0] for entry in BINARIES.values())]):
|
||||
raise SystemExit("missing L137 timing input")
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
load_1m, idle = quiet_machine()
|
||||
(OUT / "machine-load-before.txt").write_text(
|
||||
f"1-minute load: {load_1m:.2f}\n2-second CPU idle: {idle:.1f}%\n")
|
||||
print(f"[L137FinalTimingGate] load_1m={load_1m:.2f} cpu_idle_2s={idle:.1f}%", flush=True)
|
||||
if load_1m >= 0.9 or idle < 97.0:
|
||||
raise SystemExit("timing refused: machine is above the L80 quiet-load gate")
|
||||
|
||||
rows = []
|
||||
for strate in range(4):
|
||||
for workers in (8, 12):
|
||||
for version in BINARIES:
|
||||
run(strate, workers, version, "warmup", 0)
|
||||
for replicate in range(1, 6):
|
||||
order = tuple(BINARIES) if replicate % 2 else tuple(reversed(BINARIES))
|
||||
for version in order:
|
||||
rows.append(run(strate, workers, version, "measured", replicate))
|
||||
(OUT / "runs-partial.json").write_text(
|
||||
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
||||
|
||||
measured = [row for row in rows if row["phase"] == "measured"]
|
||||
summary = []
|
||||
for strate in range(4):
|
||||
for workers in (8, 12):
|
||||
group = [row for row in measured
|
||||
if row["strate"] == strate and row["workers"] == workers]
|
||||
entry = {"strate": strate, "workers": workers, "replicates_per_version": 5}
|
||||
medians = {}
|
||||
for version in BINARIES:
|
||||
version_rows = [row for row in group if row["version"] == version]
|
||||
medians[version] = {
|
||||
key: statistics.median(row[key] for row in version_rows)
|
||||
for key in ("lod02_ready_s", "whole_view_ready_s")}
|
||||
for key in medians[version]:
|
||||
entry[f"{version}_{key}_values"] = [row[key] for row in version_rows]
|
||||
entry[f"{version}_{key}_median"] = medians[version][key]
|
||||
for key in ("lod02_ready_s", "whole_view_ready_s"):
|
||||
entry[f"l137_vs_assembler-world_{key}_delta_pct"] = round(
|
||||
100.0 * (medians["l137"][key]
|
||||
/ medians["assembler-world"][key] - 1.0), 2)
|
||||
entry[f"{key}_paired_deltas_pct"] = [
|
||||
round(100.0 * (next(row[key] for row in group
|
||||
if row["version"] == "l137" and row["replicate"] == replicate)
|
||||
/ next(row[key] for row in group
|
||||
if row["version"] == "assembler-world"
|
||||
and row["replicate"] == replicate) - 1.0), 3)
|
||||
for replicate in range(1, 6)]
|
||||
summary.append(entry)
|
||||
(OUT / "summary.json").write_text(json.dumps(
|
||||
{"runs": rows, "summary": summary}, indent=2) + "\n", encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -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())
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run the L137 composed passage and tile-seam audits for seeds 0 through 15."""
|
||||
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/seeds"
|
||||
BIN = ROOT / "Saved/Linux/l137/fast/bin/VoxelForgeCoreHeadless-fast-clang"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
STAMP = "dcf2ffa55fd6d62b3c7faf76229c3b99c635868dc1b694fc6e8f39e738775a4e"
|
||||
STAMP_RE = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M)
|
||||
REQUIRED = {
|
||||
"passage": re.compile(r"^\[ResolvedPassageAuditSummary\].*status=PASS$", re.M),
|
||||
"seams": re.compile(r"^\[PassageTileSeamAudit\].*status=PASS$", re.M),
|
||||
"shell": re.compile(r"^\[PassageShellAuditSummary\].*status=PASS$", re.M),
|
||||
"naturalness": re.compile(r"^\[PassageNaturalnessSummary\].*status=PASS$", re.M),
|
||||
"mouth_profile": re.compile(r"^\[PassageMouthProfileSummary\].*status=PASS$", re.M),
|
||||
"ripple": re.compile(r"^\[PassageRippleAuditSummary\].*status=PASS$", re.M),
|
||||
"route_negative_control": re.compile(
|
||||
r"^\[TunnelNetworkBlockedRouteControl\].*expected=FAIL status=PASS$", re.M),
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if not BIN.is_file() or not DATA.is_file():
|
||||
raise SystemExit("missing L137 fast binary or owner fixture")
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
results = []
|
||||
for seed in range(16):
|
||||
log = OUT / f"seed{seed}.log"
|
||||
layout = OUT / f"seed{seed}.json"
|
||||
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
||||
"timeout", "1740s", str(BIN), str(DATA),
|
||||
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
|
||||
"--workers=8", "--clip-radius=3", "--max-clip-level=8", "--max-level=0",
|
||||
"--force-generate", f"--seed={seed}", "--recipe=surface-world",
|
||||
"--audit-resolved-layout-passages", "--audit-passage-tile-seams",
|
||||
f"--resolved-layout-output={layout}"]
|
||||
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")
|
||||
found_stamp = STAMP_RE.search(content)
|
||||
checks = {name: bool(pattern.search(content)) for name, pattern in REQUIRED.items()}
|
||||
checks["source_stamp"] = found_stamp is not None and found_stamp.group(1) == STAMP
|
||||
blocked = re.findall(r"^\[ResolvedPassageBlockedControl\].*detected=true$",
|
||||
content, re.M)
|
||||
checks["three_blocked_controls"] = len(blocked) == 3
|
||||
passed = result.returncode == 0 and all(checks.values())
|
||||
row = {"seed": seed, "exit": result.returncode, "passed": passed,
|
||||
"checks": checks, "blocked_controls": len(blocked),
|
||||
"elapsed_s": round(time.monotonic() - started, 3),
|
||||
"log": str(log.relative_to(ROOT)), "layout": str(layout.relative_to(ROOT))}
|
||||
results.append(row)
|
||||
print("[L137SeedSweep] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
(OUT / "runs-partial.json").write_text(json.dumps(results, indent=2) + "\n")
|
||||
if not passed:
|
||||
raise SystemExit(f"seed {seed} failed composed audits; see {log}")
|
||||
summary = {"source_stamp": STAMP, "seeds": list(range(16)),
|
||||
"passed": len(results), "failed": 0, "results": results}
|
||||
(OUT / "summary.json").write_text(json.dumps(summary, indent=2) + "\n")
|
||||
print("[L137SeedSweepSummary] passed=16/16 status=PASS")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare rendered Surface World hashes for v227 and the no-op v228 bump."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
OUT = ROOT / "Saved/Linux/l137/output-check"
|
||||
DATA = ROOT / "Standalone/data/owner_world.json"
|
||||
BINARIES = {
|
||||
"v227": ROOT / "Saved/Linux/l137/bin/VoxelForgeCoreHeadless-l137-aa-a",
|
||||
"v228": ROOT / "Saved/Linux/l137/bin/VoxelForgeCoreHeadless-l137-v228",
|
||||
}
|
||||
CAMERA = "8.000000000000,16.000000000000,-372.262695312500,0,0"
|
||||
HASHES = re.compile(
|
||||
r"^\[Pipeline(?:FullDetailHash|WholeViewHash|MaterialHash|LODHash|ExactQueryHash)\].*$",
|
||||
re.M)
|
||||
|
||||
|
||||
def run(version: str) -> tuple[list[str], str]:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
log = OUT / f"surface-world-{version}.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}", "--recipe=surface-world", "--stream-hash",
|
||||
"--stream-scheduler-policy=3",
|
||||
]
|
||||
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")
|
||||
hashes = HASHES.findall(content)
|
||||
if result.returncode or len(hashes) < 4:
|
||||
raise SystemExit(f"hash run failed: {version}; exit={result.returncode}; log={log}")
|
||||
return hashes, str(log.relative_to(ROOT))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
rows = []
|
||||
for version in BINARIES:
|
||||
hashes, log = run(version)
|
||||
rows.append({"version": version, "hashes": hashes, "log": log})
|
||||
match = rows[0]["hashes"] == rows[1]["hashes"]
|
||||
summary = {"output_hashes_match": match, "rows": rows}
|
||||
(OUT / "summary.json").write_text(json.dumps(summary, indent=2) + "\n")
|
||||
print("[L137VersionOutput] " + json.dumps({
|
||||
"output_hashes_match": match,
|
||||
"hash_lines": len(rows[0]["hashes"]),
|
||||
"v227": rows[0]["hashes"], "v228": rows[1]["hashes"]}, sort_keys=True))
|
||||
return 0 if match else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user