Skip to content

DirectStorage: decode workers run below normal priority - #348

Open
N7z wants to merge 1 commit into
fxceless:mainfrom
N7z:dstorage-low-priority
Open

N7z wants to merge 1 commit into
fxceless:mainfrom
N7z:dstorage-low-priority

Conversation

@N7z

@N7z N7z commented Nov 24, 2026

Copy link
Copy Markdown

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

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant