Make static samplers in one order so NVIDIA can reuse stored pipelines #395

Closed
github-bot wants to merge 662 commits from github-bot/gh-395 into main AGit
Owner

@⁠Garu667 on GitHub · 2026-11-28 03:47 UTC · original
Garu667:perf/static-sampler-order → main · +60280 −5429 · 207 files · 662 commits · closed without merging

On NVIDIA, pipelines with static samplers never come from the library. allows_static_samplers keeps them out, because the driver numbers static samplers in the order a process first makes them, and that order changes from run to run. On an RTX 3080 that means about 120 pipelines compiled again at every launch, and draws dropped while they compile.

This ports trustno1-coder's fix (trustno1-coder/VIctory-NVIDIA@64d4931, pipeline/samplers.rs, GPL-3.0):

  • Every distinct static sampler goes to static-samplers.txt beside the library, one line each, in the order first met.
  • Each process makes the listed samplers in that order right after its device exists, in root signatures it keeps.
  • A pipeline whose samplers were all listed at start uses the library. A pipeline with a sampler first met in this process does not, until the next run. This is the one change from the original: such a sampler can land after samplers the next process makes later, such as the composer's.
  • VICTORY_SAMPLER_ORDER=0 restores the previous behaviour.

RTX 3080 10 GB, i5-13600K, Series S, automatic NVIDIA profile

One build, same cache, same boat save each run (prologue recap, then the fishing cutscene), about 4 min of play. Runs in order:

Run Sampler order Pipelines compiled Mean FPS P10 Intervals < 5 FPS Draws dropped, first minute
232 off (=0) ~120 15.4 6.4 3 2,233
233 on 19 16.2 9.6 0 1,271
234 off (=0) ~120 15.1 7.0 4 2,308
235 on 2 16.2 10.1 1 987

The first run with an empty list compiles as before and fills the list; the second stores the pipelines.

The risk is the one the guard was there for: a sampler with the wrong filter or address mode. I compared captures across 13 runs. I found no difference that the setting causes. One floral shirt in the boat scene varies between runs with the setting on and off alike. These runs had no BCPack tables (#385), so I could not judge texture detail on faces and clothes. A check on a PC with the tables would help.

Checks: cargo clippy --workspace --all-targets (with and without --all-features) is clean, and cargo test -p victory-gpu --lib gives 528 passed.

🤖 Generated with Claude Code

**@⁠Garu667** on GitHub · 2026-11-28 03:47 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/395) `Garu667:perf/static-sampler-order` → `main` · +60280 −5429 · 207 files · 662 commits · closed without merging On NVIDIA, pipelines with static samplers never come from the library. `allows_static_samplers` keeps them out, because the driver numbers static samplers in the order a process first makes them, and that order changes from run to run. On an RTX 3080 that means about 120 pipelines compiled again at every launch, and draws dropped while they compile. This ports trustno1-coder's fix (trustno1-coder/VIctory-NVIDIA@64d4931, `pipeline/samplers.rs`, GPL-3.0): - Every distinct static sampler goes to `static-samplers.txt` beside the library, one line each, in the order first met. - Each process makes the listed samplers in that order right after its device exists, in root signatures it keeps. - A pipeline whose samplers were all listed at start uses the library. A pipeline with a sampler first met in this process does not, until the next run. This is the one change from the original: such a sampler can land after samplers the next process makes later, such as the composer's. - `VICTORY_SAMPLER_ORDER=0` restores the previous behaviour. ## RTX 3080 10 GB, i5-13600K, Series S, automatic NVIDIA profile One build, same cache, same boat save each run (prologue recap, then the fishing cutscene), about 4 min of play. Runs in order: | Run | Sampler order | Pipelines compiled | Mean FPS | P10 | Intervals < 5 FPS | Draws dropped, first minute | | --- | --- | ---: | ---: | ---: | ---: | ---: | | 232 | off (`=0`) | ~120 | 15.4 | 6.4 | 3 | 2,233 | | 233 | on | 19 | 16.2 | 9.6 | 0 | 1,271 | | 234 | off (`=0`) | ~120 | 15.1 | 7.0 | 4 | 2,308 | | 235 | on | 2 | 16.2 | 10.1 | 1 | 987 | The first run with an empty list compiles as before and fills the list; the second stores the pipelines. The risk is the one the guard was there for: a sampler with the wrong filter or address mode. I compared captures across 13 runs. I found no difference that the setting causes. One floral shirt in the boat scene varies between runs with the setting on and off alike. These runs had no BCPack tables (#385), so I could not judge texture detail on faces and clothes. A check on a PC with the tables would help. Checks: `cargo clippy --workspace --all-targets` (with and without `--all-features`) is clean, and `cargo test -p victory-gpu --lib` gives 528 passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The NVIDIA driver numbers static samplers in the order a process first
makes them, and a stored pipeline keeps those numbers. Since the title's
pipelines are made by several threads, the order changes from run to
run, so pipelines with static samplers were kept out of the library on
NVIDIA (allows_static_samplers) and compiled again at every launch.

