DirectStorage: decode workers run below normal priority #348

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

@⁠N7z on GitHub · 2026-11-24 23:49 UTC · original
N7z:dstorage-low-priority → main · +13 −1 · 1 files · 1 commits · open

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.)

**@⁠N7z** on GitHub · 2026-11-24 23:49 UTC · [original](https://github.com/fxceless/victory-fork/pull/348) `N7z:dstorage-low-priority` → `main` · +13 −1 · 1 files · 1 commits · open 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.)
The scheduler starts one worker per logical processor at normal priority.
While the title streams, they took the processor from the threads that
record and submit frames, and the card stood idle behind them. The
workers now run at THREAD_PRIORITY_BELOW_NORMAL, like the pipeline
workers (pipeline/make.rs), and use what the frame leaves.

Measured on an RTX 4060 Laptop 8 GB, i7-13620H, 16 GB, Series S with
VICTORY_RELAY=2, same scene: 1.9 -> 2.3 fps mean in the world (median
2.0 -> 2.4); the oldest texture in the pick-by-index queue was 154 frames
old against 465 before. Capping the workers at 4 instead gave 2.5 fps but
left textures waiting up to 1,213 frames, so the count is left alone.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:41:22 +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/348/head:github-bot/gh-348'
git switch 'github-bot/gh-348'

Merge

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