Reuse private terrain tick membership without changing published action order
This commit is contained in:
@@ -66,7 +66,7 @@ function compareReports(a,b){
|
||||
else if(JSON.stringify(a[key])!==JSON.stringify(b[key]))warnings.push('JVM '+key+' differs. Treat it as an explicit experiment variable.');
|
||||
}
|
||||
if(a.kind==='frames'){
|
||||
for(const key of ['adaptive_budget_enabled','adaptive_target_fps','precise_worker_pacing','debounce_queue_wait','wakeable_idle_wait','dispatch_retry_backoff','dh_thread_count','dh_runtime_ratio']){
|
||||
for(const key of ['adaptive_budget_enabled','adaptive_target_fps','precise_worker_pacing','debounce_queue_wait','wakeable_idle_wait','dispatch_retry_backoff','tick_membership_dedup','dh_thread_count','dh_runtime_ratio']){
|
||||
if(key in a&&key in b&&JSON.stringify(a[key])!==JSON.stringify(b[key]))warnings.push('Experiment '+key+' differs.');
|
||||
}
|
||||
for(const [label,r] of [['Baseline',a],['Candidate',b]]){
|
||||
@@ -124,6 +124,7 @@ function renderDetails(side){
|
||||
}
|
||||
fields.push(['Rejected dispatch retry', r.dispatch_retry_backoff===true?'on':r.dispatch_retry_backoff===false?'off':'not captured']);
|
||||
fields.push(['Wakeable queue idle', r.wakeable_idle_wait===true?'on':r.wakeable_idle_wait===false?'off':'not captured']);
|
||||
if(r.kind==='frames')fields.push(['Tick membership deduplication',r.tick_membership_dedup===true?'on':r.tick_membership_dedup===false?'off':'not captured']);
|
||||
for(const [label,value]of fields)target.append(text('dt',label),text('dd',value));
|
||||
}
|
||||
async function loadFiles(side,files){
|
||||
|
||||
+14
-6
@@ -119,24 +119,32 @@ def build():
|
||||
|
||||
|
||||
def build_dispatch_fixture():
|
||||
return build_integration_fixture("dispatch", "dev.horizonlab.dispatch.DispatchIntegration")
|
||||
|
||||
|
||||
def build_tick_dedup_fixture():
|
||||
return build_integration_fixture("tick-dedup", "dev.horizonlab.dispatch.TickDedupIntegration")
|
||||
|
||||
|
||||
def build_integration_fixture(name, entrypoint):
|
||||
"""Create a private integration-test mod; never include it in release packs."""
|
||||
arguments = [json.loads(line) for line in (BUILD / "javac.args").read_text().splitlines()]
|
||||
classpath = arguments[arguments.index("-classpath") + 1] + os.pathsep + str(BUILD / "classes")
|
||||
classes = BUILD / "dispatch-fixture"
|
||||
classes = BUILD / f"{name}-fixture"
|
||||
if classes.exists():
|
||||
shutil.rmtree(classes)
|
||||
classes.mkdir(parents=True)
|
||||
subprocess.run(["javac", "--release", "25", "-proc:none", "-classpath", classpath,
|
||||
"-d", str(classes), str(SOURCE / "test/java/dev/horizonlab/dispatch/DispatchIntegration.java")], check=True)
|
||||
output = BUILD / "dispatch-fixture.jar"
|
||||
"-d", str(classes), str(SOURCE / "test/java" / (entrypoint.replace(".", "/") + ".java"))], check=True)
|
||||
output = BUILD / f"{name}-fixture.jar"
|
||||
with zipfile.ZipFile(output, "w", compression=zipfile.ZIP_DEFLATED) as archive:
|
||||
for path in sorted(classes.rglob("*.class")):
|
||||
archive.write(path, path.relative_to(classes).as_posix())
|
||||
archive.writestr("fabric.mod.json", json.dumps({"schemaVersion": 1, "id": "horizon_dispatch_fixture",
|
||||
archive.writestr("fabric.mod.json", json.dumps({"schemaVersion": 1, "id": "horizon_" + name.replace("-", "_") + "_fixture",
|
||||
"version": "1.0.0", "environment": "client",
|
||||
"entrypoints": {"client": ["dev.horizonlab.dispatch.DispatchIntegration"]},
|
||||
"entrypoints": {"client": [entrypoint]},
|
||||
"depends": {"horizonlab": "*", "distanthorizons": "3.3.4"}}))
|
||||
print(f"Private dispatch integration fixture: {output}")
|
||||
print(f"Private {name} integration fixture: {output}")
|
||||
return output
|
||||
|
||||
|
||||
|
||||
+6
-3
@@ -24,8 +24,9 @@ PROFILES = {
|
||||
"queue-wait": {"title": "Debounce queue wait experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "queue_wait": True},
|
||||
"adaptive-queue": {"title": "Adaptive pacing and queue wait experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True},
|
||||
"dispatch-retry": {"title": "Rejected dispatch retry experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "dispatch_retry": True},
|
||||
"foreground-first": {"title": "Foreground-first combined experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True, "dispatch_retry": True, "target_fps": 120},
|
||||
"foreground-vulkan": {"title": "Foreground-first Vulkan experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True, "dispatch_retry": True, "target_fps": 120, "backend": "vulkan"},
|
||||
"tick-dedup": {"title": "Terrain tick membership experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "tick_dedup": True},
|
||||
"foreground-first": {"title": "Foreground-first combined experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True, "dispatch_retry": True, "tick_dedup": True, "target_fps": 120},
|
||||
"foreground-vulkan": {"title": "Foreground-first Vulkan experiment", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 128, "heap": 6144, "adaptive": True, "pacing": True, "queue_wait": True, "dispatch_retry": True, "tick_dedup": True, "target_fps": 120, "backend": "vulkan"},
|
||||
"low-memory": {"title": "Low memory", "mods": CORE, "render": 8, "lod": 0, "heap": 3072},
|
||||
"far-distance": {"title": "Far distance", "mods": CORE + ["distanthorizons"], "render": 12, "lod": 256, "heap": 8192},
|
||||
"cinematic": {"title": "Cinematic (optional)", "mods": CORE + ["distanthorizons", "iris", "complementary-reimagined"], "render": 12, "lod": 128, "heap": 6144},
|
||||
@@ -79,7 +80,7 @@ def overrides(profile_name, mod_bytes):
|
||||
files = {f"mods/horizon-lab-{read_lock()['pack_version']}.jar": mod_bytes,
|
||||
"config/horizon-profile.txt": (profile_name + "\n").encode(),
|
||||
"options.txt": options(profile).encode()}
|
||||
experiment = any(profile.get(key, False) for key in ["adaptive", "pacing", "queue_wait", "dispatch_retry"])
|
||||
experiment = any(profile.get(key, False) for key in ["adaptive", "pacing", "queue_wait", "dispatch_retry", "tick_dedup"])
|
||||
config = ROOT / "packs/config" / f"{'m2-balanced' if experiment else profile_name}.toml"
|
||||
files["config/horizon-adaptive.properties"] = (
|
||||
f"enabled={str(profile.get('adaptive', False)).lower()}\ntargetFps={profile.get('target_fps', 60)}\n").encode()
|
||||
@@ -89,6 +90,8 @@ def overrides(profile_name, mod_bytes):
|
||||
f"enabled={str(profile.get('queue_wait', False)).lower()}\n").encode()
|
||||
files["config/horizon-dispatch-retry.properties"] = (
|
||||
f"enabled={str(profile.get('dispatch_retry', False)).lower()}\n").encode()
|
||||
files["config/horizon-tick-dedup.properties"] = (
|
||||
f"enabled={str(profile.get('tick_dedup', False)).lower()}\n").encode()
|
||||
if profile["lod"]:
|
||||
if not config.exists():
|
||||
raise FileNotFoundError(f"Missing verified DH profile config: {config}")
|
||||
|
||||
@@ -28,7 +28,7 @@ def compare(baseline, candidate):
|
||||
warnings = ["World, route, warm-up, shader state and LOD cache must also match; these are not verified by this tool."]
|
||||
if baseline["kind"] == "frames":
|
||||
for field in ["adaptive_budget_enabled", "adaptive_target_fps", "precise_worker_pacing", "debounce_queue_wait",
|
||||
"wakeable_idle_wait", "dispatch_retry_backoff", "dh_thread_count", "dh_runtime_ratio"]:
|
||||
"wakeable_idle_wait", "dispatch_retry_backoff", "tick_membership_dedup", "dh_thread_count", "dh_runtime_ratio"]:
|
||||
if field in baseline and field in candidate and baseline[field] != candidate[field]:
|
||||
warnings.append(f"Experiment {field} differs: {baseline[field]!r} vs {candidate[field]!r}.")
|
||||
for name, report in [("baseline", baseline), ("candidate", candidate)]:
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check actual DH tick transitions and allocation with the optional membership hook off/on."""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
try:
|
||||
from . import build_mod, build_pack
|
||||
except ImportError:
|
||||
import build_mod
|
||||
import build_pack
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--native-display", action="store_true")
|
||||
args = parser.parse_args()
|
||||
root = build_pack.ROOT
|
||||
fixture = build_mod.build_tick_dedup_fixture()
|
||||
mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar"
|
||||
results = []
|
||||
for enabled in [False, True]:
|
||||
instance = root / ".local/runtime" / ("tick-dedup-fixture-patched" if enabled else "tick-dedup-fixture-upstream")
|
||||
build_pack.prepare_instance("m2-balanced", instance, mod)
|
||||
shutil.copy2(fixture, instance / "mods/tick-dedup-fixture.jar")
|
||||
(instance / "config/horizon-tick-dedup.properties").write_text(f"enabled={str(enabled).lower()}\n")
|
||||
command = [sys.executable, str(root / "tools/runtime.py"), "demo", "--instance", str(instance), "--heap", "3G", "--compact-headers"]
|
||||
if platform.system() == "Linux" and not args.native_display:
|
||||
command = ["xvfb-run", "-a", *command]
|
||||
environment = os.environ.copy()
|
||||
environment["_JAVA_OPTIONS"] = "-Dhorizon.fixture.exit=true"
|
||||
run = subprocess.run(command, cwd=root, env=environment, text=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, timeout=240)
|
||||
(instance / "fixture.log").write_text(run.stdout)
|
||||
marker = "HORIZON_TICK_DEDUP_RESULT "
|
||||
reports = [json.loads(line.split(marker, 1)[1]) for line in run.stdout.splitlines() if marker in line]
|
||||
if run.returncode or len(reports) != 1:
|
||||
raise RuntimeError(f"Tick dedup fixture failed; inspect {instance / 'fixture.log'}")
|
||||
report = reports[0]
|
||||
if report["enabled"] != enabled or report["verified_transitions"] != 6000 or report["checksum"] != 10240000:
|
||||
raise AssertionError("Applied hook or semantic outcome did not match")
|
||||
results.append(report)
|
||||
print(json.dumps(report), flush=True)
|
||||
if results[0]["allocated_bytes"] <= 0 or results[1]["allocated_bytes"] >= results[0]["allocated_bytes"] / 20:
|
||||
raise AssertionError("Membership hook did not remove repeated entry allocation")
|
||||
output = root / "dist/tick-dedup-integration.json"
|
||||
output.write_text(json.dumps({"schema": 1, "platform": platform.platform(), "architecture": platform.machine(),
|
||||
"minecraft": "26.3", "distant_horizons": "3.3.4", "results": results,
|
||||
"notes": ["Actual publisher tick holder under Fabric, warmed with preallocated nodes and a reused action list.",
|
||||
"Checks duplicate/null membership, enable/disable precedence, published iteration order and clear boundaries.",
|
||||
"Only private membership checks change; action collections and traversal remain upstream.",
|
||||
"CPU and allocation measure the calling thread in one isolated loop; no statistical speed claim.",
|
||||
"Not a game FPS, visible terrain completion, whole-game RAM or Mac GPU benchmark."]}, indent=2) + "\n")
|
||||
print(f"Applied tick membership checks passed: {output}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user