Every distinct static sampler now goes to a list beside the library, and
each process makes the listed ones in that order right after its device.
A pipeline whose samplers were all listed at start uses the library; one
with a sampler first met in this process does not, until the next run.
VICTORY_SAMPLER_ORDER=0 restores the previous behaviour.

From trustno1-coder/VIctory-NVIDIA@64d4931 (pipeline/samplers.rs,
GPL-3.0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 03:50:33 +00:00
Author
Owner

@⁠akimfomin on GitHub · 2026-11-28 11:37 UTC · original · edited 2026-11-28 12:07 UTC

PortBridge found one fallback case to separate from the successful RTX 3080 A/B. At ca46856f, sync warns on a refused sampler root, then adds the same key to SEEN. prime snapshots that set as settled. If replay of an earlier listed root fails, the source still allows pipelines using those keys into the library. I have not observed a driver refusal in a hardware run.

A small injected-failure test could prime two ordered keys, refuse the first, and require an ordinary compile for a pipeline using the second too. That checks the original ordering assumption and leaves your successful warm-path test intact. I found this while comparing AnyXboxX #577, where we can reuse the same negative control. PortBridge.

Minimal fallback patch for ca46856f. I verified it applies and reverses, and cargo check --locked -p victory-gpu --lib --features diagnostics finished successfully on the patched head under Windows. The injected driver-refusal test remains open.

**@⁠akimfomin** on GitHub · 2026-11-28 11:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7238679395) · edited 2026-11-28 12:07 UTC PortBridge found one fallback case to separate from the successful RTX 3080 A/B. At `ca46856f`, [`sync` warns on a refused sampler root](https://github.com/TaynanGT/Vice-Tay/blob/ca46856f8250ed0a2f79914fcf3f0d6f4a7ab842/crates/victory-gpu/src/pipeline/samplers.rs#L174-L195), then adds the same key to `SEEN`. [`prime` snapshots that set](https://github.com/TaynanGT/Vice-Tay/blob/ca46856f8250ed0a2f79914fcf3f0d6f4a7ab842/crates/victory-gpu/src/pipeline/samplers.rs#L64-L79) as settled. If replay of an earlier listed root fails, the source still allows pipelines using those keys into the library. I have not observed a driver refusal in a hardware run. A small injected-failure test could prime two ordered keys, refuse the first, and require an ordinary compile for a pipeline using the second too. That checks the original ordering assumption and leaves your successful warm-path test intact. I found this while comparing [AnyXboxX #577](https://github.com/LooperSalty/AnyXboxX/pull/577), where we can reuse the same negative control. [PortBridge](https://github.com/akimfomin/PortBridge). [Minimal fallback patch](https://github.com/akimfomin/PortBridge/blob/5798d4dd6115a74f9d1c3d8c73ba127704ee5e6f/audit/evidence/ecosystem-transfer-2026-11-28/vice-sampler-fail-closed.patch) for `ca46856f`. I verified it applies and reverses, and `cargo check --locked -p victory-gpu --lib --features diagnostics` finished successfully on the patched head under Windows. The injected driver-refusal test remains open.
A refused static sampler shifts the places of every sampler made after
it, so those no longer count as settled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Garu667 on GitHub · 2026-11-28 16:08 UTC · original

@⁠akimfomin Thank you, it's fixed

**@⁠Garu667** on GitHub · 2026-11-28 16:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7242002221) @⁠akimfomin Thank you, it's fixed
Author
Owner

@⁠Indy2l on GitHub · 2026-11-28 18:13 UTC · original

Tested on an RTX 3060 12 GB (driver 621.40) / i5-12400F / 16 GB, with BCPack tables, Series S, -Machine 3060, this branch (based on fe7c6e5), the prologue route from the cell to the crowded room.

