Shader cases on an RTX 5070: 21 of 284 differ from WARP, two of them a mesh hang #9
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#9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@marquezinii on GitHub · 2026-11-24 19:32 UTC · original
The shader cases only ever run on WARP, so I ran them on an RTX 5070 (Blackwell, driver 621.40, wave32) against main. 21 of 284 fail there, and all of them pass on WARP. A small switch for this (
FIVESTAR_TEST_ADAPTER=hardware) is in the PR I'm opening next to this issue, together with a fix for the first item below.ms_ngg_strips, the narrower-waves mesh test (ms_ngg_windows)DXGI_ERROR_DEVICE_HUNGmsfb_ngg_strips_rootdescmsfb_ngg_strips) draws correctly on the same GPUfma_mac,round_ldexp0xa8800000where 0 is expected, and0x3f800000for0x3f7fffff. This looks like the driver contracting a separate mul + add into an FMAsin_large_argwhole_wave_reductions,dpp_row_shr,helper_exec_wqm,helper_exec_initialreadfirstlane_exec,mask_as_int_partial_execEach pixel case fails the same way with dxc and with the DXIL backend (9 cases, 18 tests).
The mesh hang. I bisected the translated HLSL of
ms_ngg_stripson the 5070:-Od, or with the DXIL backend, draws the reference image.WaveActiveAnyTrue,WaveReadLaneFirstong_ms_alloc), and dropping phase 2's dead entry region while keeping the barrier.WaveIsFirstLane()forWaveGetLaneIndex() == 0in the GS_ALLOC_REQ store also avoids the hang, while an unguarded store doesn't. So I read this as a driver issue that depends on the shape of dxc's output, not a logic error in the translation.The PR emits phase 2's barrier only when a block phase 2 can run actually yields. With that, both mesh programs pass on the 5070, and WARP is unchanged.
I can't tell whether Ada (your 4090) behaves the same, or whether real two-phase mesh programs in the corpus have this exact shape. A run of the switch on the 4090 would answer the first. I'm happy to take the FMA/rounding cases or the root-descriptor fallback next, whichever is more useful to you.
@ThatRecompDev on GitHub · 2026-11-24 19:52 UTC · original
Thanks for this, really useful. #10 is merged, so the mesh hang is gone. We'll run your hardware switch on our 4090 (Ada) and post the results here.
Splitting the rest so we don't both do the same thing: we're on the wave32 pixel cases (
whole_wave_reductions,dpp_row_shrand the helper/WQM ones), since those can affect the game directly. If you want one, the FMA/rounding pair would be great. On our side dxc's fast-math made some results differ from the reference until we compiled with-Gis, so that may be the whole story there, maybe pluspreciseon the translated mul/add. The root-descriptor fallback is welcome too, it's just lower priority for us since it only matters on GPUs without mesh shaders.@marquezinii on GitHub · 2026-11-24 20:54 UTC · original
I'll take the FMA/rounding pair (
fma_mac,round_ldexp), starting from your-Gis/preciselead, and check each on the 5070.@marquezinii on GitHub · 2026-11-25 01:19 UTC · original
A new NVIDIA finding from real boots on the RTX 5070 (12 GB), driver cache warm, main at
9e8772aplus #14. The story load hits a GPU hang (TDR:nvlddmkmevent 153, removal reason 0x887a0006) in 4 of 7 boots, between 60 s and 280 s, with either priority setting. One boot ran 400 s to the prologue.With
--d3d12-debug --d3d12-breadcrumbs, two of the hangs point at compute queues:Dispatch(1, 1, 1)sgd1_0be48fb7_t41_billboard_nobump~CS_ComputeImposterTransformDispatch(92, 52, 1)Bloom~CS_BloomDownsampleKaris(stalled 0.2 s later than compute #2)Dispatch(671, 1, 1)sgd1_0c37c883_t32_InstanceCulling~CS_Prop_BatchCullDRED reports no page fault (VA 0), so these are hangs, not faults.
Things I checked:
CS_ComputeImposterTransformcannot loop: the disassembly has only forward branches, and the translated HLSL has no loop at all. That dispatch must be stuck on memory, or behind other work on the GPU, not running away.CS_Prop_BatchCullhas 75 backward branches andbuffer_atomic_adds. With the compute cap of 65,536 iterations per invocation, a runaway in all 671×64 lanes could still do about 2.8·10^9 atomics, some of them on one address. That is long enough to pass the 2 s TDR on a 5070 while a 4090 may finish under it. This is a hypothesis; I haven't confirmed it.TRACE_GUARD) for BatchCull would confirm it either way.I can run either of those on this card; the full logs and DRED dumps are kept.
@ThatRecompDev on GitHub · 2026-11-25 08:10 UTC · original
following up on the TDRs: we tracked one hang to a mesh shader (MSNC_VS_LinearDepthSkin), where 4 groups of an indirect dispatch never finish. it doesn't look like a missing loop cap. our current suspect is the loop guard itself, where threads in one group break out of a loop at different iterations and then never meet at a later barrier. we're testing that now; if it holds it would also explain your CS_Prop_BatchCull hangs
@ThatRecompDev on GitHub · 2026-11-25 11:04 UTC · original
quick update on the hangs. it's not just LinearDepthSkin: every hang we've caught with breadcrumbs is a mesh shader on a DispatchMesh ExecuteIndirect. that's LinearDepthSkin, PropFoliageSkinDeferred, TransformSkinTransmission and, since we started mirroring the game's full descriptor tables, a terrain one (TransformTerrainNormalTint).
the loop-guard idea from my last comment didn't hold up. we went through 30 of those programs and every backward edge runs through the dispatch loop, so the caps do bound them. most of the skinned ones have no loop at all. the ones that do loop have a material-layer loop whose count comes from a constant buffer, and each pass costs two group rounds, so with real data it can plausibly run up to the TDR within the caps. we're timing that on our 4090 right now with single-dispatch repros.
on main, the full table mirror is opt-in for now (
--mirror-table-records full), so default boots behave like before.@marquezinii how's the FMA/rounding pair going? and if your 5070 hangs again,
--d3d12-breadcrumbson current main names the stopped list even when it's buried behind other submissions, so that would tell us whether yours are the same family.@upipibi on GitHub · 2026-11-26 15:26 UTC · original
Ampere data point: the switch on an RTX 3070 (8 GB, driver 616.56, Windows 11) at main
ff1c25c, synthetic cases only (no dumps).WARP: 564 tests, 550 pass, 14 skip (real-program tests), 0 fail.
RTX 3070: 517 pass, 33 fail, 14 skip. I ran it once only: three cases hung the device (DXGI_ERROR_DEVICE_HUNG, nvlddmkm 153 each), so I stopped there.
Against the 5070 table:
A filtered rerun of these 30 in a fresh process, without the hang cases, failed all 30 the same way with no driver reset, so they do not depend on the hangs.
AI-assisted (Claude Code, Claude Opus 5.5): ran the cases and wrote this.
@ThatRecompDev on GitHub · 2026-11-26 15:44 UTC · original
thanks, the 3070 run is really useful. the three hangs (ms_ngg_first_lane, its split variant, MeshRoundBound without supersteps) look like the same mesh-shader family we keep hitting, so those go on the list. the E_OUTOFMEMORY on pipeline creation for the buffer-bounds/root-descriptor cases is new to us, we'll try those on our side. the typed gather being off by one texel is worth a look too, those cases are new from #60 so we haven't seen them on other cards yet
@upipibi on GitHub · 2026-11-26 16:29 UTC · original · edited 2026-11-26 17:13 UTC
Follow-up on the 3070 cases at
ff1c25c(the files involved are unchanged at8781848), from code and WARP only; the hanging cases were not rerun on the GPU.Integer gather off by a texel (cs_typed_uint/sint_gather): a test-harness issue. The gather samples the literal S#'s static sampler at heap slot 1403 (STATIC_SAMPLER_BASE + 379), but ComputeCase binds no sampler, so the test heap has 16 slots. WARP reads that as clamp, the 3070 as wrap: every mismatch is an edge lane whose x+1 or y+1 wrapped to 0. Binding PixelMemoryCases.LiteralSampler at that slot (a Samplers list on ComputeCase) fixes it.
ms_ngg_first_lane(_split): corrected 17:00Z - I then ran both on the 3070 with that patch applied at
ff1c25c, and both still hang (DXGI_ERROR_DEVICE_HUNG within seconds, nvlddmkm 153). So the PhaseTwoYields counting below is not the cause, or not the whole cause; I withdraw it and the patch offer. What I wrote before, for the record: ~ms_ngg_first_lane(_split): the #10 hang again. PhaseTwoYields (BodyWriter.cs248) counts the exchange's yield, which comes before GS_ALLOC_REQ, as a phase-2 start. Phase 2 therefore gets the barrier loop even though it never yields, which is the shape the comment at BodyWriter.cs:40 says NVIDIA hangs on. With the exchange yields skipped unless reachable after the allocation, first_lane gets PhaseTwoEndWithoutYield like strips, and WARP is unchanged (550/0/14). I have a small patch if you want it.Narrowed 17:13Z (code + WARP only, no further 3070 runs): the hanging programs are the only two-phase mesh programs here whose round loop goes around a second time after its group barrier. first_lane's exchange yield before GS_ALLOC_REQ makes phase 1 two rounds (
WaveIsFirstLane()runs in round 2), and MeshRoundBound supersteps:False at count 3 runs phase 2 for four rounds (WaveActiveAnyTruein round 4). Every one-round two-phase program passes: strips, windows, payload, uniform_first_lane, the user-data mesh. Both first_lane tests also translate to byte-identical HLSL, so the split path is not it. Two hypotheses remain: (a) dxc merges the innerwhile (pc < PC_YIELD)into the round loop, and NVIDIA hangs when that merged loop goes around after the barrier; (b) a wave intrinsic after the barrier loops back. Your 5070 bisection fits (b) better (theWaveIsFirstLaneswap), but (a) is still open. On a card where a hang is acceptable, these would separate them: first_lane through the repo's DXIL backend (direct: true, which keeps the loops separate: (a) predicts a pass, (b) a hang), and first_lane via dxc with the alloc store underlane == 0in place ofWaveIsFirstLane()((a) predicts a hang, (b) a pass). Both variants draw the reference on WARP. I have the variant HLSL if useful.MeshRoundBound supersteps:False: not the round bound. The count-3 run hangs (MeshRoundBoundTests.cs:34), not the 2^31 one. Its phase 2 really yields, so it keeps the phase-2 barrier loop: the open, general form of #10. The superstep form of the same program passes on the 3070. One visible difference is that the two-phase inner while(pc < PC_YIELD) has no step guard and the superstep one does.
AI-assisted (Claude Code, Claude Opus 5.5): read the code, ran WARP and the non-hanging cases, wrote this.
@guialmm on GitHub · 2026-11-26 17:50 UTC · original
On the root-descriptor fallback (
msfb_ngg_strips_rootdesc, and the twoUserDataBindingTests"mesh fallback, root descriptors" cases), from an RTX 3060 (driver 32.0.16.1714) onmainb1b6655:The draw arguments come out right (the test's
DrawIndexed arguments + vertex countercheck passes), but every pixel stays at the clear value. The cause is the capacity check inMeshComputeFallback's allocation:g_msfb_vtx.GetDimensions(cap_v); g_msfb_idx.GetDimensions(cap_i);, and the group is dropped when it does not fit. Root descriptors carry no size, soGetDimensionson them is undefined. WARP happens to return a usable size; NVIDIA evidently does not, so every group is dropped: the counters still advance, nothing is stored, and the zeroed index buffer draws only degenerate triangles. With thatifdisabled locally, bothmsfb_ngg_stripsvariants pass on the 3060.The loader binds the fallback through the table (
FallbackTableParameter, as the contract indocs/shader-translation.mdsays), whereGetDimensionsis defined, so this only concerns the root-descriptor form the tests exercise.Two ways I can see, and I'm happy to send either:
u2when it clears it, and the compute shader reads them there instead of callingGetDimensions. Small change to the contract table.Which would you prefer?
AI-assisted (Claude Code, Claude Opus 5.5): traced the cause and ran the checks above on my machine.
@guialmm on GitHub · 2026-11-26 18:07 UTC · original
On the E_OUTOFMEMORY group (the
cs_buffer_*,cs_root_descriptor,buffer_load_dword,s_buffer_loadand StageProbe cases, 21 on an RTX 3060, driver 32.0.16.1714,mainb1b6655), in case it saves you time:The cause is the overflow test in
buf_limitandsbuf_limitinrdna_prelude.hlsli:index > 0xffffffffu / max(stride, 1u)(andd2 > 0xffffffffu / stride). I narrowed it down by creating the compute pipeline for cut-down copies ofcs_buffer_bounds:BufStore(a strided view throughbuf_limit(s9, s10, s11, v41)) is enough to get E_OUTOFMEMORY;limcopied but the division replaced by a constant, or done in float, the pipeline is created;0xffffffffu / xand stores it is accepted, so it is the division feeding the store's guard, not the division alone.Since the stride has 14 bits, the same test needs no division: with
index = hi * 2^18 + lo,index * stridereaches 2^32 exactly when(index >> 18) * stride + ((index & 0x3ffff) * stride >> 18) >= 0x4000, and no step passes 32 bits. I checked it against the division for every stride 0..0x3fff on the edge indices around each threshold plus random ones: no difference.With that in both functions, all 21 pass on the 3060, and WARP is unchanged (shader project 544 passed, 0 failed, without the three known hang cases). The change is in
rdna_prelude.hlslionly. If you haven't fixed it on your side yet, I can open a PR.AI-assisted (Claude Code, Claude Opus 5.5): bisected the pipeline creation and ran the checks above on my machine.
@ThatRecompDev on GitHub · 2026-11-26 22:00 UTC · original
thanks both, this is great narrowing.
@guialmm on the E_OUTOFMEMORY group: yes please open a PR with the division-free check, nice find that it's the division feeding the store guard. it changes translation output so we'll land it with the next translator batch (where #61 and #62 are going too).
on the root-descriptor fallback: option 2 please. nothing binds the fallback that way, the loader always goes through the table, so dropping or marking the root-descriptor variants unsupported keeps the contract simpler than carrying the capacities in u2.
@upipibi the one-round vs two-round split is a really useful cut. we can run both of your variants on our 4090 where a hang is fine, so if you can drop the variant HLSL here (or a branch) we'll run first_lane through our DXIL backend with direct: true and the lane == 0 version via dxc and report which one hangs
@upipibi on GitHub · 2026-11-26 23:03 UTC · original
Here are both variants, for the
ms_ngg_first_laneprogram (MeshStageRunner.FirstLane). I dumped them atff1c25c; the lines involved should be the same at45071d5.1.
direct: true(DXIL backend, nested loops; (a) predicts a pass, (b) a hang): this needs no edited HLSL. Translate the program as the test does and compile it withDxilBackend.Compile(header + hlsl, "ms")instead of dxc.2. dxc, the alloc store under
lane == 0((a) predicts a hang, (b) a pass): take the translated first_lane HLSL and change both GS_ALLOC_REQ stores (two identical lines, one per phase-1 copy):Nothing else differs. That leaves no wave op running after the barrier back-edge in phase 1. dxc still fuses the inner
while (pc < PC_YIELD)into the round loop, so the two hypotheses still predict different results.Both variants draw the MeshStageRunner reference on WARP with s11 = 0 and 1. I have not run them on NVIDIA: our 3070 hangs on the base case, so I'm leaving the hang runs to you. This is the local WARP test I used. It reads variant 2 from
$FL2_OUT/v2_fl_nofirstlane.hlsl, which is the header plus the edited HLSL:ZzFl2VariantTests.cs (local only, uses MeshStageRunner's private Reference)
AI-assisted (Claude Code, Claude Opus 5.5): made the variants, ran them on WARP, wrote this.
@ThatRecompDev on GitHub · 2026-11-27 08:04 UTC · original
ran both variants on the 4090 (driver 32.0.16.2124, main at
9ec6f201), each case in its own process withFIVESTAR_TEST_ADAPTER=hardware.direct: true (our DXIL backend) passes, s11 = 0 and 1, draws the reference. the dxc one with the alloc store under
g_vw_lane == 0uhangs, both s11 values, DXGI_ERROR_DEVICE_HUNG after ~5 s with an nvlddmkm 153 each time. the unmodified base case hangs the same way here too, so the 4090 isn't immune like we assumed. reran everything after a minute with direct and dxc interleaved and got the same result, direct passes right before and after each hang.so that's your (a): it hangs without any WaveIsFirstLane after the barrier, and the same program with the loops kept separate is fine. (b) is out as the cause for this one at least. what it doesn't prove yet is that the fused loop specifically is the trigger, since our backend differs from dxc in more than the loop shape, and I didn't check the compiled DXIL of variant 2 for other wave ops. next step on our side is probably a dxc build where the inner while can't be merged into the round loop, and the same pair on MeshRoundBound supersteps: False to see if it's the same thing.
all four still pass on WARP, same as you saw. thanks for the variants, this was a clean cut.
@upipibi on GitHub · 2026-11-28 05:54 UTC · original
Your (a) holds on the 3070, in a narrower form, and a 2-line translator change removes the hang. I ran your two next steps on main
e9e026cb, RTX 3070, driver 616.56 (32.0.16.1656), dxc 1.8.2502.11 with the runner's arguments, one case per process withFIVESTAR_TEST_ADAPTER=hardware. Every hang was nvlddmkm 153, and the driver recovered each time.What dxc builds. It never keeps a separate inner loop. Each phase becomes one loop whose header (
pc < PC_YIELD) gets two back-edges every round: one from every switch arm (the dispatch) and one from the barrier tail. Both go through one latch block with 8 predecessors (first_lane phase 1: header%18, latch%43). Your direct backend keeps the dispatch as a nested loop, with its own header, and the round loop's latch has one predecessor.direct: truecontinueto the shared headerif (pc < PC_YIELD) {around the unchangedwhiledo { switch } while (pc < PC_YIELD);supersteps: false, count 3, dxcdirect/ separate /ifguard / do-whileThe calls to wave operations and barriers are the same in every dxc variant, hanging or passing, so only the loop shape separates them. The control row shows the extra compare isn't what helps: taking the dispatch back-edge off the shared header is. As you saw, neither the alloc store nor
WaveIsFirstLaneafter the barrier is needed. Why NVIDIA hangs on this shape isn't measured; that would need the driver's code in Nsight. WARP passes every variant.The fix I tested.
StructuredBodyWriter.Phaseemitsif (pc < PC_YIELD) {before the phase'swhileand one more}after it. Every case ends at a yield or the end (the class comment says so), so the guard changes nothing in what the program does. The patched translator's HLSL and DXIL are byte-identical to theifvariant above.Repo tests with and without it (same card, each line its own
dotnet testprocess,-c Release):maine9e026cb:Counts_read_from_the_first_lane_are_exchanged_so_the_program_runs_on_narrower_waves(both rows): 0 passed, 2 failed, device removed (0x887A0006), nvlddmkm 153.A_barrier_loop_draws_with_few_iterations_and_ends_at_the_round_bound_with_many: 1 passed, 1 failed.supersteps: falseremoved the device;truepassed.FiveStar.Shaders.Tests: 603 passed, 0 failed, 14 skipped, both with the patch and onmain.The one thing I couldn't rebuild: the class comment mentions WARP's shader compiler crashing on the phase loop without the
while. The patch keeps thewhile, and the WARP suite is unchanged. It's untested on Ada or Blackwell, so a run on your 4090 would settle whether the same change fixes it there. I can open it as a PR if you'd like it that way, or you can take it into the next translator batch.AI use: Claude Code (Claude Opus 5.5) built the variants, ran them, and wrote this.
@ThatRecompDev on GitHub · 2026-11-28 09:49 UTC · original
ran your patch on the 4090 (driver 32.0.16.2124), one process per test. on main the first-lane test goes 0/2 with device removed and nvlddmkm 153, and the barrier loop is 1/2 with supersteps false hanging, so Ada hangs the same way your 3070 does. with the patch both are 2/2, three runs in a row, and the full WARP suite is 606 passed, 0 failed.
it does change the translation of all 8765 mesh programs in the corpus (just the extra if and brace), so testers will retranslate, but that's fine for a hang fix. please open it as a PR, and maybe drop a line in the class comment about why the guard is there. thanks, really nice bisect.