Avoid redundant shader decoding during store classification #1055

Closed
opened 2026-11-28 12:19:08 +00:00 by Damokles2 · 1 comment
Damokles2 commented 2026-11-28 12:19:08 +00:00 (Migrated from github.com)
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Damokles2 on 2026-11-28T12:19:08Z.


I found a redundant shader decoding operation in victory-gpu/src/pipeline.rs.

The current translate path evaluates any(stores) and any(stores_by_address) separately. Both predicates decode the native shader program before classifying its instructions.

Since every raw-address store match also establishes the general store flag, both classifications can share a single decode while preserving the existing short-circuit behavior.

I tested an isolated prototype against upstream commit 63b902fe.

Results:

  • 27 deterministic and 4,096 seeded differential cases passed with identical classification flags.
  • Median classification latency decreased by 20–53% across all 60 non-empty synthetic workloads.
  • A four-instruction program without stores improved from 471 ns to 238 ns.
  • A 4,096-instruction program without stores improved from 883 µs to 435 µs.
  • Decoder calls and allocation requests were reduced by 50% in single-program workloads visited by both original predicates.

The benchmark used actual decoder implementations, optimized Rust builds, warmups, and 15 alternating paired samples on an Intel Core Ultra 9 275HX.

Some predecoded classification-only cases showed additional scan overhead, but all non-empty complete classification workloads improved.

The proposed change preserves conservative opcode classification, decode-error handling, and existing short-circuit behavior without introducing a persistent cache.

These measurements concern store classification only, not total shader compilation time or gameplay FPS.

I found no equivalent correction in the reviewed PR diffs. Is anyone already working on this? If not, I would like to prepare a narrow optimization with regression tests.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:6664908006 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1055). Originally posted by [Damokles2](https://github.com/Damokles2) on 2026-11-28T12:19:08Z. --- I found a redundant shader decoding operation in `victory-gpu/src/pipeline.rs`. The current `translate` path evaluates `any(stores)` and `any(stores_by_address)` separately. Both predicates decode the native shader program before classifying its instructions. Since every raw-address store match also establishes the general store flag, both classifications can share a single decode while preserving the existing short-circuit behavior. I tested an isolated prototype against upstream commit `63b902fe`. Results: - 27 deterministic and 4,096 seeded differential cases passed with identical classification flags. - Median classification latency decreased by 20–53% across all 60 non-empty synthetic workloads. - A four-instruction program without stores improved from 471 ns to 238 ns. - A 4,096-instruction program without stores improved from 883 µs to 435 µs. - Decoder calls and allocation requests were reduced by 50% in single-program workloads visited by both original predicates. The benchmark used actual decoder implementations, optimized Rust builds, warmups, and 15 alternating paired samples on an Intel Core Ultra 9 275HX. Some predecoded classification-only cases showed additional scan overhead, but all non-empty complete classification workloads improved. The proposed change preserves conservative opcode classification, decode-error handling, and existing short-circuit behavior without introducing a persistent cache. These measurements concern store classification only, not total shader compilation time or gameplay FPS. I found no equivalent correction in the reviewed PR diffs. Is anyone already working on this? If not, I would like to prepare a narrow optimization with regression tests. AI-assisted with OpenAI Codex.
github-actions[bot] commented 2026-11-28 12:19:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by github-actions[bot] on 2026-11-28T12:19:15Z.


Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239145215 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1055#issuecomment-7239145215). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T12:19:15Z. --- Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
Sign in to join this conversation.
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
trustno1-coder/VIctory-NVIDIA#1055
No description provided.