Skip to content

kyty: GPU hang (TDR) in compute shader 0x05dc60d7ff9e4fce during PPSA38500 scene load #314

Backlog

Description

@Ryongen
  • [kyty] the GPU has not reached tick N in 10 s ... compute shaders of the unfinished tick N, last first: 0x05dc60d7ff9e4fce, then Not implemented (result != vk::Result::eSuccess) masterSemaphore.cpp:111. Windows: nvlddmkm 153 + Display 4101 (TDR).
  • Same shader last in the unfinished tick in 4 of ~45 runs (runs 6, 15 on older trees, 40, 42 on Brainrot dbb4a66), at the first 3D scene load, KYTY_RT_EMULATION=0 and default alike.
  • KYTY_SKIP_SHADERS=0x05dc60d7ff9e4fce: no hang in the following runs.
  • Not checked yet: whether it is a BVH walk (kyty_rt_probe), loop bound, or a bad buffer address.
  • RTX 2070 SUPER 617.42, Windows 10.

Activity

  1. simnJS commented on Nov 26, 2026

    @simnJS
    Owner

    Thanks. We see the same hang on Linux as well, on the same title: it is intermittent, it happens at the first 3D scene load or a little later, and this shader is the last one in the unfinished tick every time. So far:

    • The shader has three loops: a walk over a leaf's primitive list that only ends on an entry whose second dword is negative (an out-of-bounds read returns 0, so a missing terminator never ends it), a waterfall loop over v_readfirstlane on a per-lane descriptor read from a 0x78-byte table, and a climb up the tree through buffer_atomic_sub on the parents' counters.
    • We have ruled out the translation of readfirstlane and of ds_bpermute, and the ignored CS_PARTIAL_FLUSH. Sessions with the same SPIR-V and no hang ran the BVH build and this shader dozens of times to completion. So the hang depends on the data it gets, most likely what the BVH build dispatched just before it writes, not on how it is translated.
    • In the sessions that hung, the compute loop guard never reported a loop it had to leave. The loops are nested, so a guard on each loop alone can still run longer than the 10 s watchdog.

    About KYTY_SKIP_SHADERS: with a hang in about 1 run in 10, a few clean runs do not show much yet. In one of our runs with this hash in the list, the unfinished tick still named it last, so please check that the log says the shader was refused. If you can run 20 or more sessions with the skip, the rate will tell us more.

    Useful from your side, if you have time:

    • the dispatch just before it in the unfinished tick, and whether a [HACK] compute loop left by the loop guard line appears;
    • the Windows event time of the TDR against the Kyty log, to see whether the GPU stopped inside this dispatch or the driver reset it during a later one.

    If you want to dig into the data side (which loop runs away, and on what input), say so and we will share our disassembly notes for these shaders.

  2. added
    bug
    area: ray-tracing
    hard
    needs: game
    on Nov 26, 2026
  3. adam25136 commented on Nov 26, 2026

    @adam25136

    @simnJS, the same hang here on an RTX 5080 (Windows 10 22H2), with what you asked for.

    AnyKyty 688dbf145d8, plus a local relinker change carried since 441382ef20b to convert the title on Windows (the fs-segment path in pipeline/Conversion.cpp and guest/GuestModuleBuilder.cpp also taken for TargetSystem::Windows), a local debug print and a local skip switch, both described below
    GPU GeForce RTX 5080 16 GB, driver 621.14, Vulkan 1.4.357, native ray tracing on (the default)
    Rate Without the skip: 4 GPU hangs in 10 runs of up to 5 min (3 of the 10 runs had the GetProgram-only check below, which never printed), about 79, 83, 85 and 90 s after the game started; 1 more run ended earlier, at 75 s, on a resource tracking stop

    Dispatches before the hang. Here the [kyty] the GPU has not reached tick ... line never printed: Windows reset the driver first (event 4101). A local print of the last 64 entries of MasterSemaphore's m_work ring, when waitSemaphores or vkQueueSubmit returns ErrorDeviceLost, gives the same order in both hangs it caught:

    hang 1, ErrorDeviceLost at tick 5794          hang 2, ErrorDeviceLost at tick 6462
    t5794       1 x 0x817d9d2f8e73938d (newest)   t6462       1 x 0x817d9d2f8e73938d (newest)
    t5794       9 x 0x05dc60d7ff9e4fce            t6462       2 x 0x05dc60d7ff9e4fce
    t5789-5793  1 to 3 x 0x05dc60d7ff9e4fce       t6454-6461  1 to 4 x 0x05dc60d7ff9e4fce
    t5770-5788  1 x 0xd24748ebb1d46694 per tick   t6433-6453  1 x 0xd24748ebb1d46694 per tick
    t5769      19 x 0xed687a796ba2e63f            t6432      21 x 0xed687a796ba2e63f (oldest kept)
    t5768       6 x 0xc7eaa99bab022ae0 (oldest kept)
    

    Both came from MasterSemaphore::Wait, for tick 5794 and tick 6462. After the loss the counter reads UINT64_MAX, so this shows what was submitted, not which dispatch the GPU was in when it stopped. Windows logged the reset in the same second as the end of the err log, or one second later. That end is the ErrorDeviceLost report and crash dump, so the timing can't separate this dispatch from a later one either.

    Loop guard. 688dbf145d8 has no compute loop guard, so these runs can't show one. There is no [RT] cs line in the four hang logs.

    KYTY_SKIP_SHADERS=0x05dc60d7ff9e4fce. AnyKyty has no such switch, so I added a local one. With a check only in GetProgram, it never printed in its 3 runs. A second check, right after the program is known in each compute dispatch path of renderCompute.cpp (the two Dispatch paths and DispatchIndirectThreads), returns as for a missing program. With both checks:

    • 10 runs of 3 min, no GPU hang.
    • The shader was refused in 5 of them, at least 16 to at least 256 times (the counter prints at 1, 2, 3 and then powers of two). In runs 2, 5 and 8 only one of the two checks printed. All 5 ran to the 3 min limit, and 2 more never asked for it and also reached the limit.
    • The other 3 ended at 81 to 89 s without a GPU reset, inside the window where the hangs came: on the resource tracking stop of 0x40fce521f47c54f9, a guest int 0x41 at app.exe+0x8bf562b, and invalid image view: image_format=97 view_format=139 type=1 aspect=0x1 mip=3+6 layer=0+1 usage=0x0 image_levels=1 image_layers=1.

    So 0 hangs in the 7 runs with the skip that got past 90 s, against 4 hangs in the 9 runs on the same commit without it. The skip and no-skip runs came in blocks, not alternated, so this is only a hint. If a GetProgram-only check is what your runs used, that may be why the unfinished tick still named the shader in one of them. I can run the 20+ sessions, alternated, or test a branch.

    AI-assisted: yes. Claude Code wrote the local debug print and skip switch, ran the builds and the runs, and drafted this comment; a separate review agent checked it. The numbers are from the runs on this machine.

  4. SleglJan commented on Nov 26, 2026

    @SleglJan
    Contributor

    A GPU hang in the same phase on Linux and RADV, likely the same shader. All 3 runs here that got past the first-boot screens hung.

    • Build: local 24873d2752. That is AnyKyty 90a48455d2, plus the fix(kyty): apply a metadata clear issued before its depth target exists #289 v7 commits (runtime as in f41e7d80e3), plus one local commit with CPU-only texture-cache counters.
    • Setup: PPSA38500 01.002.001. Linux, RX 9070 XT (RDNA4), RADV GFX1201, Mesa 26.2.6.
    • Runs (first-boot screens played by hand):
      1. Empty caches. While it translated shaders it ran under 1 FPS for minutes. It hung in the first cutscene, about 3 minutes after the privacy policy.
      2. Warm caches. It hung on the loading screen after the privacy policy, 14-20 s after that screen first showed.
      3. Warm caches with RADV_DEBUG=hang. It hung at the same point, 20-26 s after the privacy policy first showed.
    • Each run:
      • The kernel logged ring gfx_0.0.0 timeout and the ring reset succeeded.
      • Runs 1 and 2 ended with vkQueueSubmit failed: ErrorDeviceLost. RADV printed "This context is guilty of a hard recovery" in run 1 and "This context is innocent" in run 2. Run 3 ended with RADV's hang report.
      • Kyty's "the GPU has not reached tick" line did not print in any of them, as adam25136 saw on Windows.
      • This build has no compute loop guard, so it printed no guard line either.
    • The RADV_DEBUG=hang report (syncshaders,hang):
      • vm_fault.log is empty.
      • A direct compute dispatch (vkCmdDispatchBase, 1x1x1 groups) completed: the trace point after it was reached.
      • Then come a barrier, a push descriptor set, a barrier, a pipeline bind and vkCmdDispatchIndirect. The last trace point the CP reached sits right before that dispatch's packets. Those are three one-dword COPY_DATA from consecutive dwords, SET_BASE and DISPATCH_INDIRECT (compute). The next trace point is not reached, so that indirect dispatch never finished. The next command would have been a vkCmdCopyBuffer.
      • The bound compute pipeline, the only one in the report, has a 64x1x1 workgroup and 1 KiB of LDS. Its code uses v_readfirstlane, ds_bpermute and buffer_atomic_sub, as in your description. I haven't traced its loops. The report carries no Kyty shader ID, so 0x05dc60d7ff9e4fce is likely but not shown.

    If a run with a particular switch or log would help, say which: here it has hung each time it reached this phase.

    AI-assisted: yes (Claude Code)

  5. github-actions commented on Nov 26, 2026

    @github-actions

    The RADV trace narrows the hang to an indirect dispatch; the Windows submission log alone can't identify which dispatch stalled. Could you share the three workgroup counts (X, Y, Z) for that RADV dispatch, if the capture has them? If you have the counts for the same dispatch in a clean run, that comparison would help distinguish an unexpectedly large dispatch from a stall inside the shader.

  6. SleglJan commented on Nov 26, 2026

    @SleglJan
    Contributor

    The RADV capture has no counts, so these come from 2 new runs. Same setup as my comment above, with warm caches, a saved profile past the first-boot screens, and a script pressing Cross every 4 s. The build is AnyKyty 90a48455d2 with one local diagnostic switch.

    • The switch: before each indirect dispatch of 0x05dc60d7ff9e4fce, it records a barrier after all earlier commands on that queue, then a copy of the 12 bytes that vkCmdDispatchIndirect reads into a host-visible buffer. A CPU thread prints each copy once the GPU has written it.
    • Both runs:
      • 14 copies printed, with the same counts in the same order. X was 6, 10, 1, 12, 17, 14, 2, 2, 3, 1, 3, 18, 9, 25, and Y and Z were 1 in all 14.
      • The last line was CI: feat/webrtc-logmessage-safety-flag #14 (25, 1, 1). The kernel logged ring gfx_0.0.0 timeout 46 and 44 s after the start.
      • RADV printed "This context is innocent" in one run and "This context is guilty of a hard recovery" in the other.
    • What that shows: on that queue, all work recorded before dispatch CI: feat/webrtc-logmessage-safety-flag #14 had finished. The barrier before each of these dispatches did not stop the hang.
    • No clean run to compare: every run here that got this far with the shader enabled hung, 5 of 5 (the 3 above and these 2, on two local builds of 90a48455d2).
    • With a local switch that drops this shader's dispatches (bindings and barriers stay):

    AI-assisted: yes (Claude Code)

  7. github-actions commented on Nov 26, 2026

    @github-actions

    Thanks, this narrows it down. The (25, 1, 1) count makes an oversized dispatch unlikely, and the 17 confirmed skips are good evidence that this dispatch is involved in the early hang. The later hangs are still unclassified.

    The next useful check is which loop is active when dispatch #14 stalls. Could you try recording a loop ID and iteration count in a diagnostic buffer at a high iteration threshold, so it can catch excessive work across nested loops even if no individual loop guard fires?

  8. SleglJan commented on Nov 26, 2026

    @SleglJan
    Contributor

    Of the shader's three loops, the one that keeps running during the stall is the only one without readfirstlane or atomics. That's loop 0 below.

    These are 2 runs on the setup above, with the indirect-count switch from my last comment plus a second local switch.

    • The switch:

      • For a listed compute shader, the recompiler gives each loop an ID and adds one OpAtomicIAdd per invocation at every pass of the loop head.
      • Each loop has one counter in a 16 KiB host-visible buffer that the shader reaches by its device address. A counter sums over all invocations and all dispatches since the start.
      • A CPU thread prints every 100 ms the counters that changed.
      • The buffer is in an L2-bypassing memory type, from VK_AMD_device_coherent_memory, which RADV exposes on GFX12 with the driconf option radv_device_coherent_memory=true.
      • With an ordinary cached buffer, the counters of 4 earlier runs appeared in one poll near the hang and never moved (loop 1's not at all in 3 of them), so I don't use those.
    • The loops of 0x05dc60d7ff9e4fce, as Kyty's recompiler sees them: 3 structured loops with disjoint block ranges, so none is nested in another in its IR.

      • loop 0: 7 blocks, no readfirstlane, no atomics.
      • loop 1: 10 blocks, one readfirstlane.
      • loop 2: 26 blocks, one atomic subtract among 7 atomics.

      You wrote that the loops are nested, so this differs from your notes. A loop reached through a call might not show as nested here. By the opcodes they match the three loops you described: the leaf walk, the waterfall loop and the climb. That matching is mine.

    • Both runs:

      • 14 copies printed, with the same counts as before.
      • After the copy of CI: feat/webrtc-logmessage-safety-flag #14 (25, 1, 1), loop 0's counter rose in every poll until the device was lost: 20 polls in each run. After the first of them, it rose by 1.2 to 2.6 million passes per poll, 40 to 44 million in the last 2 s.
      • The counters of loops 1 and 2 did not move after their first print, at 9,536 and 24,320 in both runs.
    • Limits: the counting adds a device-scope atomic to host memory per loop pass, which changes timing. The dispatch counts still matched the earlier runs. I didn't record which invocations loop or what they read.

    AI-assisted: yes (Claude Code)

  9. github-actions commented on Nov 26, 2026

    @github-actions

    The sustained growth in loop 0’s counter while the other two stayed flat makes it the best lead. The counters are aggregate and the atomics change timing, so they don’t yet tell us why that loop keeps running. The disjoint IR ranges also mean we shouldn’t assume nesting explains the earlier guard result.

    Could you replace the per-pass atomic with a one-shot record when an invocation crosses a high iteration threshold in loop 0? For the first invocation that trips it, the useful details are the workgroup and lane, the current entry index relative to the bound buffer range, and whether the second dword is zero. That would help distinguish a walk past the buffer from one that stays in bounds but never sees a terminator.

  10. SleglJan commented on Nov 27, 2026

    @SleglJan
    Contributor

    The record you asked for, plus a per-lane view of the workgroup it came from. These are 4 runs on the setup above, each with the same 14 dispatch counts as before. 2 more runs took another path and are not used.

    • The switch:
      • The per-pass atomics are replaced by a pass counter per invocation for each loop.
      • The first invocation whose count for loop 0 reaches 4,096 claims a record: its workgroup and lane, the loop head's phis, and, for each buffer load in the loop body, the byte offset, the bound Kyty uses for that buffer, the active flag and the dwords loaded in that pass.
      • In the per-lane builds, every lane of that workgroup also writes its own slot at its 4,096th pass: each load's active flag, byte offset and data, and, in the last build, its bound and buffer.
    • The record (1 run):
      • It came from workgroup 24, the highest of CI: feat/webrtc-logmessage-safety-flag #14's 25 workgroup IDs, lane 0.
      • That lane was inactive at that pass: all 4 loads in the loop had their active flag clear, so their results are 0 by construction. The entry offset was in bounds.
    • The lanes of workgroup 24 (3 runs, identical; the per-lane bound and buffer were recorded in 2 of them):
      • 4 of the 64 lanes (48, 49, 52, 53) had the loop's loads active. The other 60 had them clear.
      • All 64 lanes use the same buffer for the entry load. Its bound, from the buffer's V#, is 86,248 bytes: 10,781 entries of 8 bytes.
      • The 4 active lanes read entries 14,871, 14,872, 14,874 and 14,876, past that bound, and got (0, 0), so the second dword is zero. The 60 inactive lanes' entry offsets are within the bound.
    • What that shows: in workgroup 24 at its 4,096th pass, the 4 lanes with loop 0's loads active read past the end of the bound buffer range and got zeros. Your description says the walk ends only on an entry whose second dword is negative.
    • Limits:
      • The counters and record calls change timing, though the dispatch counts still matched.
      • Only the first workgroup to reach the threshold is recorded.
      • The bound is the one Kyty computes from the V#.

    AI-assisted: yes (Claude Code)

  11. github-actions commented on Nov 27, 2026

    @github-actions

    The per-lane capture explains why the first record looked in bounds: it came from an inactive lane. The four active lanes were already past Kyty’s computed bound, where the zero reads cannot satisfy the negative-dword exit condition. That explains how the walk can keep running, but not why it reached those offsets.

    Could you capture the starting entry index for lane 48 in workgroup 24 on dispatch #14, before the walk advances it? That would tell us whether the walk starts outside the computed range or starts in bounds and reaches the end without seeing a terminator.

  12. SleglJan commented on Nov 27, 2026

    @SleglJan
    Contributor

    Lane 48 starts in bounds, within the last 5 entries the bound allows, and by pass 4,096 has advanced past the end. That's from one run with the same 14 dispatch counts as before. One more run had other counts and is not used.

    • The switch: as in my last comment, plus each lane saving, at the first pass of its entry into loop 0, the head phis, the entry load's byte offset and the load active flags. It also saves the number of entries into the loop and the last earlier pass in which a load was active.

    • Workgroup 24, at the 4,096th pass (entry indices are 0-based):

      lane start entry start in bounds loads active at passes entries into the loop
      48 10,776 yes 1, 4,095 and 4,096 1
      49 10,777 yes 1, 4,095 and 4,096 1
      52 10,779 yes 1, 4,095 and 4,096 1
      53 10,781 no: it is the first entry past the bound (10,781 entries) 1, 4,095 and 4,096 1
      • Each of the four advanced 4,095 entries in 4,095 passes: lane 48 is at 14,871 at pass 4,096. Only the start and the 4,096th pass were recorded, not each step.
      • For comparison, lane 0 started at entry 10,738. Its loads were active at its first pass and last at pass 20, and it was inactive at pass 4,096.
    • So: three of the four lanes start within the last 5 entries of the bound range and are past it by pass 4,096; the fourth starts at the first entry past the bound. By your description, the walk exits only on an entry whose second dword is negative. These lanes were still active at passes 4,095 and 4,096, so none of them had exited yet. This assumes a lane that exits stays inactive; lane 0, inactive from pass 21 through 4,096, is consistent with that.

    • Limits:

      • The bound is the one Kyty computes from the V#.
      • The loaded values were recorded only for pass 4,096, not for the start.
      • The counting changes timing, though the dispatch counts matched.

    AI-assisted: yes (Claude Code)

  13. github-actions commented on Nov 27, 2026

    @github-actions

    Thanks, that shows both failure paths in the same workgroup: three lanes start inside Kyty’s computed range and walk past it, while lane 53 starts exactly at the first out-of-range entry.

    Could you check whether the final five entries contain a negative second dword immediately before dispatch #14? If a terminator is present on lane 48’s path, the next question is what that lane actually reads on those first five passes. If none is present, the next place to look is whether the preceding BVH build wrote the list beyond the range described by the V#.

  14. SleglJan commented on Nov 27, 2026

    @SleglJan
    Contributor

    No: as #14 read them, none of the last five entries has a negative second dword, and the memory right after the range reads as zeros. This is from one run with the same 14 dispatch counts as before; one more run had other counts and recorded the same trace.

    • The switch: as before, plus a trace for the lanes of workgroup 24. For the first 8 passes of their entry into loop 0, each lane records the entry load's byte offset, the two dwords loaded, Kyty's in-bounds check for that load (emitted a second time for the probe), and an unclamped read of the same two dwords through Kyty's device-address load (ignoring the bound). It also records that load's V# fields.
    • The entry load's V#: OOB mode 0 (structured), stride 8, 10,781 records. In that mode Kyty's check is index < records, which is the same 86,248-byte bound as in my earlier comments.
    • Lane 48:
      • Passes 1 to 5 read entries 10,776 to 10,780, all in bounds. None has a negative second dword.
      • Passes 6 to 8 read entries 10,781 to 10,783. Kyty's in-bounds is false and the load returns (0, 0); the unclamped read of the same addresses also returns (0, 0).
    • Lanes 49, 52 and 53 read the same entries from their own starting points. Every unclamped read past the bound, up to entry 10,788, is (0, 0).
    • So: the range's last five entries carry no terminator. The 8 entries after its end hold zeros, so there is no terminator among them. Those addresses are in the same 4 KiB page as the last in-bounds entries.
    • Limits:
      • The unclamped read goes through Kyty's device-address load, so it shows the guest memory as Kyty's GPU-side copy holds it at that pass. That load also reads a page missing from Kyty's page table as 0. Here the page is held: Kyty's table pages are 16 KiB, and the in-bounds entries in the same page read non-zero data through the same load.
      • Only 8 entries past the end were read.
      • The counting changes timing, though the dispatch counts matched.

    AI-assisted: yes (Claude Code)

  15. github-actions commented on Nov 27, 2026

    @github-actions

    That rules out the bounds check masking a terminator in the eight entries you probed. The walk reaches the end without seeing a terminator, but the trace doesn’t yet distinguish a bad start index from a missing producer write.

    Could you trace where workgroup 24’s lane 48 gets its starting index (10,776)? The next useful detail is the instruction that supplies it and, if it comes from a buffer load, the buffer and byte offset. That gives us a specific producer output to check without dumping the full BVH.

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

    area: ray-tracingbughardneeds: game

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions