DirectStorage: decode workers run below normal priority #348

Open
N7z wants to merge 1 commit from upstream-pr/348 into main
N7z commented 2026-11-24 23:49:39 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by N7z on 2026-11-24T23:49:39Z.


The DirectStorage scheduler starts one decode worker per logical processor, at normal priority. While the title streams, those workers compete with the threads that record and submit frames, and the card waits behind them. This puts the workers at THREAD_PRIORITY_BELOW_NORMAL, as the pipeline workers already are (crates/victory-gpu/src/pipeline/make.rs), so they use what the frame leaves. The worker count is unchanged.

Why

  • A CPU profile (WPR, about 2 minutes in the world) had dstorage::work at 17% of the process's samples: seek_read 8%, zlib 5%, BCPack 1.3%. That is 16 threads on this machine.
  • The frame line showed the card idle while the submitting thread prepared lists: 150–250 ms per frame.

Measured (one machine; same scene each run, --console series-s, VICTORY_RELAY=2, release build; world frame-line windows only)

  • NVIDIA GeForce RTX 4060 Laptop GPU 8 GB, Intel Core i7-13620H (16 logical processors), 16 GB RAM, Windows 11.
run fps mean fps median oldest slot in the pick-by-index queue
before (16 workers, normal) 1.89 2.0 465 frames
4 workers, below normal (experiment) 2.49 2.5 1,213 frames
this change (16 workers, below normal) 2.28 2.4 154 frames
  • Capping the workers gave a little more fps but left textures waiting much longer, so this PR leaves the count to #49.
  • No device removal and no host error in any run.
  • The runs were made on this change applied over #188 (Series S needs it to show a picture); the change itself does not depend on #188.

Checks

  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.
  • cargo test -p victory-hle --locked: 95 passed; no_dll_planting 1 passed.

Not tested

  • Series X, AMD or Intel cards, machines with fewer cores, a hard drive.
  • One run per configuration only.

Related

No game data.

(AI-assisted: Claude Code profiled the run, wrote the change and this description; the runs were played by me.)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593801554 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/348). Originally posted by [N7z](https://github.com/N7z) on 2026-11-24T23:49:39Z. --- The DirectStorage scheduler starts one decode worker per logical processor, at normal priority. While the title streams, those workers compete with the threads that record and submit frames, and the card waits behind them. This puts the workers at `THREAD_PRIORITY_BELOW_NORMAL`, as the pipeline workers already are (`crates/victory-gpu/src/pipeline/make.rs`), so they use what the frame leaves. The worker count is unchanged. **Why** - A CPU profile (WPR, about 2 minutes in the world) had `dstorage::work` at 17% of the process's samples: `seek_read` 8%, zlib 5%, BCPack 1.3%. That is 16 threads on this machine. - The frame line showed the card idle while the submitting thread prepared lists: 150–250 ms per frame. **Measured** (one machine; same scene each run, `--console series-s`, `VICTORY_RELAY=2`, release build; world frame-line windows only) - NVIDIA GeForce RTX 4060 Laptop GPU 8 GB, Intel Core i7-13620H (16 logical processors), 16 GB RAM, Windows 11. | run | fps mean | fps median | oldest slot in the pick-by-index queue | |---|---:|---:|---:| | before (16 workers, normal) | 1.89 | 2.0 | 465 frames | | 4 workers, below normal (experiment) | 2.49 | 2.5 | 1,213 frames | | **this change** (16 workers, below normal) | **2.28** | **2.4** | **154 frames** | - Capping the workers gave a little more fps but left textures waiting much longer, so this PR leaves the count to #49. - No device removal and no host error in any run. - The runs were made on this change applied over #188 (Series S needs it to show a picture); the change itself does not depend on #188. **Checks** - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean. - `cargo test -p victory-hle --locked`: 95 passed; `no_dll_planting` 1 passed. **Not tested** - Series X, AMD or Intel cards, machines with fewer cores, a hard drive. - One run per configuration only. **Related** - #49 scales the worker counts; Marvisak/VIctory#1355 swaps miniz_oxide for zlib-rs. Both are independent of this. No game data. (AI-assisted: Claude Code profiled the run, wrote the change and this description; the runs were played by me.)
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/348:upstream-pr/348'
git switch 'upstream-pr/348'

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