Reduce bindless texture queue selection time #221

Open
venglov wants to merge 1 commit from upstream-pr/221 into main
venglov commented 2026-11-24 22:48:14 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by venglov on 2026-11-24T22:48:14Z.


The bindless texture pass asks for up to 4,096 uploads at a time. With a large streaming backlog, selecting that batch used to sort every due slot and then scan the queue again for the frame counters.

This change counts slots during candidate collection and selects only the entries the pass can serve. Retries still go first in newest-write order, followed by alternating newest and oldest fresh writes. A regression checks the exact selected slots, write tokens, and counters for every cap on a mixed queue.

Measurement

Optimized Windows x64 synthetic benchmark under Wine 11.21 on Apple M1 Pro. Each figure is the median of 11 batches of 40 calls to selection and counting. Slot indices were shuffled relative to write order, and the selected entries and counters matched the baseline throughout.

Queued Due Retries Cap Before After
40,000 90% 10% 4,096 1.89 ms 0.87 ms
40,000 100% 50% 4,096 1.95 ms 0.74 ms
25,000 85% 10% 4,096 1.45 ms 0.68 ms
4,000 90% 10% 4,096 0.090 ms 0.063 ms
40,000 90% 10% 0 0.17 ms 0.23 ms

The production upload pass uses the 4,096-entry call. The benchmark measures CPU queue work only. In-game frame time is unmeasured.

Verification

  • Windows x64 victory-gpu library tests under Wine reported 111 passed by default and 118 passed with all features, with one ignored in each run. Tests that require a supported D3D12 device may skip under Wine.
  • victory-gpu Clippy passed for the Windows MSVC target with warnings denied in both feature configurations, using blake3/pure for cross-compilation.
  • cargo xtask policy and git diff --check passed.

AI-assisted with Codex. All test and benchmark inputs are synthetic.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592957111 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/221). Originally posted by [venglov](https://github.com/venglov) on 2026-11-24T22:48:14Z. --- The bindless texture pass asks for up to 4,096 uploads at a time. With a large streaming backlog, selecting that batch used to sort every due slot and then scan the queue again for the frame counters. This change counts slots during candidate collection and selects only the entries the pass can serve. Retries still go first in newest-write order, followed by alternating newest and oldest fresh writes. A regression checks the exact selected slots, write tokens, and counters for every cap on a mixed queue. ### Measurement Optimized Windows x64 synthetic benchmark under Wine 11.21 on Apple M1 Pro. Each figure is the median of 11 batches of 40 calls to selection and counting. Slot indices were shuffled relative to write order, and the selected entries and counters matched the baseline throughout. | Queued | Due | Retries | Cap | Before | After | | ---: | ---: | ---: | ---: | ---: | ---: | | 40,000 | 90% | 10% | 4,096 | 1.89 ms | 0.87 ms | | 40,000 | 100% | 50% | 4,096 | 1.95 ms | 0.74 ms | | 25,000 | 85% | 10% | 4,096 | 1.45 ms | 0.68 ms | | 4,000 | 90% | 10% | 4,096 | 0.090 ms | 0.063 ms | | 40,000 | 90% | 10% | 0 | 0.17 ms | 0.23 ms | The production upload pass uses the 4,096-entry call. The benchmark measures CPU queue work only. In-game frame time is unmeasured. ### Verification - Windows x64 `victory-gpu` library tests under Wine reported 111 passed by default and 118 passed with all features, with one ignored in each run. Tests that require a supported D3D12 device may skip under Wine. - `victory-gpu` Clippy passed for the Windows MSVC target with warnings denied in both feature configurations, using `blake3/pure` for cross-compilation. - `cargo xtask policy` and `git diff --check` passed. AI-assisted with Codex. All test and benchmark inputs are synthetic.
chatgpt-codex-connector[bot commented 2026-11-24 23:09:39 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:48:27Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T22:50:19.870644Z 5c7e9c9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7146667057 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/221#issuecomment-7146667057). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:48:27Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"5c7e9c990d59537bc06b7007ce180b7a17e83071","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T22:50:19.870644Z">2026-11-24T22:50:19.870644Z</relative-time> | `5c7e9c9` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
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/221:upstream-pr/221'
git switch 'upstream-pr/221'

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/221'
git switch 'upstream-pr/221'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/221'
git switch 'upstream-pr/221'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/221'
git switch 'main'
git merge --squash 'upstream-pr/221'
git switch 'main'
git merge --ff-only 'upstream-pr/221'
git switch 'main'
git merge 'upstream-pr/221'
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
fxceless/victory-fork!221
No description provided.