Descriptor slots are rewritten while lists in the air read them (relay); whole copies don't tear on RDNA 2 #545

Open
opened 2026-11-27 10:49:57 +00:00 by github-bot · 4 comments
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 10:49 UTC · original

What

With flights in the air (VICTORY_RELAY=2, the default: up to 256 lists submitted and not finished), shader-visible descriptor slots are rewritten while lists that may read them are still on the card. All paths below are in crates/victory-gpu/src/descriptor/host.rs on a-publier:

  • texture_slot_show_ahead (~2392) queues Flip { after: 0 }, so the slot is rewritten as soon as the upload job runs, whatever is in the air;
  • flip (~2416): after is the submission that recorded it, but lists sent after that one still read the slot when put (~2481) rewrites it;
  • show_new_later (~3384): the same gap for lists sent after the texture was made;
  • show_later (~2370) writes the neutral texture at once, while earlier lists still read the old view;
  • put / copy_to copy straight into the shader-visible heap, and texture_slots_flip only checks f.after <= finished (~2438).

DESCRIPTORS_VOLATILE (one-view tables, pipeline/host.rs ~546) does not make this legal. It lets descriptors change until a list executes, not while it is submitted and unfinished. The directly indexed heap has no such flag.

Proof

Test descriptor::host::tests::a_slot_flipped_ahead_changes_under_a_list_in_the_air, ignored because it fails on the current code: github.com/MamaLeVrai/VIctory-Belobug-AMD@13b68ee (branch desc-in-flight). The test:

  1. makes a title texture and a slot showing the neutral 1x1;
  2. sends a compute list that reads that slot through a volatile table, held on the card behind a fence;
  3. queues the Flip { after: 0 } that texture_slot_show_ahead queues, and runs texture_slots_flip.

The list reads [4, 4] instead of [1, 1], so the slot changed under it. The device was not removed. On an RX 6950 XT (RDNA 2), driver 32.0.21045.29003.

Does it tear on RDNA 2?

indirect::tests::descriptors_written_under_readers (ignored; VICTORY_BENCH_S=5) on the same RX 6950 XT:

  • views made in place in the shader-visible heap: 18.9 M writes. Of ~7.9 G group reads, 1,546,673,167 saw neither texture's size, so the read descriptor was half written (about 20 %). The device stayed OK.
  • whole copies from a CPU heap (what the code does now): 49.5 M writes, ~876 M reads, 0 torn.

So on RDNA 2, as on the RX 7900 XTX measured in 02f36e4, whole copies don't tear. A rewrite in flight shows the other texture to lists still running (a picture glitch, pop-in or a wrong mip). It is not a read of garbage, so it is probably not a cause of the RDNA 2 device resets (#376, #329).

Fix?

