Shader names: a new container's role is found in one pass, not one per name #3596

Closed
github-bot wants to merge 1 commit from github-bot/gh-3596 into main AGit
Owner

@⁠tphira612 on GitHub · 2026-11-30 01:30 UTC · original
perf/shader-name-scan → main · +160 −23 · 2 files · 1 commits · closed without merging

What it changes

When the title creates a pipeline with a shader not seen before, ambient::role (compute) and mirror::part (pixel) look for a few program names in the container. Each name was compared at every byte, one full pass per name: four passes for a compute container, two for a pixel one. This runs on the thread that creates the pipeline, inside the shader table's lock that every other pipeline creation waits on (pipeline::shader).

Now one pass looks only where CS_ (or ps_) starts and checks the names there. The answers are the same, including which name wins when several are present.

This complements #3502, which moves this work out of the lock. Here the work itself gets shorter, on whichever thread runs it.

How it was tested

  • name_scans_time (new, ignored benchmark), 256 KiB container, Ryzen 9 5900X, release build: compute 1,049 → 85 µs, pixel 317 → 76 µs. A standalone run at 16 KiB: compute 73 → 4 µs. Frame times in the title not measured.
  • names_are_found_as_before (new): both scans give the old answers on 20,000 generated containers with names inserted, overlapping, cut short and at the end. The existing roles_by_name and parts_by_name pass.
  • cargo test --locked -p victory-gpu --lib: 922 passed. The one failure, every_switch_of_the_translator_is_in_the_key, also fails on main.
  • cargo build --release --locked -p victory and cargo xtask policy --staged pass. Clippy adds no warnings to victory-gpu (same 27 sites as main).
**@⁠tphira612** on GitHub · 2026-11-30 01:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3596) `perf/shader-name-scan` → `main` · +160 −23 · 2 files · 1 commits · closed without merging ## What it changes When the title creates a pipeline with a shader not seen before, `ambient::role` (compute) and `mirror::part` (pixel) look for a few program names in the container. Each name was compared at every byte, one full pass per name: four passes for a compute container, two for a pixel one. This runs on the thread that creates the pipeline, inside the shader table's lock that every other pipeline creation waits on (`pipeline::shader`). Now one pass looks only where `CS_` (or `ps_`) starts and checks the names there. The answers are the same, including which name wins when several are present. This complements #3502, which moves this work out of the lock. Here the work itself gets shorter, on whichever thread runs it. ## How it was tested - `name_scans_time` (new, ignored benchmark), 256 KiB container, Ryzen 9 5900X, release build: **compute 1,049 → 85 µs, pixel 317 → 76 µs**. A standalone run at 16 KiB: compute 73 → 4 µs. Frame times in the title not measured. - `names_are_found_as_before` (new): both scans give the old answers on 20,000 generated containers with names inserted, overlapping, cut short and at the end. The existing `roles_by_name` and `parts_by_name` pass. - `cargo test --locked -p victory-gpu --lib`: 922 passed. The one failure, `every_switch_of_the_translator_is_in_the_key`, also fails on `main`. - `cargo build --release --locked -p victory` and `cargo xtask policy --staged` pass. Clippy adds no warnings to `victory-gpu` (same 27 sites as `main`).
ambient::role and mirror::part tell a few of the title's programs by
their name in the container. Each name was looked for by comparing it at
every byte, one pass per name: four for a compute container, two for a
pixel one. They run once for each new container, on the thread that
creates the pipeline and under the shader table's lock.

Now one pass looks only where "CS_" (or "ps_") starts and checks every
name there; the first name in the old order still wins. On 256 KiB of
bytes naming nothing (Ryzen 9 5900X, release build): compute 1,049 us to
85 us, pixel 317 us to 76 us. A test checks both against the old scans on
20,000 generated containers.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 01:31:53 +00:00
github-bot closed this pull request 2026-11-30 18:10:36 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3596
No description provided.