Fix two crashes on AMD: stray stores of the batch culling programs, and sampler records made in a heap of views #24

Manually merged
github merged 1 commit from github-bot/gh-24 into main 2026-12-04 01:57:16 +00:00 AGit
Owner

@⁠staticman256 on GitHub · 2026-12-03 06:57 UTC · original
staticman256:crash-fixes → main · +263 −2 · 4 files · 1 commits · merged 2026-12-04 01:53 UTC

Fix two crashes on AMD: stray stores of the batch culling programs, and sampler records made in a heap of views

Two independent fixes for the two crashes that ended most play sessions on the test machine. Together they were 24 of the 36 crashed runs in its crashes.log. Both are small, and the first has an off switch.

Crash Where it faults Crashed runs (of 36) Fix
1 The title crashes in its own code title+0x4e9b54a, +0x4e9b4b2, +0x4e9b578, +0x1884fb 16 A floor under the stores of the four batch culling programs
2 The AMD driver crashes amdxc64.dll+0x361d946 8 A sampler's record is never made in a heap of views
Device removed (0x887A0001) 11 Not touched by this pull request
One other fault in title code (+0x1377f6) 1 Not touched

Test machine

  • Radeon RX 9070 XT, 16 GB
  • Ryzen 9 9850X3D
  • 64 GB of RAM
  • diag build, scripts\play.ps1 with its defaults plus -Fsr4K performance -FsrVersion 4 -FrameGen, frame rate uncapped, no ray tracing

The statistics are from one crashes.log: 2026-11-29 21:21 to 2026-12-02 13:43 UTC, about 64 hours of wall-clock time on commit 9a70c8c (later with diagnostic patches on top), 36 crashed victory.exe processes. All diagnosis was done on 9a70c8c. The fixes were then carried to 5ccd6e4.

Crash 1: the title crashes in its own code

What was seen

An access violation inside the title, almost always at title+0x4e9b54a (10 runs), also +0x4e9b4b2 (3), +0x4e9b578 (1) and +0x1884fb (2). The comment on copy_back in shadow.rs already names the first address. It came 16 times in two and a half days, at no particular place in the game.

The faulting read is always through a pointer that looks almost right. In one dump, a pointer that should have been 0x0000000d0418ee68 had 0x00000ca7 in its upper half, and the values 0x0c9a, 0x0ca7 and 0x14b4 sat at a 20-byte stride across the memory around it.

What happens

The 20-byte stride is the signature of the title's four batch culling compute programs:

Hash Program
17af15c4015cb4b6 CS_Prop_BatchCull
55679a0547649d0b CS_Tree_BatchCull
89d08e561897d4e5 CS_Tree_BatchCull_ImposterOnly
fdd56d97a806bcca CS_Prop_BatchNoCull

Each dispatch gets one raw unordered-access view of the title's whole 174 MB heap, loaded from byte 5920 of its bindless table. It writes all its output through that view at byte addresses it computes from job records. The instance counts are InterlockedAdd(uav[X + 4 + i * 20], 1), where X comes from dword 9 of the job record.

Every few minutes a burst of those adds lands at the very start of the heap instead of where the record says. The start of that heap holds the host's descriptor slot records (VIEW_TAG) and the title's frame allocator, including its list nodes. A count added into a list node's pointer is the pointer the title then follows and faults on.

What was measured

An instrumented build checked every culling dispatch at submission for 37 minutes:

  • 759,282 dispatches and 78 million job records were checked.
  • 0 records differed from the host's CPU-side copies.
  • 0 records were changed by the title between recording and submission.
  • 0 records had a small X. The sane values lay 90 to 115 MB into the heap.
  • In the same run, 6 bursts still landed in the first 80 KiB of the heap. Each added the same amount to every 20-byte slot it touched (for example +0xec7, +0x140).

A second run of 13 minutes with VICTORY_SEND_STAGE and VICTORY_JOIN_SEND off saw 5 more bursts. Every stray store seen lay within the first 262 KiB.

So the job records are right in title memory and right in the host's copies, and the stray addresses arise somewhere between there and the program running on the card. That root cause was not found. The crash happened with port 1 on and with it off, so port 1 is not the cause. It only decides how the stray bytes arrive: with port 1 on, the card writes title memory in place, so nothing on the CPU side can see or filter them.

The fix

The four programs are translated with a floor under their stores. A raw store or atomic through the view from table byte 5920 is skipped, per lane, when its byte address is below the floor. Everything else the programs do is unchanged.

  • VICTORY_CULL_FLOOR_MB: the floor in MiB. Default 16, 0 turns the guard off.
  • The four programs are translated uncached at each start, so the shader cache needs no new Translate. Their host pipelines are named by their code, so they are compiled once.
  • The log says what was done: one VICTORY_CULL_FLOOR_MB line per program with the number of guarded stores, or a warning if no store was found.

Its limits

  • It is a guard, not a cure. The stray addresses still arise, they are just not written.
  • The floor is a heuristic: real output was seen 90 MB and more into the heap, strays within the first 262 KiB. A stray above 16 MiB is not caught.
  • Two other programs write through the same whole-heap view (9209777e8face9dd, 1c4b3c0547e3e6fa) and are not guarded. Every stray seen had the culling programs' 20-byte stride.

Crash 2: the AMD driver crashes

What was seen

An access violation inside the driver at amdxc64.dll+0x361d946, a read of 0xffffffffffffffff, called from CopyDescriptorsSimple on a victory-views thread. Several threads usually fault within seconds of each other, so the 8 crashed runs left 17 entries in the log.

What happens

The title's heap of views lies in its frame allocator's memory, and a slot of it can hold the record of a sampler (View::Sampler or View::ConsoleSampler). Whether that is left over from an earlier use of the memory or put there by the title is not known. Nothing tells a record's kind from its heap's kind, and make_twinned calls CreateSampler at whatever slot it is given.

D3D12 allows CreateSampler only at a slot of a sampler heap. In a crash dump, the CPU handle of a heap the card does not see pointed at a 32-byte driver entry that begins with the address of the descriptor's bytes. One entry held 0180000008000800 8000000028f00000 between sound neighbours, which reads as sampler state, not as an address. The next CopyDescriptorsSimple followed its first 8 bytes as a pointer and faulted. This is read from the dump, not from the driver's source.

The fix

A sampler's record is not made in a heap of views. The slot gets a null view, the same as for a view the host cannot make. A sampler is never read through a slot of a heap of views, so nothing drawn changes. The check sits at the four places that make a view slot from a record (texture_views_remade, make_at, make_listed, mirror_inner_locked), and a warning is logged when it acts: a sampler's record in a heap of views: a null view there instead.

What changes

Four files, 264 lines added, 2 removed, most of it comments.

  • crates/victory-shader/src/emit/mod.rs: with_store_floor, a scoped setting for one translation.
  • crates/victory-shader/src/emit/lower.rs: the floor in the buffer access lowering.
  • crates/victory-gpu/src/shader_cache.rs: the four programs and VICTORY_CULL_FLOOR_MB in host_shader.
  • crates/victory-gpu/src/descriptor/host.rs: sampler_in_views and its four checks.

Testing

On 9a70c8c, where both fixes were developed:

  • Crash 2: the last driver crash is from 03:30 UTC on 2 December, just before the fix went in. The log's remaining hours hold five other crashes and none of this kind. Before the fix there were 8 in 54 hours.
  • Crash 1: the last title crash is from 08:54 UTC on 2 December. With the guard and port 1 on, the longest session yet with this fork followed, without a crash in title code. Before the guard there were 16 crashed runs in two and a half days.

On 5ccd6e4 (translator version 15):

  • Built as diag and run. The log has the four guard lines with 10, 70, 70 and 80 guarded stores, the same counts as on 9a70c8c, so the guard still finds its stores with the new translator.
  • A short session ended normally with no errors.

Not in this pull request

  • The root cause of the stray culling addresses. The measurements above may help whoever looks for it.
  • The device-removed crashes (0x887A0001).
  • Trees and props vanishing for single frames.

Diagnosis, fixes and this description were built with Claude Fable 5.2 (Extra effort).

