perf(gpu): lock-free fast path for common indirect host command signatures #285

Open
github-bot wants to merge 1 commit from github-bot/gh-285 into main AGit
Owner

@⁠Mikey970 on GitHub · 2026-11-27 20:40 UTC · original
Mikey970:pr/lockfree-host-signature → main · +28 −3 · 1 files · 1 commits · open

Problem

host_signature(kind, stride) in crates/victory-gpu/src/draw.rs acquires a global Mutex<Vec<...>> on every indirect draw/dispatch lookup across all parallel command-list recording workers (~4,500+ indirect executions per frame).

Fix

  • Adds a lock-free [OnceLock<Option<SyncSignature>>; 4] fast path for the four standard single-argument indirect command signatures: Draw (0, 16), DrawIndexed (1, 20), Dispatch (2, 12), and DispatchMesh (10, 12).
  • Keeps the existing Mutex<Vec<...>> cache as a fallback for any non-standard (kind, stride) pair.
  • ID3D12CommandSignature is immutable and free-threaded in D3D12.

Testing

  • Built and verified with cargo test -p victory-gpu --lib draw::thread_tests.
**@⁠Mikey970** on GitHub · 2026-11-27 20:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/285) `Mikey970:pr/lockfree-host-signature` → `main` · +28 −3 · 1 files · 1 commits · open ## Problem `host_signature(kind, stride)` in `crates/victory-gpu/src/draw.rs` acquires a global `Mutex<Vec<...>>` on every indirect draw/dispatch lookup across all parallel command-list recording workers (~4,500+ indirect executions per frame). ## Fix - Adds a lock-free `[OnceLock<Option<SyncSignature>>; 4]` fast path for the four standard single-argument indirect command signatures: Draw `(0, 16)`, DrawIndexed `(1, 20)`, Dispatch `(2, 12)`, and DispatchMesh `(10, 12)`. - Keeps the existing `Mutex<Vec<...>>` cache as a fallback for any non-standard `(kind, stride)` pair. - `ID3D12CommandSignature` is immutable and free-threaded in D3D12. ## Testing - Built and verified with `cargo test -p victory-gpu --lib draw::thread_tests`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:42:58 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/285/head:github-bot/gh-285'
git switch 'github-bot/gh-285'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-285'
git switch 'github-bot/gh-285'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-285'
git switch 'github-bot/gh-285'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-285'
git switch 'main'
git merge --squash 'github-bot/gh-285'
git switch 'main'
git merge --ff-only 'github-bot/gh-285'
git switch 'main'
git merge 'github-bot/gh-285'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.