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

Closed
Garu667 wants to merge 662 commits from upstream-pr/395 into main
Garu667 commented 2026-11-28 03:47:47 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Garu667 on 2026-11-28T03:47:47Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5536372805 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/395). Originally posted by [Garu667](https://github.com/Garu667) on 2026-11-28T03:47:47Z. --- 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)
akimfomin commented 2026-11-28 11:37:55 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by akimfomin on 2026-11-28T11:37:55Z.


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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7238679395 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7238679395). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-28T11:37:55Z. --- 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.
Garu667 commented 2026-11-28 16:08:17 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Garu667 on 2026-11-28T16:08:17Z.


@akimfomin Thank you, it's fixed

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7242002221 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7242002221). Originally posted by [Garu667](https://github.com/Garu667) on 2026-11-28T16:08:17Z. --- @akimfomin Thank you, it's fixed
Indy2l commented 2026-11-28 18:13:36 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Indy2l on 2026-11-28T18:13:36Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7243627963 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7243627963). Originally posted by [Indy2l](https://github.com/Indy2l) on 2026-11-28T18:13:36Z. --- 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)
TaynanGT commented 2026-11-29 11:37:25 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T11:37:25Z.


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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7255237625 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7255237625). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T11:37:25Z. --- 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 commented 2026-11-30 17:09:45 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:09:45Z.


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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285816326 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/395#issuecomment-7285816326). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:09:45Z. --- `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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
TaynanGT/Vice-Tay!395
No description provided.