**@⁠staticman256** on GitHub · 2026-12-03 06:57 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/24) `staticman256:crash-fixes` → `main` · +263 −2 · 4 files · 1 commits · merged 2026-12-04 01:53 UTC # Fix two crashes on AMD: stray stores of the batch culling programs, and sampler records made in a heap of views Two independent fixes for the two crashes that ended most play sessions on the test machine. Together they were 24 of the 36 crashed runs in its `crashes.log`. Both are small, and the first has an off switch. | | Crash | Where it faults | Crashed runs (of 36) | Fix | |---|---|---|---|---| | 1 | The title crashes in its own code | `title+0x4e9b54a`, `+0x4e9b4b2`, `+0x4e9b578`, `+0x1884fb` | 16 | A floor under the stores of the four batch culling programs | | 2 | The AMD driver crashes | `amdxc64.dll+0x361d946` | 8 | A sampler's record is never made in a heap of views | | | Device removed (`0x887A0001`) | | 11 | Not touched by this pull request | | | One other fault in title code (`+0x1377f6`) | | 1 | Not touched | ## Test machine - Radeon RX 9070 XT, 16 GB - Ryzen 9 9850X3D - 64 GB of RAM - `diag` build, `scripts\play.ps1` with its defaults plus `-Fsr4K performance -FsrVersion 4 -FrameGen`, frame rate uncapped, no ray tracing The statistics are from one `crashes.log`: 2026-11-29 21:21 to 2026-12-02 13:43 UTC, about 64 hours of wall-clock time on commit 9a70c8c (later with diagnostic patches on top), 36 crashed `victory.exe` processes. All diagnosis was done on 9a70c8c. The fixes were then carried to 5ccd6e4. ## Crash 1: the title crashes in its own code ### What was seen An access violation inside the title, almost always at `title+0x4e9b54a` (10 runs), also `+0x4e9b4b2` (3), `+0x4e9b578` (1) and `+0x1884fb` (2). The comment on `copy_back` in `shadow.rs` already names the first address. It came 16 times in two and a half days, at no particular place in the game. The faulting read is always through a pointer that looks almost right. In one dump, a pointer that should have been `0x0000000d0418ee68` had `0x00000ca7` in its upper half, and the values `0x0c9a`, `0x0ca7` and `0x14b4` sat at a 20-byte stride across the memory around it. ### What happens The 20-byte stride is the signature of the title's four batch culling compute programs: | Hash | Program | |---|---| | `17af15c4015cb4b6` | `CS_Prop_BatchCull` | | `55679a0547649d0b` | `CS_Tree_BatchCull` | | `89d08e561897d4e5` | `CS_Tree_BatchCull_ImposterOnly` | | `fdd56d97a806bcca` | `CS_Prop_BatchNoCull` | Each dispatch gets one raw unordered-access view of the title's whole 174 MB heap, loaded from byte 5920 of its bindless table. It writes all its output through that view at byte addresses it computes from job records. The instance counts are `InterlockedAdd(uav[X + 4 + i * 20], 1)`, where `X` comes from dword 9 of the job record. Every few minutes a burst of those adds lands at the very start of the heap instead of where the record says. The start of that heap holds the host's descriptor slot records (`VIEW_TAG`) and the title's frame allocator, including its list nodes. A count added into a list node's pointer is the pointer the title then follows and faults on. ### What was measured An instrumented build checked every culling dispatch at submission for 37 minutes: - 759,282 dispatches and 78 million job records were checked. - 0 records differed from the host's CPU-side copies. - 0 records were changed by the title between recording and submission. - 0 records had a small `X`. The sane values lay 90 to 115 MB into the heap. - In the same run, 6 bursts still landed in the first 80 KiB of the heap. Each added the same amount to every 20-byte slot it touched (for example `+0xec7`, `+0x140`). A second run of 13 minutes with `VICTORY_SEND_STAGE` and `VICTORY_JOIN_SEND` off saw 5 more bursts. Every stray store seen lay within the first 262 KiB. So the job records are right in title memory and right in the host's copies, and the stray addresses arise somewhere between there and the program running on the card. **That root cause was not found.** The crash happened with port 1 on and with it off, so port 1 is not the cause. It only decides how the stray bytes arrive: with port 1 on, the card writes title memory in place, so nothing on the CPU side can see or filter them. ### The fix The four programs are translated with a floor under their stores. A raw store or atomic through the view from table byte 5920 is skipped, per lane, when its byte address is below the floor. Everything else the programs do is unchanged. - `VICTORY_CULL_FLOOR_MB`: the floor in MiB. Default 16, `0` turns the guard off. - The four programs are translated uncached at each start, so the shader cache needs no new Translate. Their host pipelines are named by their code, so they are compiled once. - The log says what was done: one `VICTORY_CULL_FLOOR_MB` line per program with the number of guarded stores, or a warning if no store was found. ### Its limits - It is a guard, not a cure. The stray addresses still arise, they are just not written. - The floor is a heuristic: real output was seen 90 MB and more into the heap, strays within the first 262 KiB. A stray above 16 MiB is not caught. - Two other programs write through the same whole-heap view (`9209777e8face9dd`, `1c4b3c0547e3e6fa`) and are not guarded. Every stray seen had the culling programs' 20-byte stride. ## Crash 2: the AMD driver crashes ### What was seen An access violation inside the driver at `amdxc64.dll+0x361d946`, a read of `0xffffffffffffffff`, called from `CopyDescriptorsSimple` on a `victory-views` thread. Several threads usually fault within seconds of each other, so the 8 crashed runs left 17 entries in the log. ### What happens The title's heap of views lies in its frame allocator's memory, and a slot of it can hold the record of a sampler (`View::Sampler` or `View::ConsoleSampler`). Whether that is left over from an earlier use of the memory or put there by the title is not known. Nothing tells a record's kind from its heap's kind, and `make_twinned` calls `CreateSampler` at whatever slot it is given. D3D12 allows `CreateSampler` only at a slot of a sampler heap. In a crash dump, the CPU handle of a heap the card does not see pointed at a 32-byte driver entry that begins with the address of the descriptor's bytes. One entry held `0180000008000800 8000000028f00000` between sound neighbours, which reads as sampler state, not as an address. The next `CopyDescriptorsSimple` followed its first 8 bytes as a pointer and faulted. This is read from the dump, not from the driver's source. ### The fix A sampler's record is not made in a heap of views. The slot gets a null view, the same as for a view the host cannot make. A sampler is never read through a slot of a heap of views, so nothing drawn changes. The check sits at the four places that make a view slot from a record (`texture_views_remade`, `make_at`, `make_listed`, `mirror_inner_locked`), and a warning is logged when it acts: `a sampler's record in a heap of views: a null view there instead`. ## What changes Four files, 264 lines added, 2 removed, most of it comments. - `crates/victory-shader/src/emit/mod.rs`: `with_store_floor`, a scoped setting for one translation. - `crates/victory-shader/src/emit/lower.rs`: the floor in the buffer access lowering. - `crates/victory-gpu/src/shader_cache.rs`: the four programs and `VICTORY_CULL_FLOOR_MB` in `host_shader`. - `crates/victory-gpu/src/descriptor/host.rs`: `sampler_in_views` and its four checks. ## Testing On 9a70c8c, where both fixes were developed: - Crash 2: the last driver crash is from 03:30 UTC on 2 December, just before the fix went in. The log's remaining hours hold five other crashes and none of this kind. Before the fix there were 8 in 54 hours. - Crash 1: the last title crash is from 08:54 UTC on 2 December. With the guard and port 1 on, the longest session yet with this fork followed, without a crash in title code. Before the guard there were 16 crashed runs in two and a half days. On 5ccd6e4 (translator version 15): - Built as `diag` and run. The log has the four guard lines with 10, 70, 70 and 80 guarded stores, the same counts as on 9a70c8c, so the guard still finds its stores with the new translator. - A short session ended normally with no errors. ## Not in this pull request - The root cause of the stray culling addresses. The measurements above may help whoever looks for it. - The device-removed crashes (`0x887A0001`). - Trees and props vanishing for single frames. --- Diagnosis, fixes and this description were built with Claude Fable 5.2 (Extra effort).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 07:01:53 +00:00
Author
Owner

@⁠staticman256 on GitHub · 2026-12-03 06:57 UTC · original

cc: @⁠SovietBearz0r

**@⁠staticman256** on GitHub · 2026-12-03 06:57 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/24#issuecomment-7370428200) cc: @⁠SovietBearz0r
github-bot force-pushed github-bot/gh-24 from 092a07762d to 992208b909 2026-12-03 07:54:48 +00:00 Compare
github-bot force-pushed github-bot/gh-24 from 992208b909 to fc04f04a9c 2026-12-04 00:10:24 +00:00 Compare
github-bot force-pushed github-bot/gh-24 from fc04f04a9c to c8e29fa7e2 2026-12-04 00:42:56 +00:00 Compare
github manually merged commit fa483e4352 into main 2026-12-04 01:57:16 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.