Submit line: say how long its thread ran on a processor, beside how long it worked #4420
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!4420
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4419"
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?
@TolkoDev on GitHub · 2026-11-30 20:10 UTC · original
TolkoDev:pr/submit-cpu-time→main· +1024 −850 · 33 files · 14 commits · closed without mergingWhat it changes
The line "that thread worked X ms" times each job from start to end, so it takes in what the thread waited: for the card, in the present call, for locks. It is easy to read as processor time. The line now also says how long the thread ran on a processor.
It uses
QueryThreadCycleTime, turned into time by the time stamp counter's rate, measured from the first job on.GetThreadTimeswould not do, because it moves in clock ticks. A test on a Ryzen 7 7700 with Windows 10, 5 s each:GetThreadTimes, summed per piece(The two methods were measured in separate runs, so the spun times differ a little.)
Microsoft advises against converting thread cycles to time in general. The conversion assumes a counter with one rate; here it was 3.80 million a millisecond, the processor's base rate.
Cost: two calls per job of the submit thread.
How it was tested
that thread worked X msthat thread worked 55.4 ms (waits included; it ran on a processor for 25.7 ms of that). Over the 349 one-second lines of heavy play (3000 or more indirect executions a frame), medians: frame 50.6 ms, worked 49.6 ms, on a processor 22.4 ms. The processor time was 45 % of the worked time (10th to 90th percentile: 42 to 49 %). In the menu: 0.5 ms worked, 0.4 ms on a processor. In none of the 458 lines was the processor time above the worked time.cargo test: the 8queue::behindtests pass, one of them new (a sleep costs the thread few cycles, a spin many). The rest ofvictory-gpu's tests were not run. Clippy reports nothing inbehind.rs. CI's first Clippy step already fails on main.Checked for overlap
behind.rs, and all pull requests for thread CPU time. Related: #3617 (localization) rewrites the same log line, and #3102 and #1925 each add a counter to the same array. All three show as conflicting with main now. Whichever lands second needs a merge.@IRennie74 on GitHub · 2026-11-30 22:38 UTC · original
This answers an open question on a smaller PC. On a Ryzen 5 5600X with an RTX 3060 (Series S, DLSS Performance) the line says the submitting thread worked 44-54 ms of a 55-58 ms frame, while a sampling profile had it running only about 63 % of the run (75 % inside its jobs). How much of "worked" is on a processor tells whether that thread is short of CPU or waiting; we will try this in our diagnostics build.
One fix:
queue/behind.rsis not Windows-only, but the new block (behind.rs:55-91) linkskernel32, callswindows_sys(acfg(windows)dependency invictory-gpu'sCargo.toml) and usesstd::arch::x86_64::_rdtsc, sovictory-gpustops compiling on any other target. Gatingthread_cycles/counter_since/cycles_a_mswith#[cfg(all(windows, target_arch = "x86_64"))]and a stub returning 0 elsewhere (the line then prints 0, as it does in the first 10 ms) keeps it building; the new test wants the same gate.@trustno1-coder on GitHub · 2026-12-01 18:41 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed