[pr-diagnostics][rendering] descriptor: clear a staged slot's shows record before it is given back #696

Open
MasterWolf wants to merge 1 commit from MasterWolf/Darner:pr/post-merge-stage-retired-views-shown into post-merge
First-time contributor

Contributor role (optional)

  • Fluxer ID: 1577824307575267331

What it changes

  • The problem on post-merge: a diagnostics session of about 16 minutes logged 252 darner_gpu::shows::on errors ("descriptors of destroyed objects"), all on staged slots: the 252 destroyed objects were shown by 254 descriptors in 251 distinct slots (3 slots each showed two of them, at different times), 249 of those 254 were written again later, and no bind read a list of slots that named any of them.

Staged::drop and the Ended::Set drop pushed staged slots back on the free list and then retired the host resources they showed, without telling crate::shows. When a retired resource was destroyed before another view took the slot, shows::gone still found the slot naming it and logged an error for a slot no list could name.

Both drops now call shows::wrote(cpu(heap, slot), None, "given back") (the slot's descriptor handle) before the slot goes back on the free list. If the call came after, a thread could take the slot first and this call would erase its new record. No descriptor is written. shows::wrote is empty without the diagnostics feature, so other builds are unchanged.

Adds a diagnostics-only test on a WARP device for both drop paths (descriptor::stage::tests::slots_given_back_show_nothing); where no WARP device can be made it returns at once and is reported as passed.

How it was tested

  • Tested revision: 12fd974 on post-merge 28a9b42. The checks below ran on d63ae64, the same tree with an earlier commit message.

  • Commands and results, on d63ae64:

    • cargo build --workspace --locked: ok
    • cargo test -p darner-gpu --features diagnostics --locked: 14 passed, 0 failed (13 on the base)
    • cargo clippy --workspace --all-targets --features diagnostics --locked: the same warning counts as the base (darner-gpu 56)
  • Changes a default: no (diagnostics builds only).

  • A/B result: no default and no speed claim. In-game check, diagnostics builds, same settings and hardware:

    A (28a9b42) B (this change and 3 others)
    darner_gpu::shows::on errors 252 0, 0 (2 sessions)
    darner_gpu::regions errors (unrelated, for scale) 43 48, 47

    1 run of about 16.5 minutes for A, 2 runs of about 15.5 and 14.5 minutes for B.

  • Gates run on that revision (the three in AGENTS.md; there is no CI), each also on the base 28a9b42:

    • gate 3, cargo test --workspace --locked, on d63ae64: 182 passed, 0 failed (182 on the base)
    • gate 1, cargo clippy --workspace --all-targets --locked, on d63ae64, without -D warnings: the same warning counts as the base (darner-gpu 46, darner 8, darner-shader 6, darner-loader 4). The base already has these, so with -D warnings the gate fails on the base and here alike.
    • gate 2, cargo clippy --workspace --all-targets --all-features --locked, on 12fd974, without -D warnings: the same, darner-gpu 61 on both.
  • Gameplay: RTX 5070 Ti 16 GB, driver 621.40, Series X, 2560x1440, DLSS DLAA, hardware ray tracing, DLSS frame generation 2x.

  • Shader wave sizes tested: not relevant (no shader change).

  • Hardware dependence: none expected (CPU-side bookkeeping of the diagnostics build).

  • Coverage gaps: B was a combined build, not this change alone: it also had 3 other unmerged changes, the trail-map programs listed in OVER in indirect.rs (sent as its own PR) and two local changes not sent for review (a high residency priority for heaps while they hold ray tracing memory, and a bounded cache that keeps given-back pager pages committed). The first B session ended in a GPU device removal after about 15.5 minutes, with no breadcrumbs (DARNER_D3D12_DRED was off), so its cause is unknown; nothing ties it to any of the changes, and this one writes no descriptor (CPU-side bookkeeping of diagnostics builds only). The second B session ran with DARNER_D3D12_DRED=1 and ended without a removal, but at about a third of the frame rate, so it is the weaker of the two zeros.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on post-merge.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: 1577824307575267331 ## What it changes - The problem on `post-merge`: a diagnostics session of about 16 minutes logged 252 `darner_gpu::shows::on` errors ("descriptors of destroyed objects"), all on staged slots: the 252 destroyed objects were shown by 254 descriptors in 251 distinct slots (3 slots each showed two of them, at different times), 249 of those 254 were written again later, and no bind read a list of slots that named any of them. `Staged::drop` and the `Ended::Set` drop pushed staged slots back on the free list and then retired the host resources they showed, without telling `crate::shows`. When a retired resource was destroyed before another view took the slot, `shows::gone` still found the slot naming it and logged an error for a slot no list could name. Both drops now call `shows::wrote(cpu(heap, slot), None, "given back")` (the slot's descriptor handle) before the slot goes back on the free list. If the call came after, a thread could take the slot first and this call would erase its new record. No descriptor is written. `shows::wrote` is empty without the `diagnostics` feature, so other builds are unchanged. Adds a diagnostics-only test on a WARP device for both drop paths (`descriptor::stage::tests::slots_given_back_show_nothing`); where no WARP device can be made it returns at once and is reported as passed. ## How it was tested - Tested revision: `12fd974` on `post-merge` `28a9b42`. The checks below ran on `d63ae64`, the same tree with an earlier commit message. - Commands and results, on `d63ae64`: - `cargo build --workspace --locked`: ok - `cargo test -p darner-gpu --features diagnostics --locked`: 14 passed, 0 failed (13 on the base) - `cargo clippy --workspace --all-targets --features diagnostics --locked`: the same warning counts as the base (darner-gpu 56) - Changes a default: no (diagnostics builds only). - A/B result: no default and no speed claim. In-game check, diagnostics builds, same settings and hardware: | | A (`28a9b42`) | B (this change and 3 others) | |---|---|---| | `darner_gpu::shows::on` errors | 252 | 0, 0 (2 sessions) | | `darner_gpu::regions` errors (unrelated, for scale) | 43 | 48, 47 | 1 run of about 16.5 minutes for A, 2 runs of about 15.5 and 14.5 minutes for B. - Gates run on that revision (the three in AGENTS.md; there is no CI), each also on the base `28a9b42`: - gate 3, `cargo test --workspace --locked`, on `d63ae64`: 182 passed, 0 failed (182 on the base) - gate 1, `cargo clippy --workspace --all-targets --locked`, on `d63ae64`, without `-D warnings`: the same warning counts as the base (darner-gpu 46, darner 8, darner-shader 6, darner-loader 4). The base already has these, so with `-D warnings` the gate fails on the base and here alike. - gate 2, `cargo clippy --workspace --all-targets --all-features --locked`, on `12fd974`, without `-D warnings`: the same, darner-gpu 61 on both. - Gameplay: RTX 5070 Ti 16 GB, driver 621.40, Series X, 2560x1440, DLSS DLAA, hardware ray tracing, DLSS frame generation 2x. - Shader wave sizes tested: not relevant (no shader change). - Hardware dependence: none expected (CPU-side bookkeeping of the diagnostics build). - Coverage gaps: B was a combined build, not this change alone: it also had 3 other unmerged changes, the trail-map programs listed in `OVER` in `indirect.rs` (sent as its own PR) and two local changes not sent for review (a high residency priority for heaps while they hold ray tracing memory, and a bounded cache that keeps given-back pager pages committed). The first B session ended in a GPU device removal after about 15.5 minutes, with no breadcrumbs (`DARNER_D3D12_DRED` was off), so its cause is unknown; nothing ties it to any of the changes, and this one writes no descriptor (CPU-side bookkeeping of diagnostics builds only). The second B session ran with `DARNER_D3D12_DRED=1` and ended without a removal, but at about a third of the frame rate, so it is the weaker of the two zeros. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `post-merge`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found - Replaces or overlaps: none found
Staged::drop and the Ended::Set drop pushed staged slots back on the free
list and then retired the host resources they showed, without telling
crate::shows. When a retired resource was destroyed before another view
took the slot, shows::gone still found the slot naming it and logged
"descriptors of destroyed objects" for a slot no list could name. A
16-minute diagnostics session logged 252 such errors, all on staged
slots: no bind read a list naming one of them, and 249 of the 254
descriptors that showed them were written again later.

Both drops now call shows::wrote with the slot's descriptor handle and
None before the slot goes back on the free list. If the call came after,
a thread could take the slot first and this call would erase its new
record. The call also comes before the resource is retired. No
descriptor is written. shows::wrote is empty without the diagnostics
feature, so other builds are unchanged.

Adds a diagnostics-only test on a WARP device for both drop paths. Where
no WARP device can be made it returns at once and counts as passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 'pr/post-merge-stage-retired-views-shown:MasterWolf-pr/post-merge-stage-retired-views-shown'
git switch 'MasterWolf-pr/post-merge-stage-retired-views-shown'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'post-merge'
git merge --no-ff 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git switch 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git rebase 'post-merge'
git switch 'post-merge'
git merge --ff-only 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git switch 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git rebase 'post-merge'
git switch 'post-merge'
git merge --no-ff 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git switch 'post-merge'
git merge --squash 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git switch 'post-merge'
git merge --ff-only 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git switch 'post-merge'
git merge 'MasterWolf-pr/post-merge-stage-retired-views-shown'
git push origin 'post-merge'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!696
No description provided.