Camera-turn stutter: frames over 60 ms in a turn 28 % → 20 % (4.2 % → 2.2 % with #4635): DirectStorage workers a quarter of the cores at normal priority where they share the frame's #4640
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4640
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4639"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@thatblend on GitHub · 2026-12-01 00:26 UTC · original
thatblend:perf/dstorage-workers-shared-cores→main· +54 −2 · 1 files · 1 commits · openWhat it changes
When the camera turns, the frame rate drops and long frames pile up; part of that is our own DirectStorage workers getting in the frame's way on processors with one cache for all cores.
e1251c31as it is, in the swings: frames over 60 msEach number is one run of 240 s; the columns are every valid run made, not a selection.
What was wrong. The workers are as many as processors, kept on the half the frame is not on where the process was placed (
keep_off_the_frames_cores), and below normal priority so that they "take the processors nobody of the frame wants". Where the process is not placed on a half (one cache for all cores, as on a Ryzen 7 9800X3D), there is no such half and no such processors: 16 workers sit on the frame's own 16. When the camera turns the title asks for the textures of what comes into view, some hundreds of requests a second, and all of them unpack at once. Each takes the guards' lock (watch.rs) for the pages it writes, as the threads a frame waits for do for every refresh, and a worker below normal priority loses its processor with the lock held. In three timelines of camera swings the workers stood 1.0 to 1.6 s of 7 s waiting for that lock among themselves, and the long frames' chains held 10.5 ms more of a streaming request and 4.5 ms more of "woken, not running yet" than the other frames'.What this does. Where the workers share the frame's processors (
off_the_frames_cores()is all of them), there are a quarter as many (2 at least, 8 at most: 4 on 16 threads), at normal priority. Where the process is placed on a half, nothing changes.VICTORY_DSTORAGE_WORKERSandVICTORY_DSTORAGE_PRIORITYsay otherwise as before. One function,shared_workers, with a unit test; 54 lines, most of them the comment with the numbers.What it costs. Throughput while the camera turns: 6.7 against 9.8 MB of textures made ready for the card a frame in the mean of the runs above, so what comes into view takes that much longer to sharpen. Fewer is worse (2 workers: 1.8 MB a frame) and more buys nothing (8 workers: the frames as with 4), both seen on a tree of two days ago.
How it was tested
e1251c31unchanged, the two settings chosen with the switches it has (nothing set againstVICTORY_DSTORAGE_WORKERS=4 VICTORY_DSTORAGE_PRIORITY=0, which is what this makes the default here), in turn.e1251c31with this, #4636 and six open pull requests of others applied (4500, 4294, 4247, 4206, 4509, 4493),VICTORY_DSTORAGE_WORKERS=16 VICTORY_DSTORAGE_PRIORITY=-1against nothing set.cargo testpassed for the crates it touches: at this branch's head on7d93ee07,cargo test --locked -p victory-hle --lib: 469 passed, 1 failed, 13 ignored. The one that fails,modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it, fails the same way on7d93ee07without this change (three runs of three, 468 passed and that one failed) and passes when run alone; it is a timing test that this does not touch.cargo clippy --locked -p victory-hle --all-targets -- -D warnings: clean.Checked for overlap
VICTORY_DSTORAGE_PRIORITY=0in the launcher on the same processor so that the world comes in sooner; it keeps the 16 workers and gives no frame times. This makes normal priority the default in the code where the workers share the frame's processors and cuts their number as well, with the numbers above; the two agree on the priority, and if #4605 is merged its launcher line simply says what this already does. Related by subject: #4207 takes the camera turn from the submitting thread's side (title writes among the steps) and #4248 takes the guards' lock from the refreshes' side; this is the workers' side of the same lock. Related by file (dstorage.rs), other matters: #2761, #3553, #3154.@Kassadd on GitHub · 2026-12-01 01:23 UTC · original
Tested on a hybrid-core CPU under Proton on Linux: the automatic choice picks 8 with no
switch, the tail of the frame times improves, and it gets further before the driver gives up.
Environment: i9-14900K (8 P-cores + 16 E-cores, 32 logical), RTX 4080 SUPER 16 GiB,
62 GiB, CachyOS, NVIDIA 620.73.04, Proton Experimental
…-w0be231-d1011dd-v71cae0,Series X
1.0.2.1, 3440x1440 monitor.--res 1440 --aspect 21:9 --dlss off --no-framegen-ready --preload.mainat7d93ee0with #3350 and this PR on top, both appliedwith no conflict.
The automatic choice works with no switch, on a CPU of two core kinds — not the Ryzen
9800X3D the description measured:
off_the_frames_cores()reports what it reports on 8 P-cores + 16 E-cores,shared_workers(32)gives 8, and the priority default lands on 0. The branch the description argues for is the one
taken, unasked.
Frame times in the world, medians over frames with more than 1,000 draws, 41 samples from
about four minutes of play (the run ended on the fault described below):
The "before" figures come from earlier runs on this machine on trees without this PR; the scene
and the draw counts differ, so treat the p90 as the comparable part — the tail is where the
change shows, which is what the description predicts. I am not claiming the median.
What I did not expect, and the part worth your attention. With 32 workers — the automatic
count, with the priority already set to 0 by hand, so half of this PR's change and still the old
worker count — entering a shop ended the process inside a few minutes with an NVIDIA MMU fault:
With 8 workers and priority 0 the same shop is survivable: it takes a dip to about 8 fps and
stays up. But it does not remove the fault — about four minutes of world play later, the same
Xid 31and the samedevice lost, with the last thing logged being the sweep letting hostcopies go "under pressure". So this PR gets further and is smoother while it lasts, and the
driver still gives up. That is worth saying plainly rather than leaving as "fixed": I would not
want anyone reading this as a cure.
What I did not test: Windows, AMD cards, a 16-core CPU (where the clamp keeps the count at 4
and the priority at −1), and whether the fault is only postponed rather than made rarer — four
minutes is not enough to tell. If I learn more I will add it here.
@isgti07-hub on GitHub · 2026-12-01 02:59 UTC · original
A data point on the worker count, from the other side of the trade: texture streaming while driving fast.
RTX 5090 32 GB, Ryzen 7 9800X3D, 64 GB RAM, Windows 11, game files on an NVMe SSD; Series X, 3840x2160 output, DLSS Quality, no frame generation. Three sessions of driving through the city in my own build (main
7d93ee07with #4636 and changes of my own; the middle one also with this PR). Thetextures picked by index, the queueline, averaged over each session:VICTORY_DSTORAGE_WORKERS=16In play with 4 workers, textures came in late and blurry all the time at speed; with 16 back, I saw it about three times in 15 minutes.
Caveats: these are separate sessions, not an in-run A/B (the worker count is read once at the start), and they did not cover the same streets, so the scene is not controlled; I didn't measure the frame-time side, which is what your numbers are about. So this doesn't contradict your camera-turn result, but on this CPU 4 workers seem too few for fast driving. Something between 4 and 16, or a count that grows while the queue is long, might keep both.
🤖 Generated with Claude Code
@IRennie74 on GitHub · 2026-12-01 06:28 UTC · original
What this does on a 6-core. A Ryzen 5 5600X (6 cores, 12 threads, one CCD) is not placed on a half, so
off_the_frames_cores()returns all 12 and this takes the shared branch:shared_workers(12)= 3 workers at priority 0. That is one fewer than the 4 that isgti07-hub found too few for fast driving on a 9800X3D, and this CPU has less to spare.On the same 5600X with an RTX 3060 (Series S, DLSS Performance) we went the other way. The pool stays below normal, and part of it goes up to normal only while the title is waiting for a read: two
IsCompletepolls of a still-pending entry within 4 ms (itsSleep(1)loop), or a request that has sat 4 ms since its submit. It drops back after 16 ms with neither. Before that, requests on the frame's chain came to 14 ms a frame on average in a loading stretch and 45 ms at worst. That change went in with six other launcher defaults, and the set together brought streaming requests on the frame's chain from 13.9 to 2.3 ms a frame and the walking p99 frame from 268 to 202 ms. We did not measure it on its own, so I can't give its share.Raising workers only while the title waits might keep your camera-turn gain and avoid the slow textures when driving. Both changes edit the same
workers/prioritylines inscheduler(), so they can't both land as they are. We haven't run this PR on the 5600X.VICTORY_DSTORAGE_WORKERS=3 VICTORY_DSTORAGE_PRIORITY=0against unset is the A/B we'd use.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.