None proposed. Because the heap is directly indexed, any list sent before the write may read the slot. Re-arming the flip with a later after only narrows the window. Writing only when nothing is in the air stalls flips with 256 lists out. A real fix needs fresh slots, or two heaps used in turn. That is an architectural choice for the maintainer.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 10:49 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/545) ## What With flights in the air (`VICTORY_RELAY=2`, the default: up to 256 lists submitted and not finished), shader-visible descriptor slots are rewritten while lists that may read them are still on the card. All paths below are in `crates/victory-gpu/src/descriptor/host.rs` on `a-publier`: - `texture_slot_show_ahead` (~2392) queues `Flip { after: 0 }`, so the slot is rewritten as soon as the upload job runs, whatever is in the air; - `flip` (~2416): `after` is the submission that recorded it, but lists sent after that one still read the slot when `put` (~2481) rewrites it; - `show_new_later` (~3384): the same gap for lists sent after the texture was made; - `show_later` (~2370) writes the neutral texture at once, while earlier lists still read the old view; - `put` / `copy_to` copy straight into the shader-visible heap, and `texture_slots_flip` only checks `f.after <= finished` (~2438). `DESCRIPTORS_VOLATILE` (one-view tables, `pipeline/host.rs` ~546) does not make this legal. It lets descriptors change until a list executes, not while it is submitted and unfinished. The directly indexed heap has no such flag. ## Proof Test `descriptor::host::tests::a_slot_flipped_ahead_changes_under_a_list_in_the_air`, ignored because it fails on the current code: https://github.com/MamaLeVrai/VIctory-Belobug-AMD/commit/13b68ee (branch `desc-in-flight`). The test: 1. makes a title texture and a slot showing the neutral 1x1; 2. sends a compute list that reads that slot through a volatile table, held on the card behind a fence; 3. queues the `Flip { after: 0 }` that `texture_slot_show_ahead` queues, and runs `texture_slots_flip`. The list reads `[4, 4]` instead of `[1, 1]`, so the slot changed under it. The device was not removed. On an RX 6950 XT (RDNA 2), driver 32.0.21045.29003. ## Does it tear on RDNA 2? `indirect::tests::descriptors_written_under_readers` (ignored; `VICTORY_BENCH_S=5`) on the same RX 6950 XT: - **views made in place in the shader-visible heap:** 18.9 M writes. Of ~7.9 G group reads, **1,546,673,167 saw neither texture's size**, so the read descriptor was half written (about 20 %). The device stayed OK. - **whole copies from a CPU heap (what the code does now):** 49.5 M writes, ~876 M reads, **0** torn. So on RDNA 2, as on the RX 7900 XTX measured in `02f36e4`, whole copies don't tear. A rewrite in flight shows the other texture to lists still running (a picture glitch, pop-in or a wrong mip). It is not a read of garbage, so it is probably **not** a cause of the RDNA 2 device resets (#376, #329). ## Fix? None proposed. Because the heap is directly indexed, any list sent before the write may read the slot. Re-arming the flip with a later `after` only narrows the window. Writing only when nothing is in the air stalls flips with 256 lists out. A real fix needs fresh slots, or two heaps used in turn. That is an architectural choice for the maintainer. AI-assisted (Claude Code); no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 10:49:57 +00:00
Author
Owner

@⁠rpmaster2 on GitHub · 2026-11-27 14:00 UTC · original

In-game confirmation of this on RDNA4, with the symptom pair and a switch that removes both.

Host: Radeon RX 9070 XT 16 GB, Adrenalin 26.11.2 (32.0.32029.2010), Ryzen 5 5600, 32 GB, Windows 11 10.0.26100.9974. Fork a-publier at 4eb6cfd, --console series-s, diagnostics build, the same save for every run. Recipe otherwise: VICTORY_TEXTURE_STORE=1 VICTORY_WARM_BAD=0 VICTORY_CARD_STEPS=2 VICTORY_THIN=1 VICTORY_UPSCALER=6.

Two symptoms, both intermittent, in the same place in the scene:

  1. Black lines and, once, a texture stretched across the whole screen at one particular spot in the prison area.
  2. The near-LOD character skin missing: hair, eyes, teeth and clothing draw, the face and hands do not. Observed as "police at a distance have faces, the same officers lose them when they walk close"; women were fine in those frames because they were farther away. Twice this was missing from the first frame, and in two identical runs one had it and the other did not. The far LOD of the same character always draws.

VICTORY_LATE_WAIT=0 removes both. Two consecutive 4-minute runs with everything else identical: no lines, no missing skin, in either. The cost is what one would expect from switching the flights off:

frames ms/frame GPU
VICTORY_LATE_WAIT=0 (relay off) 6.9-8.8 113.9-145.1 37-40 ms
default relay (3) 18.9-21.9 45.7-53.0 0-3 ms

So on this card the glitch you describe is not only a synthetic one: it reaches gameplay as black lines and as a whole material losing its texture, and it disappears exactly when lists are no longer allowed to run past a slot rewrite. Your show_later writes the neutral texture at once, which would be consistent with a skin slot showing "nothing" rather than the previous texture — that part is my guess, not measured.

If a bisect helps: with VICTORY_LATE_WAIT=1 (both stages wait for everything) I have not run the game yet; I can do that next and say whether 1 also clears it, which would separate "stage 2's partial wait" from "any flight at all".

AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; counts and versions only, no game files.

**@⁠rpmaster2** on GitHub · 2026-11-27 14:00 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/545#issuecomment-7220219740) In-game confirmation of this on RDNA4, with the symptom pair and a switch that removes both. Host: Radeon RX 9070 XT 16 GB, Adrenalin 26.11.2 (32.0.32029.2010), Ryzen 5 5600, 32 GB, Windows 11 10.0.26100.9974. Fork `a-publier` at `4eb6cfd`, `--console series-s`, diagnostics build, the same save for every run. Recipe otherwise: `VICTORY_TEXTURE_STORE=1 VICTORY_WARM_BAD=0 VICTORY_CARD_STEPS=2 VICTORY_THIN=1 VICTORY_UPSCALER=6`. **Two symptoms, both intermittent, in the same place in the scene:** 1. Black lines and, once, a texture stretched across the whole screen at one particular spot in the prison area. 2. The **near**-LOD character skin missing: hair, eyes, teeth and clothing draw, the face and hands do not. Observed as "police at a distance have faces, the same officers lose them when they walk close"; women were fine in those frames because they were farther away. Twice this was missing **from the first frame**, and in two identical runs one had it and the other did not. The far LOD of the same character always draws. **`VICTORY_LATE_WAIT=0` removes both.** Two consecutive 4-minute runs with everything else identical: no lines, no missing skin, in either. The cost is what one would expect from switching the flights off: | | frames | ms/frame | GPU | |---|---|---|---| | `VICTORY_LATE_WAIT=0` (relay off) | 6.9-8.8 | 113.9-145.1 | 37-40 ms | | default relay (3) | 18.9-21.9 | 45.7-53.0 | 0-3 ms | So on this card the glitch you describe is not only a synthetic one: it reaches gameplay as black lines and as a whole material losing its texture, and it disappears exactly when lists are no longer allowed to run past a slot rewrite. Your `show_later` writes the neutral texture at once, which would be consistent with a skin slot showing "nothing" rather than the previous texture — that part is my guess, not measured. If a bisect helps: with `VICTORY_LATE_WAIT=1` (both stages wait for everything) I have not run the game yet; I can do that next and say whether 1 also clears it, which would separate "stage 2's partial wait" from "any flight at all". AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; counts and versions only, no game files.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-27 14:44 UTC · original

Same results on RDNA 3: RX 7900 XT, Windows 11, desc-in-flight at 13b68ee (on a-publier 4eb6cfd), test profile, with other builds running on the machine.

  • a_slot_flipped_ahead_changes_under_a_list_in_the_air: failed 5 times out of 5, each time reading [4, 4] instead of [1, 1], with the flip done while the list was in the air. The device was not removed.
  • descriptors_written_under_readers with VICTORY_BENCH_S=5:
writes count group reads saw neither size device
views made in place in the shader-visible heap 15.9 M ~9.83 G 1,656,012,600 (~17 %) OK
whole copies from a CPU heap (current code) 38.3 M ~1.96 G 0 OK
one 32-byte store 19.6 M ~1.70 G 0 OK

So on RDNA 3 as well, whole copies don't tear, and a rewrite in flight shows the other texture to a list that is still running. The test shows the hazard on every run here, not only now and then.

Not tested: in-game with VICTORY_LATE_WAIT=0 on this card.

