feat: deterministic traversal benchmark & closed-loop optimization harness #1302
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1302
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1302"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Vladimir-Human on GitHub · 2026-11-26 13:17 UTC · original
Vladimir-Human:feat/deterministic-bench-loop→main· +5571 −19 · 11 files · 2 commits · openSummary
Adds an opt-in, zero-default-overhead Deterministic Traversal Benchmark & Closed-Loop Optimization Harness (
victory-gpu::bench,victory-hle::modules::gameinput_script,cargo xtask bench-loop, anddocs/auto-bench.md) with zero new crate dependencies (Cargo.toml,Cargo.lock, andxtask/src/policy.rsuntouched).Components
crates/victory-gpu/src/bench.rs, hooks inlib.rs,framelog.rs,queue.rs, 1 line inhost.rs::fail):pub fn world_frame() -> u64: monotonic counter staying0through menus/loading screens and latching to1, 2, ...at the first presented frame with>= 500draws (atomic-only fast path when bench env vars are unset).VICTORY_BENCH_OUT=<abs_path.json>(enforces outside-repo.victory-rootcheck and writes atomically via.tmp.<pid>.<seq>+ rename),VICTORY_BENCH_WARMUP=<W>(default30),VICTORY_BENCH_EXIT_FRAMES=<N>(flush JSON +std::process::exit(0)), andVICTORY_BENCH_CHECK_EVERY=<K>.world_frames,warmup_frames,frame_ms(avg,median,p95,p99,low_5pct_fps,low_1pct_fps),draws(avg,min,max),device_removed,zero_draw_world_frames,black_frames,memory(DXGI VRAM peak/budget + Win32 private commit & working set peaks),framelogper-frame averages (prepare_ms,card_wait_ms,card_idle_ms,copy_ms,copyback_ms,remap_ms,refresh_ms,pipeline_wait_ms,guard_faults,card_sync_ms,card_check_ms,card_lists_ms), andinput_script_sha256(blake3).crates/victory-hle/src/modules/gameinput_script.rs, tiny hook ingameinput.rs):VICTORY_INPUT_RECORD=<abs_path.jsonl>: validates outside-repo destination, records fullPadState+ held keys on every state change tagged withwframeandms, flushed per transition and onDrop.VICTORY_INPUT_REPLAY=<abs_path.jsonl>: replays recorded JSONL traces and/or declarative range lines ({"from":0,"to":120,"ly":1.0,"rt":0.8}) keyed toworld_frame(), immune to FPS changes, waiting in neutral state through loading screens (world_frame == 0), latchingwframeacrosspad(0)/keys()in each poll cycle, and registering the script digest intovictory_gpu::bench.xtask/src/bench_loop.rs,Cmd::BenchLoopinxtask/src/main.rs):std+ existinganyhow/clap(zero new dependencies): TOML/KV playlist parser ([[scenes]]), JSON parser, and 8-bit RGB/RGBA PNG decoder (RFC 1950/1951 inflate + row unfilter) for optional checkpoint PNG luma/black-frame parity.--mode ab(interleavedbase -> cand -> baseor N-round median) and--mode loop(pluggable--agent-cmdwith timeout watchdog, optional--fast-cmdoffline pre-filter, clean-tree guard, commit-on-keep /git reset --hard+ new-untracked cleanup on revert, andexperiments.jsonldead-end history).device_removed == false, (3)draws.avgwithin ±15% of baseline, (4)zero_draw_world_frames == 0,black_frames == 0, optional checkpoint PNG parity, (5) warmup exclusion +input_script_sha256parity + interleaved medians, (6)median frame_msgain>= --min-gain-pct+1% low, VRAM, and RAM non-regression/caps.docs/auto-bench.md): concise setup and usage guide for recording scripts, playlist configs,--mode ab,--mode loop, JSON schema, and gates.Verification
cargo run --locked -p xtask -- policy:asset policy: 224 files okcargo test --locked -p xtask:17 passed; 0 failed(covers keep-on-win, draw-skip rejection, device-removed rejection, black-frame + PNG parity rejection, VRAM breach, noise-below-threshold,input_script_sha256mismatch, Gate 1 failure JSON safety, real git keep/revert across iterations, agent failure handling, and watchdog timeout)cargo test --locked -p victory-gpu -p victory-hle -- --test-threads=1:victory-gpu216 passed; 0 failed; 6 ignored,victory-hle106 passed; 0 failed,no_dll_planting1 passedcargo test --locked --features diagnostics -p victory-gpu -p victory-hle -- --test-threads=1:victory-gpu235 passed; 0 failed; 7 ignored,victory-hle106 passed; 0 failed,no_dll_planting1 passedcargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated(default &--all-features): 0 warningsgit diff --check: clean;Cargo.toml,Cargo.lock, andxtask/src/policy.rsuntouched; all files< 512 KiB@Vladimir-Human on GitHub · 2026-11-26 13:49 UTC · original
Updated in
a451e37:eject_when_a_repeat_ends_before_requested_frame_count proving [120, 1, 120] measured world_frames (as well as short warmup, non-positive median frame time, and the rames.max(1) floor) on either baseline or candidate is rejected by Gate 5.
Verified with cargo run --locked -p xtask -- policy (224 files ok), cargo test --locked -p xtask (18/18), and cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated (
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.