feat(tools): add standalone Rust synthetic benchmark suite #322
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/lobomfz--VIctory-xmem!322
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-322"
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?
@tommiehansen on GitHub · 2026-12-03 13:55 UTC · original
tommiehansen:tools/benchmark-suite→main· +20782 −104 · 68 files · 73 commits · openOptional Vulkan and Nextgen integration
Upstream integration alternative #568 combines this scoped foundation with the reviewed fork #6–13 and scoped policy compatibility. It preserves this PR as the smaller first-merge option. Do not merge overlapping versions blindly.
cf40ea3Nextgen · Production Vulkan · Standard CPU audit across 14 PRs (13 jobs completed successfully, #467 failed byte equivalence; unsupported workloads are not evidence of correctness).
These are results of the fork implementation, not a new verification claim for this head. The integration alternative has its own CI.
What this does
Add standalone Rust synthetic benchmark suite.
Checks
5bd5534. New scope-only head requires CI and explicit policy rerun.cargo xtask policyon the final revision; no new game assets or build output intended.Verified
Current review head:
cde5334d1976e57824369d0a852ccf24c9360ede. Existing measurements and commands are retained below at their original revisions. No fresh compile, policy or hardware test is claimed by this metadata review.Cost
Build/test time, optional benchmark artifacts and dependencies; no intended frame-time cost.
Detailed implementation and historical validation
Benchmark Suite — test optimizations before launching the game
A standalone Rust benchmark suite for VIctory-xmem and compatible forks. It makes performance experiments repeatable and measurable without game files, proprietary game assets, recorded gameplay or a dedicated GPU for CPU workloads.
The goal is to shorten the development cycle: measure a change, refine it, measure again, and reserve expensive in-game testing for promising candidates. This is particularly useful for contributors and AI coding agents that cannot continuously launch and benchmark the game.
Quick start
PR mode resolves the exact GitHub revisions, selects relevant benchmark suites, builds isolated snapshots, detects known opt-in switches and runs interleaved baseline/candidate measurements. Explicit switches and suite selection are also supported.
Example results
The following examples summarize actual CPU-only runs on macOS ARM64, not projected gameplay FPS. They illustrate three different ways to evaluate an optimization: measured execution cost, generated code complexity and avoided work.
Example 1 — Shader translation and emitted code
Guest-load clustering (#305), baseline
842767a8e4a5→ candidate44f5b82d2dff.Condensed example report (formatted for this description, using recorded results):
The timing is a paired estimate from the Standard profile. Instruction counts describe emitted code, not dynamically executed GPU instructions. The runtime shader-cache path and GPU execution are not covered by this example.
Example 2 — Avoided work in resource management
These are operation counts from pinned historical revisions. The refresh fixture exercises the production GPU-written tracker and staging precheck; the queue fixture exercises the scan/order and cursor/budget functions across seven measured passes. Both have partial coverage. Neither measures the GPU time saved, actual present intervals or end-to-end rendering performance.
Example 3 — An inconclusive result is still useful
Uniform guest-load handles (#302):
CPU translation time was estimated at −1.39%, with a 95% confidence interval of −3.06% to +0.31%. The suite correctly reports the timing as inconclusive while providing evidence that the emitted-code optimization was activated. Rejected fixtures remain byte-identical; semantic GPU parity is unverified.
What it can measure
patches/mesa.patch(partial/cpu_patch_model_only), and Windows D3D12.X /XTaskQueueprimitivesAvailability depends on the revision, adapter and host. Unsupported workloads are identified explicitly rather than simulated as successful production execution.
Reliable comparisons, not just numbers
--quickfor smoke/correctness validation (higher run-to-run variance) and--profile standard(4 A/B/B/A blocks) or higher for timing conclusions.Reports and AI-assisted development
Each run produces artifacts suitable for both humans and automated analysis:
summary.mdresults.jsonframetimes.csvanalysis.mdreport.htmlcheckpoints/The intended development workflow is:
Project guidance in
AGENTS.md,CLAUDE.mdandGEMINI.mdhelps coding agents discover and use the suite during development.A shared standard across forks
The benchmark protocol, workload definitions and measurement methodology are separated from fork-specific adapters. Compatible forks can implement
BenchmarkAdapteragainst their own production code and compare results when the shared workload contract, toolchain, target and execution evidence match.The long-term goal is to make optimizations easier to reproduce, compare and combine across the ecosystem. Standardized reports could also support future integration with PortWatch. Other fork adapters and PortWatch integration are not included in this PR.
Validation, CI, and current limitations
0669618): Workflow run 47220897854 passed bothCPU Benchmark Smoke & Policy(3m30s:xtask -- switches, unit/correctness/smoke tests, releasesensitivity, quick CPU smoke) andWindows Native Benchmark Smoke(19m16s: MSVC check/lint/tests, release smoke,--repo-root . compare HEAD HEAD, hardware & WARP capability probes,build-gpu.ps1).4495c7b): 31 passing CPU workloads across two runs with identical correctness digests and 14 GPU workloads markedUnsupportedin--cpu-onlymode; 8/8 passing timestamped memory workloads across two runs on a physical NVIDIA GPU; verified process-tree deadline termination and PowerShell GPU probe builds. Follow-upsab96332(explicit Windows root paths without verbatim prefix +build-gpu.ps1message),e3c74d3(compact Windows snapshot keys for MASM),0669618(40-minute Windows job timeout), and2ef6806(atomic-PID timeout-test synchronization, redundantcargo checkremoval, README/PROGRESS alignment) resolved the remaining--repo-root .comparison and CI timeout issues.3efbed0): Addedrt_freed_index_phased_churnandrt_freed_index_iteration(using productionAddressMap::visitwhen present) insrc/suites/rt_freed_bench.rsandbuild.rs, recorded paired Standard and Full results for #429 (bb184d8) inPROGRESS.md, and verifiedcargo test --offline -p victory-benchmark-suite(20 unit, 9 correctness, 1 sensitivity, and 1 CPU smoke test passed).2e57371): Added 6 production-path workloads (rt_remap_unchanged,rt_remap_sparse_changes,rt_remap_streaming_invalidations,rt_remap_sustained_streaming,rt_remap_growth_shrinkage,rt_remap_overlapping_submissions) insrc/suites/rt_remap_bench.rsvalidatingBTreeMaplive/removed/replaced key oracles, delayed indirect-arg reads, OOM preservation, and explicit modeled GPU proxy counters (modeled_gpu_patch_dispatches,modeled_gpu_extra_barriers); recorded Standard and Full opt-in (VICTORY_HW_RT_REMAP_SNAPSHOTS=1vs=0) results onc49b6c8inPROGRESS.md, and verifiedcargo test --offline -p victory-benchmark-suite --lib --test correctness --test smoke(20 unit, 9 correctness, 1 CPU smoke passed).patches/mesa.patchbenchmarks (mapping/radv_shown_cursor_model,mapping/radv_dirty_range_sort_model) are standalone CPU patch models explicitly classifiedpartial(cpu_patch_model_only), not live RADV driver runs. Cross-OS timing and RSS numbers are not directly comparable because Windows linksvictory-gpu's 8 GiB virtual arena reservation.Synthetic results are evidence for choosing and refining optimizations, not substitutes for actual gameplay benchmarks. No FPS improvement is claimed from instruction counts, avoided work or CPU translation timings alone.
Documentation
Native Windows quick start
Scope and follow-up stack — 2026-12-05
The current PR contains 68 changed files (not the earlier 110-file diff). Unrelated dead-code/config cleanup and root agent guidance are not part of this diff. The remaining production adapters and feature-gated hooks serve the benchmark harness. The benchmark integration stack is staged in fork #6–13; the current endpoint is #13. This foundation remains separately reviewable. The portable Vulkan source-policy allowance is upstream #539; the launcher switch checker is #528. Reconcile the stack against the landed foundation in dependency order, preserving tested revision pins and not importing unrelated optimizations.
The 2026-12-05 queue refresh intentionally did not rewrite this foundation or its dependent branches; the scope and integration work above are distinct from a new merge-base verification.
Reconciled foundation validation
Current head
c5df42bis mergeable. Upstream CI 47554282446 passed Windows Native Benchmark Smoke and CPU Benchmark Smoke & Policy. Self-hosted GPU skipped. The reconciliation preserves current upstream policy and launcher regression coverage.@Kal0s-design on GitHub · 2026-12-03 21:19 UTC · original
Gave this a try on native Windows 11 with MSVC (no Wine), head
2f34efa, offline and --locked. The three commits pushed since (up to023d9f3) only touch docs and the texture queue fixtures, and the import below is unchanged there.It doesn't build on Windows as submitted.
cargo build --release -p victory-benchmark-suitefails with E0603 because tools/benchmark-suite/src/adapters/xmem.rs:52 importsvictory_gpu::object::This, which ispub(crate)in crates/victory-gpu/src/object.rs:67 on main and at the merge base. The wholecfg(windows)win_runtime block (xmem.rs:44) sits behind that. CI only runs on ubuntu-latest (benchmark-smoke.yml:23) and victory-gpu/victory-hle are Windows-only deps of the bench, so CI never compiles this path, and the descriptors/d3d12x_heap_and_copy and sync/xasync_and_d3d12x_fence workloads haven't been built for a Windows target yet. MakingThispub, or a localtype This = *const victory_gpu::object::Object;in win_runtime, fixes it.With that one-line workaround applied locally the release binary builds and
cargo test -p victory-benchmark-suite --no-runbuilds all five test binaries. No new crates were needed.cargo check -p victory-gpu --tests(covers host/benchmark_rtbench.rs) is clean. Clippy shows one new warning in the bench crate, a needless return at tools/benchmark-suite/src/env.rs:76, and it only shows up on Windows.cargo test -p xtask -- switchespasses on Windows, the new shell expansion test included. The full xtask run still fails repository_passes_policy, but only on files this PR doesn't touch, and the newrunscript passes the policy.I didn't run the benchmarks themselves, so no timings or repeatability numbers from me. Besides the build error, one thing worth knowing for comparisons is that on Windows the bench links victory-gpu and so picks up its global allocator (port_heap.rs:182), which reserves an 8 GiB address range on the first allocation (port_heap.rs:12 and :54). That's existing victory-gpu behaviour and not something this PR changes, but it means Windows runs use a different allocator than the macOS numbers in the description, and even
--listreserves that range. Probably worth a line in the README.A few smaller Windows things. env.rs:74-84 reports the GPU as available with native D3D12 on Windows without probing anything, which doesn't quite match "no fabricated GPU results". The process group and
/bin/killin compare.rs:497 and :506 are unix only, so on Windows--time-limitonly kills cargo and its children can keep running.runis a POSIX sh script, fine from Git Bash but not from cmd or PowerShell, and build-gpu.sh also needs jq, which a stock Windows setup won't have.Happy to rerun the quick CPU mode once the Windows build is fixed.
AI-assisted: yes
@tommiehansen on GitHub · 2026-12-03 21:44 UTC · original
@Kal0s-design Thanks for running this on native Windows and tracing the visibility issue to
This. I addressed the findings in your report:Native Windows Actions passed. The release run passed 31 CPU workloads, including the native descriptor and XTaskQueue/fence workloads. Its capability output verified WARP device creation and reported hardware mode unavailable on the hosted runner. The PowerShell builder also passed. GPU performance was outside that validation.
From the repository root in PowerShell:
For the optional native GPU probe build, run
.\tools\benchmark-suite\build-gpu.ps1. I’d welcome your independent CPU rerun on Windows 11.@Kal0s-design on GitHub · 2026-12-03 21:53 UTC · original
Thanks for the quick turnaround. I reran things on native Windows 11 / MSVC at
4495c7b. The two commits since (up to7d2ad97) add a write-watch bench and docs and leave main.rs:245 as it was, so the compare problem below still applies.What's fixed from my earlier list
Thisalias in xmem.rs is fine.cargo clippy -p victory-benchmark-suite --all-targets --no-depsis clean now, the env.rs return warning is gone.envnow reports the real adapter in hardware mode, WARP in software mode, andavailable=falsewith a clear reason for an unknownBENCH_GPU_MODE.--listandcapabilitieswork too.timeout_terminates_the_native_process_treepasses here. I also ran a realcompare HEAD HEAD --cpu-only --quick --offline --time-limit 25from a fresh state. Mid build there were 4 cargo/rustc processes under the snapshot dir, it stopped at the deadline with "comparison time limit reached while running cargo", and afterwards none were left.runand build-gpu.sh are unchanged, but the README's direct cargo commands plus build-gpu.ps1 cover the native path. I ran build-gpu.ps1 under the default RemoteSigned policy, no policy change and no jq needed. It built the probe for the exact revision and the hardware memory suite picked it up.Tests
cargo test -p victory-benchmark-suitepasses (lib 19, correctness 9, sensitivity 1, smoke 1), including the two new Windows tests.cargo test -p xtask -- switchespasses (4).Runs
--quick --cpu-onlytwice, about 1.5 s each. 31 workloads passed and 14 were reported unsupported as expected, with identical correctness digests across runs. Both native D3D12.X workloads pass here (descriptors/d3d12x_heap_and_copy and sync/xasync_and_d3d12x_fence).Run to run, comparing the per workload median of run 2 against run 1, the median deviation was about 11%. 10 of 31 were within 5%, 14 within 10%, worst 0.67x and 1.35x (shaders/translate_corpus, descriptors/shader_resource_tracking). d3d12x_heap_and_copy was 0.98 with a few % CV, xasync_and_d3d12x_fence 1.15 with very high CV in both runs. So quick mode works as a smoke test, but I wouldn't read timing from it.
I also ran
--suite memory --quick --require-gputwice in hardware mode on one NVIDIA desktop card. 8 of 8 GPU workloads passed both times. Ratios were 0.94 to 1.03, and the two and eight copy cases stayed within 0.2%.One problem left
The Windows compare example in the README fails when run with
--repo-root .. main.rs:245 canonicalizes the root, which on Windows gives a\\?\prefixed verbatim path, and the snapshot build started at compare.rs:471 then fails linking the first build script (LNK1181 cannot open input file '.obj') within a couple of seconds. The same compare without--repo-root(root found from the cwd) gets well past that point and only stops at the time limit. I tried both orders from a clean state and the failure follows the flag. That line isn't new in this PR, but the new README example runs straight into it.std::path::absoluteor stripping the prefix (dunce style) should do. CI doesn't catch it because the Windows job never runscompare.Small one. gpu_bridge.rs:82 still tells Windows users to run build-gpu.sh, it could mention build-gpu.ps1 too.
AI-assisted: yes
@tommiehansen on GitHub · 2026-12-03 22:12 UTC · original
@Kal0s-design Thanks for reproducing this on native Windows. Explicit roots now resolve to absolute paths without canonicalization adding a verbatim prefix on Windows. The missing-probe message names
build-gpu.ps1, and native CI now runs--repo-root . compare HEAD HEAD --cpu-only --quick --suite mapping --blocks 1 --offline --time-limit 600. Path, message, and CI fixThe first CI comparison got past the linker but exposed a second issue: MASM rejected BLAKE3’s long object path. The Windows snapshot key now hashes the full revision and harness into a shorter directory name. Local Cargo check passed, and the native rerun is in progress. MASM fix · Windows CI
PROGRESS.mdnow records your two runs with 31 passing CPU workloads and your two runs with all eight physical NVIDIA GPU workloads passing. It also records the quick-mode timing variation.@Kal0s-design on GitHub · 2026-12-03 22:36 UTC · original
Reran the Windows compare at
e3c74d3on native Windows with MSVC, using the README command plus--quick --offline, both with and without--repo-root ..The LNK1181 is gone. With
--repo-root .the snapshot paths now come out as plainC:\...paths with the short hash names, and the baseline snapshot built and linked fine, BLAKE3 assembly included. My first cold run then hit the 240s time limit while the candidate snapshot was still compiling, which is just build time on a cold cache.Warm cache, both forms finished in about 2.5 to 3 minutes with the same result: 47 workloads, 31 timed and all marked inconclusive (expected for quick, 2 rounds), 30 with identical correctness digests, 16 GPU workloads unsupported in CPU-only mode. Both exit with code 3 on the compatibility warning for frame/synthetic_workload against main, the same either way.
The gpu_bridge message now names build-gpu.ps1.
cargo test -p victory-benchmark-suitepasses and clippy shows no warnings in the bench crate.One small thing I noticed: the output folder is named
unix-<secs>-compareon Windows too, and the printed path mixes/and\. It's cosmetic.AI-assisted: yes
@tommiehansen on GitHub · 2026-12-03 23:39 UTC · original
@Kal0s-design Quick update following up on the native Windows runs:
0669618: run 47220897854 completed bothCPU Benchmark Smoke & Policy(3m30s) andWindows Native Benchmark Smoke(19m16s), including--repo-root . compare HEAD HEAD, hardware/WARP capability probes, andbuild-gpu.ps1.2ef6806:compare.rs) and Windows (windows_child.rs) timeout-termination tests with atomic PID readiness files before sending termination/closing the Job Object.cargo check --all-targetsstep beforecargo clippy --all-targets.README.md(syncclean-bitmap workloads,radv_um_aliasname, and the--quicksmoke/variance note) and updatedPROGRESS.mdand the PR description to match the verified state.xtask -- switches) and cross-checked all targets againstx86_64-pc-windows-msvccleanly; upstream CI run 47228505885 is running now.github-bot referenced this pull request2026-12-04 00:39:55 +00:00
bb184d8results 3efbed0b7egithub-bot referenced this pull request2026-12-04 11:01:55 +00:00
@Luxuride on GitHub · 2026-12-04 11:02 UTC · original
A concrete split, from the diff (
main…tools/benchmark-suite, 110 files, +20,977/−2,172). It is not one PR about a benchmark suite — it is four unrelated things, and they have very different review costs:1.
refactor: delete the paths nothing reaches— ~950 deletions, no additions.crates/victory-loader/src/vehicle_notch.rs(−297),ps5_rumble.rs(−124),crates/victory-gpu/src/pipeline/library/name_gate.rs(−146),crates/victory-shader/src/emit/mod.rs(−362),crates/victory-core/src/menu.rs(−76),apps/victory/src/warm.rs(−53),crates/victory-gpu/src/pull.rs(−74),tools/backup-saves.sh(−88). Deletions are the fastest review in the world and the easiest merge; keeping them inside a 20k-line PR is the worst possible place for them. Basemain.2.
config: prune the switches the removal orphaned—run.conf.default(+140/−269) and thextask/src/switches.rschange.Separate because it is the only part where a reviewer has to agree that a documented switch is gone, and because it conflicts with every other PR that touches
run.conf.default.3.
bench: the harness—tools/benchmark-suite/src/{main,protocol,env,stats,json,report,compare,pr,fixtures,dxil_inspect}.rs+Cargo.toml/Cargo.lock, ~9k lines.No suites, no adapters: a runner, a protocol, a statistics layer, a reporter. This is the part that has to be right before anything measured with it means anything, and it can be reviewed without knowing what is being measured.
4.
bench: the suites and the xmem adapter—src/suites/*(~10 files,residency817,shaders577,rt_freed_bench552,rt_remap_bench548,mapping530,texture_queue519,frame421,front_plan_bench393 …) +src/adapters/xmem.rs(698).Each suite is an independent claim about what to measure;
rt_freed_benchandrt_remap_benchin particular only make sense next to their respective PRs, not in a suite catalogue.5.
ci: a benchmark smoke run—.github/workflows/benchmark-smoke.yml,historical.rs.Last, because a workflow cannot be green until 3 and 4 exist, and because a red CI check on a fork PR blocks nothing but everything after it.
6.
chore(repo): agent guidance—AGENTS.md,CLAUDE.md,GEMINI.md, ~76 lines.Unrelated to all of the above and trivially mergeable on its own.
The reason this matters more than usual here: the renames/deletions in 1 and 2 touch
run.conf.default,warm.rs,menu.rsand the loader — among the most contended files in the queue. As one PR they will conflict with almost everything that merges while it waits, and every conflict will be resolved inside a diff nobody has read to the end.c49b6c8opt-in results 2e573717c5@tommiehansen on GitHub · 2026-12-04 17:54 UTC · original
@Luxuride Thanks for the feedback! Most of the unrelated changes have already been removed.
I'd prefer to keep the benchmark harness, test suites and CI together as a complete, independently testable tool. Larger additions, including cross-platform Vulkan support, will be handled in separate follow-up PRs to keep this PR focused.
@tommiehansen on GitHub · 2026-12-04 21:37 UTC · original
The reviewed portable GPU package’s core landed on this branch in
5bd5534.--base-commitnow requires a full verified strict ancestor and isolates stacked PR changes. HWRT production paths select the ray-tracing suite and disclose the limits of CPU-only coverage. On Apple M5, 31 Rust tests and Cargo check passed, along with a Windows-target compile check. A Quick run against official #469 pinned0fd7614→0ddf76cmatched all seven CPU shader digests. Timing was inconclusive and GPU execution remained unsupported. The optional portable GPU payload is being kept as a separate follow-up.@tommiehansen on GitHub · 2026-12-04 21:41 UTC · original
The optional Vulkan work is in the stacked fork PR. Native ARM64 CMake/CTest passed on physical Apple M5 via MoltenVK, including deliberate oracle failure. The Standard sensitivity runs failed the drift gate and are inconclusive. The separate exporter commit preserves the original CPU and D3D12 paths.
tools: add standalone Rust synthetic benchmark suiteto feat(tools): add standalone Rust synthetic benchmark suite@tommiehansen on GitHub · 2026-12-05 10:19 UTC · original
Thanks for the earlier Windows and scope reviews. The smaller #322 remains available; the optional Vulkan/Nextgen integration is now #568, excluding repository-wide agent guidance. All seven active upstream CI jobs passed, including actual software Vulkan execution and the deliberately incorrect oracle rejection. This is a separate integration alternative, not a physical GPU performance claim. Integration and checks.
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.