Identify residency and mapping waits by allocation kind #432

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

@⁠feanorsun on GitHub · 2026-11-27 04:52 UTC · original
feanorsun:diagnostics/residency-wait-sources → main · +184 −42 · 4 files · 1 commits · open

Refs #371

Jesper-Andersson reported a longest residency wait of 592 ms in run H with the own-bytes pool enabled. The longest mapping wait in that run was 35 ms. The existing counters gave totals across threads, so the log alone could not place either wait on the path to a Present. Run H and the request for instrumentation

A diagnostics build with VICTORY_TIMELINE enabled now shows new memory: resident around the synchronous MakeResident call and new memory: mapped around the mapping barrier. The latter includes waiting for the shared queue lock, submitting the copy, and waiting for its fence if needed. Both spans end before the counters are reported. With VICTORY_WAIT_RESIDENT=0, both functions return before creating a span or counting a sample.

Each existing summary now includes an allocation_kinds field with a count, total microseconds, and maximum microseconds for each kind. The resident summary still reports every 1,000 calls. The mapped summary reports on the first call and every 200 calls. The counters distinguish textures (including depth twins), new texture-pool heaps, upload buffers, shared buffers, CPU-mapped card buffers, and device-local UAV buffers. Each label identifies the allocation that requested the wait. For example, staging blocks and other users of the upload-buffer helper share its label. That helper calls MakeResident and then maps the resource for the CPU. It contributes only to the resident summary.

Windows CPU verification

Listed the two tests first in each configuration, then ran each by its full name with one test thread. Default features passed 2/2 and diagnostics passed 2/2. Synthetic resident samples of 10 and 30 µs for textures and 7 µs for a shared buffer produced 3 calls, 47 µs total, and a 30 µs maximum. An independent 7 µs mapped sample counted only in the mapping summary. The tests also check the formatted allocation labels and the two reporting intervals.

cargo test --offline --locked -j 1 -p victory-gpu --lib residency_waits -- --list
cargo test --offline --locked -j 1 -p victory-gpu --lib --features diagnostics residency_waits -- --list
$tests = @(
    'host::residency_waits::tests::separates_waits_and_allocation_kinds'
    'host::residency_waits::tests::keeps_the_existing_report_intervals'
)
foreach ($name in $tests) {
    cargo test --offline --locked -j 1 -p victory-gpu --lib $name -- --exact --test-threads=1
    cargo test --offline --locked -j 1 -p victory-gpu --lib --features diagnostics $name -- --exact --test-threads=1
}

Local tests cover diagnostic accounting. No D3D12 device, WARP, or game was run, and no frame times were measured.

**@⁠feanorsun** on GitHub · 2026-11-27 04:52 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/432) `feanorsun:diagnostics/residency-wait-sources` → `main` · +184 −42 · 4 files · 1 commits · open Refs #371 Jesper-Andersson reported a longest residency wait of 592 ms in run H with the own-bytes pool enabled. The longest mapping wait in that run was 35 ms. The existing counters gave totals across threads, so the log alone could not place either wait on the path to a Present. [Run H and the request for instrumentation](https://git.gtahub.st/github/avatarmanz--VIctory-7900XTX/issues/371) A diagnostics build with `VICTORY_TIMELINE` enabled now shows `new memory: resident` around the synchronous `MakeResident` call and `new memory: mapped` around the mapping barrier. The latter includes waiting for the shared queue lock, submitting the copy, and waiting for its fence if needed. Both spans end before the counters are reported. With `VICTORY_WAIT_RESIDENT=0`, both functions return before creating a span or counting a sample. Each existing summary now includes an `allocation_kinds` field with a count, total microseconds, and maximum microseconds for each kind. The resident summary still reports every 1,000 calls. The mapped summary reports on the first call and every 200 calls. The counters distinguish textures (including depth twins), new texture-pool heaps, upload buffers, shared buffers, CPU-mapped card buffers, and device-local UAV buffers. Each label identifies the allocation that requested the wait. For example, staging blocks and other users of the upload-buffer helper share its label. That helper calls `MakeResident` and then maps the resource for the CPU. It contributes only to the resident summary. ### Windows CPU verification Listed the two tests first in each configuration, then ran each by its full name with one test thread. Default features passed 2/2 and `diagnostics` passed 2/2. Synthetic resident samples of 10 and 30 µs for textures and 7 µs for a shared buffer produced 3 calls, 47 µs total, and a 30 µs maximum. An independent 7 µs mapped sample counted only in the mapping summary. The tests also check the formatted allocation labels and the two reporting intervals. ```powershell cargo test --offline --locked -j 1 -p victory-gpu --lib residency_waits -- --list cargo test --offline --locked -j 1 -p victory-gpu --lib --features diagnostics residency_waits -- --list $tests = @( 'host::residency_waits::tests::separates_waits_and_allocation_kinds' 'host::residency_waits::tests::keeps_the_existing_report_intervals' ) foreach ($name in $tests) { cargo test --offline --locked -j 1 -p victory-gpu --lib $name -- --exact --test-threads=1 cargo test --offline --locked -j 1 -p victory-gpu --lib --features diagnostics $name -- --exact --test-threads=1 } ``` Local tests cover diagnostic accounting. No D3D12 device, WARP, or game was run, and no frame times were measured.
Add separate timeline spans for MakeResident and the mapping barrier. Report per-kind counts, total time and maximum time alongside the two existing summaries at their usual intervals.

Refs #371
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:55:40 +00:00
This pull request can be merged automatically.
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/432/head:github-bot/gh-432'
git switch 'github-bot/gh-432'

Merge

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