Run State before static-samplers.txt Loaded / made in play Queue (pipelines being made) fps median
50 driver cache and pipelines folder cleared, -WarmPipelines empty, 22 recorded 187 / 1,829 empty about 8 min into the world —
51 the same, list kept 22 203 / 1,814 empty about 7 min into the world —
52 plain second launch 22 2,023 / 28 0 to 10 throughout 7.8
42 (main, for comparison) warm, earlier runs — about 1,265 / 1,400 peak 388 7.8

After run 51, host-pipelines.bin grew from 17 MB to 125 MB, so the static-sampler pipelines were stored. Run 52 is the first run of the day whose opening cutscene drew in full from its first frames.

Textures, the check you asked for. Runs 52 (this branch) and 42 (main) were both recorded. I compared them at one frame every 10 s, and at full resolution at matching spots in the cell, the corridors and the crowded room. Faces (Lucia, the waitress, the inmates), clothing, cinder-block walls, the chipped table paint and the floors are equally sharp and tiled the same. I saw no change in filtering, blur, pixelation or address mode. The camera is player-controlled, so the frames are matched by place, not pixel for pixel.

Two side notes:

  • With the list in place, -WarmPipelines still did not help the title (run 51: 1,814 made in play after the warm built 1,982). So whatever keeps warm results from the title on this PC is not the sampler order (details in #423).
  • The first minute in the world of run 52 still dropped up to about 3,000 draws a frame with at most 4 pipelines queued. That is unrelated to this change: the same happened in an earlier run with every pipeline loaded.

🤖 Generated with Claude Code

**@⁠Indy2l** on GitHub · 2026-11-28 18:13 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7243627963) Tested on an RTX 3060 12 GB (driver 621.40) / i5-12400F / 16 GB, **with BCPack tables**, Series S, `-Machine 3060`, this branch (based on `fe7c6e5`), the prologue route from the cell to the crowded room. | Run | State before | `static-samplers.txt` | Loaded / made in play | Queue (pipelines being made) | fps median | |---|---|---|---|---|---| | 50 | driver cache and `pipelines` folder cleared, `-WarmPipelines` | empty, 22 recorded | 187 / 1,829 | empty about 8 min into the world | — | | 51 | the same, list kept | 22 | 203 / 1,814 | empty about 7 min into the world | — | | **52** | plain second launch | 22 | **2,023 / 28** | **0 to 10 throughout** | **7.8** | | 42 (`main`, for comparison) | warm, earlier runs | — | about 1,265 / 1,400 | peak 388 | 7.8 | After run 51, `host-pipelines.bin` grew from 17 MB to 125 MB, so the static-sampler pipelines were stored. Run 52 is the first run of the day whose opening cutscene drew in full from its first frames. **Textures, the check you asked for.** Runs 52 (this branch) and 42 (`main`) were both recorded. I compared them at one frame every 10 s, and at full resolution at matching spots in the cell, the corridors and the crowded room. Faces (Lucia, the waitress, the inmates), clothing, cinder-block walls, the chipped table paint and the floors are equally sharp and tiled the same. I saw no change in filtering, blur, pixelation or address mode. The camera is player-controlled, so the frames are matched by place, not pixel for pixel. Two side notes: - With the list in place, `-WarmPipelines` still did not help the title (run 51: 1,814 made in play after the warm built 1,982). So whatever keeps warm results from the title on this PC is not the sampler order (details in #423). - The first minute in the world of run 52 still dropped up to about 3,000 draws a frame with at most 4 pipelines queued. That is unrelated to this change: the same happened in an earlier run with every pipeline loaded. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-29 11:37 UTC · original

Thanks for the matched-place texture comparison and the second-launch data. The 2,023 library hits and 28 new pipelines make a strong case for consistent sampler ordering on this setup. Please keep the unresolved warm-to-title handoff in #423 separate, and retain the static-sampler provenance and cache compatibility checks.

**@⁠TaynanGT** on GitHub · 2026-11-29 11:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7255237625) Thanks for the matched-place texture comparison and the second-launch data. The 2,023 library hits and 28 new pipelines make a strong case for consistent sampler ordering on this setup. Please keep the unresolved warm-to-title handoff in #423 separate, and retain the static-sampler provenance and cache compatibility checks.
github-bot closed this pull request 2026-11-30 17:14:34 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 17:09 UTC · original

main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

**@⁠TaynanGT** on GitHub · 2026-11-30 17:09 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7285816326) `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.