Repository navigation
Diagnostics: count the title mapping changes and how long the lock was held - #766
rostaddotcc wants to merge 1 commit into
Conversation
…s held The texture lane's frame line counts readers waiting for the mapping lock, never the writer that holds it. This adds, under the diagnostics feature only, a count of the runtime's changes per frame, the time the lock was held in all of them, and the longest single change, printed next to the write-watch askings line. Measured on Linux/Proton (RX 7900 XT, RADV, vkd3d-proton 3.2.0) over a streaming run: 1 721 to 5 041 changes a frame, the lock held 3 844 to 8 020 ms a frame in all, the longest single change 46 to 175 ms. The readers wait for that: on the same windows their summed wait was 194 to 2 475 ms, against a frame of 4 to 8 seconds. No behaviour changes with the feature off.
|
Closing this: a253706's frame log covers the same three numbers, and better. The counters here were a separate It is on in diagnostics builds and toggled with What the counters found here, for the record, since it is the reason they existed: on 8dd30ab the write lock was held across the whole map operation — 1 721–5 041 mapping changes per frame, lock held 3 844–8 020 ms of each frame, longest single change 46–175 ms, with readers' summed wait 194–2 475 ms. That is what led to #175 (range-scoped locks), which is where the fix lives. #175 measures 430.6 ms median / 2 977.7 max of texture wait on 9376fd6 against 0.0 in 136 of 136 windows with the diff. |
The texture lane's line in the frame log counts readers waiting for the mapping lock. Nothing counts the writer that holds it, which is the number a decision about that lock needs — and it turns out to be the whole frame.
What this adds
Under the diagnostics feature only, in
watch.rs: aRemappingguard now records how long it was held, and three counters keep the count of the runtime's mapping changes, the microseconds held in all of them, and the longest single change.host.rsprints and resets them next to the write-watch askings line:Nothing changes with the feature off — the tuple gains its second field only under
cfg(feature = "diagnostics"), andDropis empty otherwise.What it measured (Linux/Proton, RX 7900 XT, RADV, vkd3d-proton 3.2.0)
A 400-second streaming run, the windows of the last two minutes:
So the title remaps thousands of times a frame in short changes of about 1.5 ms, and the lock is held for most of the frame. That is why the reader lane waits whenever it looks: there is rarely a moment when the lock is free, and neither side was measuring the contention — this makes the writer half visible.
It also explains the two things about the reader side that were already known: the wait is not one long remap that could be interrupted (it is thousands of short ones, so a reader waits for the change in flight, not for a burst to end), and why scoping the lock to ranges (#175) removes the wait entirely rather than just shortening it — a reader's own range is being remapped only in the change that touches it.
Tests
victory-gpuunder Wine with vkd3d-proton servingd3d12and Microsoft'sd3dcompiler_47: 130 passed, 1 failed, 3 ignored. The failure is the platform one that fails onmaintoo (pipeline::library::tests::a_rejected_blob_gives_an_empty_library, vkd3d-proton refuses the garbage blob where D3D12 returns an empty library). Release build without the diagnostics feature compiles clean, andcargo xtask policyreports 171 files ok.