**@⁠adrianmjim** on GitHub · 2026-11-27 14:44 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/545#issuecomment-7221161706) Same results on RDNA 3: RX 7900 XT, Windows 11, `desc-in-flight` at 13b68ee (on `a-publier` 4eb6cfd), test profile, with other builds running on the machine. - `a_slot_flipped_ahead_changes_under_a_list_in_the_air`: failed 5 times out of 5, each time reading `[4, 4]` instead of `[1, 1]`, with the flip done while the list was in the air. The device was not removed. - `descriptors_written_under_readers` with `VICTORY_BENCH_S=5`: | writes | count | group reads | saw neither size | device | |---|---|---|---|---| | views made in place in the shader-visible heap | 15.9 M | ~9.83 G | 1,656,012,600 (~17 %) | OK | | whole copies from a CPU heap (current code) | 38.3 M | ~1.96 G | 0 | OK | | one 32-byte store | 19.6 M | ~1.70 G | 0 | OK | So on RDNA 3 as well, whole copies don't tear, and a rewrite in flight shows the other texture to a list that is still running. The test shows the hazard on every run here, not only now and then. Not tested: in-game with `VICTORY_LATE_WAIT=0` on this card.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 15:16 UTC · original

Thanks @⁠rpmaster2 and @⁠adrianmjim, this closes the question I left open: the rewrite hazard reaches gameplay. VICTORY_LATE_WAIT=0 removing both symptoms on an RX 9070 XT fits the mechanism (a slot rewritten while a list in the air reads it), and so does adrianmjim's 5-of-5 reproduction on an RX 7900 XT.

For whoever tries a fix: VICTORY_LATE_WAIT=1 (both stages wait for everything) is the useful bisect. If it clears the symptoms, the stage-2 partial wait is what lets the rewrite overtake a flight; if not, any flight is enough. The slots that matter are the ones texture_slot_show_ahead and show_later rewrite with after: 0 (descriptor/host.rs ~2370-2392). A narrower fix than fresh slots or two heaps may exist for just those two paths: queue their writes behind the last submission begun when they are queued (not the one that recorded the slot), and write them only once that one has finished. The cost would be a delayed texture, not a stall. I have not tried it.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 15:16 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/545#issuecomment-7221842633) Thanks @⁠rpmaster2 and @⁠adrianmjim, this closes the question I left open: the rewrite hazard reaches gameplay. `VICTORY_LATE_WAIT=0` removing both symptoms on an RX 9070 XT fits the mechanism (a slot rewritten while a list in the air reads it), and so does adrianmjim's 5-of-5 reproduction on an RX 7900 XT. For whoever tries a fix: `VICTORY_LATE_WAIT=1` (both stages wait for everything) is the useful bisect. If it clears the symptoms, the stage-2 partial wait is what lets the rewrite overtake a flight; if not, any flight is enough. The slots that matter are the ones `texture_slot_show_ahead` and `show_later` rewrite with `after: 0` (descriptor/host.rs ~2370-2392). A narrower fix than fresh slots or two heaps may exist for just those two paths: queue their writes behind the last submission begun when they are queued (not the one that recorded the slot), and write them only once that one has finished. The cost would be a delayed texture, not a stall. I have not tried it. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 15:37 UTC · original

A first fix for the ahead-flip path is up as #636: the flip no longer rewrites a slot under lists already sent, it waits for the submissions begun when it was queued. The #545 test fails without it ([4, 4] instead of [1, 1]) and passes with it. @⁠rpmaster2, @⁠adrianmjim: if you can, a run of #636 against your base with the default relay would show whether the black lines and the missing near-LOD skin are gone. Not done there: show_later's neutral write and the title's own mirrored descriptor writes (reasons on the PR).

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 15:37 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/545#issuecomment-7222276891) A first fix for the ahead-flip path is up as #636: the flip no longer rewrites a slot under lists already sent, it waits for the submissions begun when it was queued. The #545 test fails without it (`[4, 4]` instead of `[1, 1]`) and passes with it. @⁠rpmaster2, @⁠adrianmjim: if you can, a run of #636 against your base with the default relay would show whether the black lines and the missing near-LOD skin are gone. Not done there: `show_later`'s neutral write and the title's own mirrored descriptor writes (reasons on the PR). AI-assisted (Claude Code); no game data.
This discussion has been locked. Commenting is limited to contributors.
No description provided.