Skip to content

Shader cases on an RTX 5070: 21 of 284 differ from WARP, two of them a mesh hang #9

Backlog

Description

@marquezinii

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.

Cases What happens on the 5070 State
ms_ngg_strips, the narrower-waves mesh test (ms_ngg_windows) the group hangs: DXGI_ERROR_DEVICE_HUNG root cause below, fixed in the PR
msfb_ngg_strips_rootdesc the fallback with root descriptors draws nothing. The DrawIndexed arguments and the vertex counter come out right; the table variant (msfb_ngg_strips) draws correctly on the same GPU open
fma_mac, round_ldexp results 1 ulp off, e.g. 0xa8800000 where 0 is expected, and 0x3f800000 for 0x3f7fffff. This looks like the driver contracting a separate mul + add into an FMA open
sin_large_arg about 4e-5 error against the 1e-5 tolerance open
whole_wave_reductions, dpp_row_shr, helper_exec_wqm, helper_exec_initial lane mismatches on 32-lane pixel waves open: expectations that assume 4-lane waves, or real wave32 bugs
readfirstlane_exec, mask_as_int_partial_exec the harness throws: "expected values assume WARP's 4-lane waves, this device runs 32" harness only

Each 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_strips on the 5070:

  • dxc's default output hangs. The same HLSL compiled with -Od, or with the DXIL backend, draws the reference image.
  • What makes it hang is the barrier at the end of the phase-2 loop. In these programs phase 2 never yields, so that barrier never runs, but with it present dxc's optimized DXIL hangs the group. Without it, the program draws the reference image.
  • These changes did not help: a wave-uniform phase-1 exit (WaveActiveAnyTrue, WaveReadLaneFirst on g_ms_alloc), and dropping phase 2's dead entry region while keeping the barrier.
  • Swapping WaveIsFirstLane() for WaveGetLaneIndex() == 0 in 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.

