GPU pipeline cache: retain first-used keys when the warmup list fills #3668

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/3668 into main
andrewpozdnakov7-jpg commented 2026-11-28 04:50:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T04:50:22Z.


When a run uses more than 8,192 distinct pipeline keys, the warmup list takes a subset in HashSet order. That can discard pipelines used during the first frames. Save the first uses observed in this run in order and retain the previous runs' order for any remaining slots. The limit and the one-key-per-line file format stay the same.

I compared the exact old and new list logic over 40 runs with 10,240 generated keys. In a group of the first 512, the old list retained 391–424 keys, with a median of 410. The new list kept all 512 and saved exactly the first 8,192 keys on every run. Duplicate uses, mixed old and new keys and reading a saved list are covered. This measures list retention on generated input.

All 15 pipeline library and worker-queue tests passed, along with strict GPU Clippy and the asset policy.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding this change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5536791092 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3668). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T04:50:22Z. --- When a run uses more than 8,192 distinct pipeline keys, the warmup list takes a subset in `HashSet` order. That can discard pipelines used during the first frames. Save the first uses observed in this run in order and retain the previous runs' order for any remaining slots. The limit and the one-key-per-line file format stay the same. I compared the exact old and new list logic over 40 runs with 10,240 generated keys. In a group of the first 512, the old list retained 391–424 keys, with a median of 410. The new list kept all 512 and saved exactly the first 8,192 keys on every run. Duplicate uses, mixed old and new keys and reading a saved list are covered. This measures list retention on generated input. All 15 pipeline library and worker-queue tests passed, along with strict GPU Clippy and the asset policy. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding this change into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 04:53:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T04:53:48Z.


Windows CI passed at 8c2792e, including Clippy on both build configurations and the repository test job. The 40 comparisons in the description apply to the same commit. The warmup file contained the first 8,192 observed keys in every trial.

The next run uses those retained keys for early pipeline starts. The next step is maintainer review.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding this change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7234326766 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3668#issuecomment-7234326766). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T04:53:48Z. --- [Windows CI](https://github.com/Marvisak/VIctory/actions/runs/46109380864/job/140869268929) passed at `8c2792e`, including Clippy on both build configurations and the repository test job. The 40 comparisons in the description apply to the same commit. The warmup file contained the first 8,192 observed keys in every trial. The next run uses those retained keys for early pipeline starts. The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding this change into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 05:17:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T05:17:27Z.


I checked #3668 with #3188 and #2328 on 63bcca43. Combined commit 26fbae7 preserves all three heads. The resolution keeps the save mutex around early-only and full saves, and retains the tests for ordered keys and both lock modes.

A temporary restart fixture on app-local WARP 1.0.22 with Agility 1.620.2 recorded 10,240 generated keys twice each. I blocked the first replacement of early-pipelines.txt in a fresh test directory. The retry saved exactly the first 8,192 keys in first-use order. The seeded library and prebuilt manifest matched byte for byte before and after the retry. In a fresh process, wanted_early found all 8,192 saved keys and excluded all 2,048 later keys and the displaced previous-run key.

All 17 existing pipeline-library tests passed. Strict all-features GPU Clippy and the asset policy passed. This checks cache files and the lookup on restart with synthetic data. Game startup timing was outside the run.

Please retain the Git authors on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the integration into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7234576720 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3668#issuecomment-7234576720). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T05:17:27Z. --- I checked #3668 with #3188 and #2328 on `63bcca43`. [Combined commit `26fbae7`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/26fbae7d78123ab4793192abd7b21416f7b9a6d8) preserves all three heads. The resolution keeps the save mutex around early-only and full saves, and retains the tests for ordered keys and both lock modes. A temporary restart fixture on app-local WARP 1.0.22 with Agility 1.620.2 recorded 10,240 generated keys twice each. I blocked the first replacement of `early-pipelines.txt` in a fresh test directory. The retry saved exactly the first 8,192 keys in first-use order. The seeded library and prebuilt manifest matched byte for byte before and after the retry. In a fresh process, `wanted_early` found all 8,192 saved keys and excluded all 2,048 later keys and the displaced previous-run key. All 17 existing pipeline-library tests passed. Strict all-features GPU Clippy and the asset policy passed. This checks cache files and the lookup on restart with synthetic data. Game startup timing was outside the run. Please retain the Git authors on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the integration into another commit. AI-assisted with OpenAI Codex.
cloph-dsp commented 2026-11-28 12:24:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-28T12:24:00Z.


Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):

  • PR #3668 at head 8c2792e4f6fd88be374c789356433d1aa2c99c58, base/parent 63bcca43c6a00a758510398fa43096ce7e4f7df0.
  • cargo test --locked -p victory-gpu --lib -- pipeline::library::tests::a_run_over_capacity_keeps_its_earliest_pipeline_uses --exact --test-threads=1 --quiet → 1 passed, 0 failed, 232 filtered, exit 0.
  • git grep -F for the test name on the base returned no match (test is new on this PR); git diff --check 63bcca4 HEAD clean (1 file, +54/-14).
  • Used a per-worktree CARGO_TARGET_DIR (never shared) with CARGO_BUILD_JOBS=2.
  • Only the named synthetic test was replayed; full workspace suite and clippy were not run locally (2 pre-existing warnings in the lib test build).
  • GPU/driver: N/A (CPU-only pipeline-library test). No game data, assets, extracted shaders, DRM or decrypt involved.

AI-assisted (Hy4 flash).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7239200741 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3668#issuecomment-7239200741). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-28T12:24:00Z. --- Independent local verification (Windows, Rust 1.100.0/MSVC, no game data): - PR #3668 at head `8c2792e4f6fd88be374c789356433d1aa2c99c58`, base/parent `63bcca43c6a00a758510398fa43096ce7e4f7df0`. - `cargo test --locked -p victory-gpu --lib -- pipeline::library::tests::a_run_over_capacity_keeps_its_earliest_pipeline_uses --exact --test-threads=1 --quiet` → 1 passed, 0 failed, 232 filtered, exit 0. - `git grep -F` for the test name on the base returned no match (test is new on this PR); `git diff --check 63bcca4 HEAD` clean (1 file, +54/-14). - Used a per-worktree `CARGO_TARGET_DIR` (never shared) with `CARGO_BUILD_JOBS=2`. - Only the named synthetic test was replayed; full workspace suite and clippy were not run locally (2 pre-existing warnings in the lib test build). - GPU/driver: N/A (CPU-only pipeline-library test). No game data, assets, extracted shaders, DRM or decrypt involved. AI-assisted (Hy4 flash).
futurepro62 commented 2026-11-29 23:46:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-29T23:46:55Z.


NVIDIA full-suite run, to go with the reports above by cloph-dsp, since none of them names a GPU run. Tested exact head 8c2792e (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: a_run_over_capacity_keeps_its_earliest_pipeline_uses.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7264721036 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3668#issuecomment-7264721036). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-29T23:46:55Z. --- NVIDIA full-suite run, to go with the reports above by cloph-dsp, since none of them names a GPU run. Tested exact head `8c2792e` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **867 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `a_run_over_capacity_keeps_its_earliest_pipeline_uses`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3668:upstream-pr/3668'
git switch 'upstream-pr/3668'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3668'
git switch 'upstream-pr/3668'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3668'
git switch 'upstream-pr/3668'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3668'
git switch 'main'
git merge --squash 'upstream-pr/3668'
git switch 'main'
git merge --ff-only 'upstream-pr/3668'
git switch 'main'
git merge 'upstream-pr/3668'
git push origin 'main'
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
Marvisak/VIctory!3668
No description provided.