Avoid redundant shader decoding during store classification #1055

Closed
opened 2026-11-28 14:32:19 +00:00 by github-bot · 1 comment
Owner

@⁠Damokles2 on GitHub · 2026-11-28 12:19 UTC · original

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.

**@⁠Damokles2** on GitHub · 2026-11-28 12:19 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1055) 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-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:32:19 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 12:19 UTC · original

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)

**@⁠github-actions[bot]** on GitHub · 2026-11-28 12:19 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1055#issuecomment-7239145215) 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)
This discussion has been locked. Commenting is limited to contributors.
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#1055
No description provided.