perf(victory-gpu): opt-in persistent static sampler ordering (VICTORY_SAMPLER_ORDER=1) #577
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/577"
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?
Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-28T07:52:12Z.
Summary
Opt-in (default OFF,
VICTORY_SAMPLER_ORDER=1) persistent static sampler ordering ported fromfxceless/victory-forkcommit9e90746onto currentmain(132da61).Why
Some D3D12 drivers assign each static sampler a hidden table index in root-signature creation order and embed those indices in compiled PSO blobs. Because worker threads reach root signatures in varying order across launches, multi-sampler PSOs can miss
ID3D12PipelineLibrary1and recompile. WhenVICTORY_SAMPLER_ORDER=1(true/on) is set,pipeline/sampler_order.rspersists seen descriptors instatic-samplers.txtbeside the pipeline cache and warms root signatures in deterministic order at startup before first use.Defaults & Honest Scope
VICTORY_SAMPLER_ORDERis unset or0,before()returns immediately with zero filesystem reads and zero D3D12 root signature creation, andpipeline::make/pipeline::librarylogs matchmainunchanged.pipeline/sampler_order.rsis395lines (<= 400).fxceless, RTX 4070) reported cold/warm slow compute pipelines dropping406 -> 211 -> 0(all pipelines ready in 34 s on subsequent runs); in-game FPS/PSO timings onAnyXboxXare unmeasured (assumed).#347,#350,#354, or#555.Verification
Verified locally on Windows 11 (
third_party/victoryworkspace) after the final edit:cargo xtask policy(378 files ok)cargo clippy --no-deps -p victory-gpu --locked --all-targets(default &--features diagnostics: 0 errors, 0 own warnings, 10 pre-existing upstream warnings)VICTORY_D3D12_WARP=0) and WARP (VICTORY_D3D12_WARP=1, default env):pipeline::sampler_order::tests: 6/6 passed (includes default-OFF check + 5 replay/persistence tests)pipeline::library::tests: 9/9 passedcompose::tests::: 1/1 passedpipeline::on HW (--skip missing_distinguishes_omitted_and_pending_pipelines --skip skipped_hash_leaves_pipeline_unqueued_and_unmatched_queues_normally, which fail identically on untouched132da61under--features diagnostics) &pipeline::host::tests5/5 on WARPChecklist
Source:/Co-authored-by:trailers +THIRD_PARTY.mdrow)VICTORY_SAMPLER_ORDER=1off by default)AnyXboxX(unmeasured)Imported from LooperSalty/AnyXboxX. Originally posted by akimfomin on 2026-11-28T11:37:57Z.
PortBridge checked the exact
daaffd4fhead against Vice-Tay's port. On NVIDIA, the host cache gate still passes no library name for a static-sampler pipeline when onlyVICTORY_SAMPLER_ORDER=1is set. The inherited NVIDIA guard is independent of sampler ordering. Replay/persistence tests can therefore pass while the intended pipeline still never enters the host library.Vice-Tay's scoped gate distinguishes keys from the startup replay and keys first seen in the current run. For the AnyXboxX port, one synthetic sampler pipeline with the override unset makes a useful test: first process learns it and declines library reuse, next process successfully primes it and gets a host library hit, and a refused replay or one new sampler forces compile. Keep the sampler-state override out of that test so it cannot mask the gate. This is a source check. PortBridge can help verify the exact synthetic receipt when the path is ready.
Imported from LooperSalty/AnyXboxX. Originally posted by Vladimir-Human on 2026-11-28T15:22:24Z.
@akimfomin Thanks for catching that in PortBridge! Fixed in
a22501b(rebased onto currentmain66b92fb):ca46856f/33037537's scopedsamplers_settledgate intothird_party/victory/crates/victory-gpu/src/pipeline/host.rsandpipeline/sampler_order.rs(ALLOW_STATIC_SAMPLERSguard unchanged; only keys replayed cleanly at startup allow library entry whenVICTORY_SAMPLER_ORDER=1, while newly-learned keys decline reuse).pipeline/sampler_order_library_tests.rswithVICTORY_LIBRARY_STATIC_SAMPLERSexplicitly unset, verifying: (1) first process learns the sampler key and declines library reuse, (2) second process replays it and gets a host library hit, and (3) a refused replay or a newly introduced sampler forces compile instead of stale library reuse.third_party/victorywith--features diagnostics --locked:cargo clippy -p victory-gpu --all-targets --features diagnostics --locked(0 warnings in touched files),VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked --lib sampler_order(11/11 passed),VICTORY_D3D12_WARP=1(11/11 passed);Cargo.lockuntouched.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.