Activity

  1. ThatRecompDev commented on Nov 24, 2026

    @ThatRecompDev
    Owner

    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_shr and 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 plus precise on 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.

  2. marquezinii commented on Nov 24, 2026

    @marquezinii
    ContributorAuthor

    I'll take the FMA/rounding pair (fma_mac, round_ldexp), starting from your -Gis / precise lead, and check each on the 5070.

  3. marquezinii commented on Nov 25, 2026

    @marquezinii
    ContributorAuthor

    A new NVIDIA finding from real boots on the RTX 5070 (12 GB), driver cache warm, main at 9e8772a plus #14. The story load hits a GPU hang (TDR: nvlddmkm event 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:

    Boot Queue Stopped at Pipeline
    D2 (~120 s) compute #2 operation 229 of 436, Dispatch(1, 1, 1) sgd1_0be48fb7_t41_billboard_nobump~CS_ComputeImposterTransform
    D2 direct #1 Dispatch(92, 52, 1) Bloom~CS_BloomDownsampleKaris (stalled 0.2 s later than compute #2)
    D3 (~60 s) compute #2 operation 3 of 16, Dispatch(671, 1, 1) sgd1_0c37c883_t32_InstanceCulling~CS_Prop_BatchCull
    D3 direct #1 operation 1, an EnhancedBarrier

    DRED reports no page fault (VA 0), so these are hangs, not faults.

    Things I checked:

    • CS_ComputeImposterTransform cannot 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_BatchCull has 75 backward branches and buffer_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.
    • If it holds, a lower compute cap (victory-gta6 uses 4,096) would make these hangs go away here. A build that logs the loop guard (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.

  4. ThatRecompDev commented on Nov 25, 2026

    @ThatRecompDev
    Owner

    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

  5. ThatRecompDev commented on Nov 25, 2026

    @ThatRecompDev
    Owner

    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-breadcrumbs on 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.

  6. upipibi commented on Nov 26, 2026

    @upipibi

    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:

    • same: msfb_ngg_strips_rootdesc draws nothing (0x00badbad), and so do both UserDataBinding mesh-fallback root-descriptor cases; the table variant passes.
    • 5070 only: ms_ngg_strips and ms_ngg_windows pass (after Shaders: no unreachable phase-2 barrier in mesh programs (NVIDIA hang); hardware switch for the shader cases #10), as do fma_mac, round_ldexp, sin_large_arg, the four wave32 pixel cases and the two harness ones. 186 commits separate the two runs, so these passes may come from translation changes, not Ampere.
    • 3070 only:
      • hangs: ms_ngg_first_lane, ms_ngg_first_lane_split, and MeshRoundBound with supersteps: False (the 2^31 count does not stop at the round bound; supersteps: True passes)
      • E_OUTOFMEMORY while creating the pipeline for cs_buffer_bounds/load_store/rule_* (7), cs_root_descriptor, buffer_load_dword, s_buffer_load (both backends) and the StageProbe compute test
      • cs_typed_uint/sint_gather off by one texel (e.g. 0xa0000004 for 0xa0000007)
      • WaveEmulation wave 2 and 4 with groupLanes False, last column wrong
        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.

  7. ThatRecompDev commented on Nov 26, 2026

    @ThatRecompDev
    Owner

    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

  8. upipibi commented on Nov 26, 2026

    @upipibi

    Follow-up on the 3070 cases at ff1c25c (the files involved are unchanged at 8781848), 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.cs ~248) 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 (WaveActiveAnyTrue in 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 inner while (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 (the WaveIsFirstLane swap), 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 under lane == 0 in place of WaveIsFirstLane() ((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.

  9. guialmm commented on Nov 26, 2026

    @guialmm
    Contributor

    On the root-descriptor fallback (msfb_ngg_strips_rootdesc, and the two UserDataBindingTests "mesh fallback, root descriptors" cases), from an RTX 3060 (driver 32.0.16.1714) on main b1b6655:

    The draw arguments come out right (the test's DrawIndexed arguments + vertex counter check passes), but every pixel stays at the clear value. The cause is the capacity check in MeshComputeFallback'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, so GetDimensions on 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 that if disabled locally, both msfb_ngg_strips variants pass on the 3060.

    The loader binds the fallback through the table (FallbackTableParameter, as the contract in docs/shader-translation.md says), where GetDimensions is defined, so this only concerns the root-descriptor form the tests exercise.

    Two ways I can see, and I'm happy to send either:

    1. Keep both forms: the runtime writes the two capacities (bytes) into the unused dwords 6 and 7 of u2 when it clears it, and the compute shader reads them there instead of calling GetDimensions. Small change to the contract table.
    2. Table only: drop the root-descriptor variant from the tests (or mark it unsupported), since nothing binds the fallback that way.

    Which would you prefer?

    AI-assisted (Claude Code, Claude Opus 5.5): traced the cause and ran the checks above on my machine.

  10. guialmm commented on Nov 26, 2026

    @guialmm
    Contributor

    On the E_OUTOFMEMORY group (the cs_buffer_*, cs_root_descriptor, buffer_load_dword, s_buffer_load and StageProbe cases, 21 on an RTX 3060, driver 32.0.16.1714, main b1b6655), in case it saves you time:

    The cause is the overflow test in buf_limit and sbuf_limit in rdna_prelude.hlsli: index > 0xffffffffu / max(stride, 1u) (and d2 > 0xffffffffu / stride). I narrowed it down by creating the compute pipeline for cut-down copies of cs_buffer_bounds:

    • the first guarded BufStore (a strided view through buf_limit(s9, s10, s11, v41)) is enough to get E_OUTOFMEMORY;
    • with that lim copied but the division replaced by a constant, or done in float, the pipeline is created;
    • a shader that only computes 0xffffffffu / x and 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 * stride reaches 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.hlsli only. 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.

  11. ThatRecompDev commented on Nov 26, 2026

    @ThatRecompDev
    Owner

    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

  12. upipibi commented on Nov 26, 2026

    @upipibi

    Here are both variants, for the ms_ngg_first_lane program (MeshStageRunner.FirstLane). I dumped them at ff1c25c; the lines involved should be the same at 45071d5.

    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 with DxilBackend.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):

    -if (WaveIsFirstLane()) { g_ms_nv = s_m0 & 0xfffu; g_ms_np = (s_m0 >> 12) & 0xfffu; g_ms_alloc = 1; }
    +if (g_vw_lane == 0u) { g_ms_nv = s_m0 & 0xfffu; g_ms_np = (s_m0 >> 12) & 0xfffu; g_ms_alloc = 1; }

    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)
    using System.Reflection;
    using FiveStar.Shaders.Dxil;
    using FiveStar.Shaders.Tests.Cases;
    using FiveStar.Shaders.Tests.Reference;
    using FiveStar.Shaders.Tests.Toolchain;
    using FiveStar.Shaders.Tests.Warp;
    using FiveStar.Shaders.Translation.Core;
    using Xunit;
    
    namespace FiveStar.Shaders.Tests;
    
    public sealed class ZzFl2VariantTests : IClassFixture<WarpFixture>
    {
        private readonly WarpFixture _fixture;
        public ZzFl2VariantTests(WarpFixture fixture) { _fixture = fixture; }
    
        private IReadOnlyList<string> Draw(string name, byte[] mesh, string meshHlsl, uint last)
        {
            var (pixelSource, _) = PassThroughPixelShader.Build(meshHlsl, ["param0"], flat: true);
            var pixel = _fixture.Workbench.Compile(name + "_ps", pixelSource, "ps");
            var bindings = new Bindings { UserSgprs = [(16u << 12) | 18u, 5u, FloatBits.Of(100.0), last] };
            var result = _fixture.Runner.Mesh(new MeshJob(mesh, pixel, Framebuffer.Exact(1, 8, 8), bindings, 1));
            var reference = (Expected[]?[,])typeof(MeshStageRunner).GetMethod("Reference", BindingFlags.NonPublic | BindingFlags.Static)!.Invoke(null, null)!;
            return ImageCheck.Compare(result, 8, 8, (x, y, _) => reference[y, x]);
        }
    
        [Theory]
        [InlineData("direct_first_lane", 0u)]
        [InlineData("direct_first_lane", 1u)]
        [InlineData("v2_fl_nofirstlane", 0u)]
        [InlineData("v2_fl_nofirstlane", 1u)]
        public void Variant(string variant, uint last)
        {
            var dir = Environment.GetEnvironmentVariable("FL2_OUT")!;
            var runner = new MeshStageRunner(_fixture);
            var header = _fixture.Workbench.Header;
            string hlsl;
            byte[] mesh;
            if (variant == "direct_first_lane")
            {
                hlsl = runner.Translate(MeshStageRunner.FirstLane);
                mesh = DxilBackend.Compile(header + hlsl, "ms");
            }
            else
            {
                var full = File.ReadAllText(Path.Combine(dir, variant + ".hlsl"));
                Assert.StartsWith(header, full, StringComparison.Ordinal);
                hlsl = full[header.Length..];
                mesh = _fixture.Workbench.Compile(variant + last, hlsl, "ms");
            }
            var mismatches = Draw(variant + last, mesh, hlsl, last);
            Assert.True(mismatches.Count == 0, $"{mismatches.Count} mismatches:\n{string.Join("\n", mismatches.Take(8))}");
        }
    }

    AI-assisted (Claude Code, Claude Opus 5.5): made the variants, ran them on WARP, wrote this.

  13. ThatRecompDev commented on Nov 27, 2026

    @ThatRecompDev
    Owner

    ran both variants on the 4090 (driver 32.0.16.2124, main at 9ec6f20), each case in its own process with FIVESTAR_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 == 0u hangs, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions