Scalar loads: views through NonUniformResourceIndex again, each dword through the map #58
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ThatRecompDev--five-star-recomp!58
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/58/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Sr-0w on GitHub · 2026-11-26 11:38 UTC · original
Sr-0w:shaders/scalar-views-nonuniform→main· +99 −13 · 3 files · 1 commits · merged 2026-11-26 12:20 UTCWhat
SBufLoadandSPtrLoadindex their views throughNonUniformResourceIndexagain, andSPtrLoadAtreads asSPtrLoad, one map walk per dword.sptr_viewsis still emitted and left to dead-code elimination. The change is in the prelude only.Why
On an RX 7800 XT, since the uniform scalar-load views (
53862e66), every boot of a retail game ended in a device hang (0x887a0006). The DRED page fault was at an address no allocation held, existing or recently freed (0x7206000 to 0x73bc000), 1,200 to 2,000 presents in. That happened on eleven boots across main.How the cause was narrowed down (each a full boot with
--d3d12-dred):53862e66,11bc783a,be40d97853862e66onlyb5d8d02a, uniform viewsSPtrLoadAt's select keptCreatePipelineState8 presents in (PS_DeferredTextured_*, found by journaling each pipeline compile)SPtrLoadAtasSPtrLoad(this PR)One mechanism is explained. With wave emulation, a hardware wave wider than the program wave holds several program waves. Their SGPRs differ, because
readfirstlanereads each program wave's own first lane. The AMD driver then reads every lane's view at the first lane's index.ScalarViewWaveTestsreproduces this.Another is not. Wave64 programs needed the non-uniform form too: with it applied to everything except them, the hang came back. I could not explain that from their translation; their SGPRs come from user data, scalar loads and uniform arithmetic. So this PR restores the earlier form rather than claiming a narrower fix.
Cost: this gives back the scalar-load part of 53862e66's gain for the G-buffer pixel programs. In return, a boot runs through.
In game (retail game, RX 7800 XT)
b5d8d02a, before the exposure fixes. A boot on905deb80with this change hung with a different fault, with recently freed allocations and over the GPU memory budget. I am looking into it separately.Tests
ScalarViewWaveTests: program waves pick their view fromreadfirstlaneof the thread index, 1 to 4 program waves per hardware wave.FIVESTAR_TEST_ADAPTER=hardwareon the RX 7800 XT, it fails with the uniform form (two 16-lane program waves on a 32-lane wave read the first one's view) and passes with this change.docs/shader-translation.mdis updated.🤖 Generated with Claude Code
@ThatRecompDev on GitHub · 2026-11-26 12:20 UTC · original
great bisect, thanks. the program-wave-inside-a-hardware-wave case makes total sense once you see it, and the hardware test pins it down
merged it with translator batch 4 so testers only rebuild once. giving back part of 53862e66's gain is fine, a hang on AMD is worse than a few ms
the wave64 case you couldn't explain is interesting, if you find it later a narrower fix is welcome