World frames hang the GPU (TDR) on an RTX 4070: compute shaders with ~1 s dispatches, wave64 refused by NVIDIA #1581
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#1581
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?
@nicogunvis-boop on GitHub · 2026-11-24 19:26 UTC · original
Setup
WaveLaneCountMax= 32)test/integration(main + #704 + #694 + #1245 + #1280 + a few more), diagnostics buildSymptom
Loading screens and the opening credits render correctly. When the 3D world starts, the device is removed with
DXGI_ERROR_DEVICE_HUNG(TDR). The frame where it happens varies from run to run (1468 to 2601), so it is not one fixed command.Finding 1: 86 compute pipelines refused on NVIDIA (wave64)
The debug layer reports, for every one of them:
CreateComputeShader: Shader wants wave lane count of 64 but maximum wave lane count for device is 32lower.rssetsWaveSize(64)when a wave64 compute program has console lanes (permute / DPP / mbcnt / readlane / masks read as data) or is a single wave using LDS. NVIDIA cannot run these at all.Experiment (commit on the fork):
VICTORY_HOST_WAVE32=1runs console-lane wave64 programs in host waves of 32. Each host wave stands for a console wave whose lanes 32..63 are inactive. Masks, ballots and mbcnt stay consistent within the host wave, and the thread id is relabelled per 32 instead of per 64. Result: refusals dropped from 86 to 36. The remaining 36 are single-wave programs with LDS and no barriers, which I left refused on purpose. Cross-half lane reads would be wrong in this mode.Finding 2: the hang is caused by slow shaders, not by an invalid command
With
VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1, there is no TDR, but these single commands take about a second:8bbcbda6008eaa3742683eebec081520b7a81f5b96f4ca93+43e24028d4a1faef776d835da5ffa646,84eafa50504bc9efVICTORY_SHADER_LOOP_LIMIT=16moves the hang from about 1500-2000 to about 2600 frames (268 s instead of about 70-128 s). So loops with huge trip counts are the cause.VICTORY_SKIP_PIPELINESwith these hashes does not help: dependent passes then read unwritten buffers and get slower.victory translate --validate --liston the dumped containers reports all 6 as validated and fully tracked (0 not traced). So the code translation looks right, and the inputs at run time look wrong.Finding 3: how
42683eebec081520gets its trip countsIt is a per-tile min reduction (disassembly excerpt):
[128, 72, ...]. These are the output tile counts.u5=0x1cc6e00is not committed title memory and has no heap slot (describe_slotreturns None). I could not tell how the host resolves this SGPR-held address. Question for maintainers: how is a V# loaded throughs[40:41] = {user-data, 0}bound on the host, and could it resolve to the wrong or an empty buffer?Also fixed on the fork (constant buffer tables,
draw.rs)View::Constant(0, 0)(the title's null CBV) was bound as a scratch view withSizeInBytes = 0, which is invalid. It is now a null CBV.sizebytes were filled. The rest of the scratch kept stale data, while the console reads zeros past the buffer size. The padding is now zeroed. This gave a visible FPS increase.Logging tweaks used (diagnostics only)
VICTORY_DUMP_SHADERS=<dir>andVICTORY_DUMP_SHADERS_ONLY=<hashes>save containers on first sight.Branch: https://github.com/nicogunvis-boop/VIctory/tree/test/integration.
@nicogunvis-boop on GitHub · 2026-11-24 19:38 UTC · original
Follow-up: the zero divisors in 42683eebec081520 most likely come from the NVIDIA raw-read bound described in #951 (a raw read through a structured SRV returns zeros past NumElements * 4 bytes), not from a wrong binding of the u5 descriptor. That would explain the ~1 s reduction loops on this card too. The fix is gangg111's 0a4b89f, backported by jamesn-xt (test/rtx4080-raw-table-views, 5640d98). I will test it on the RTX 4070 and report back.
@Impre-visible on GitHub · 2026-11-24 20:38 UTC · original
The same hang seen from Linux, where nothing declares the device hung, so it looks different: the title's own stop is the first visible symptom.
Setup: Arch Linux, kernel 6.18 LTS, GTX 1660 6 GB (Turing, 32-lane waves), NVIDIA 620.73.04 open modules, Wine from GE-Proton11-6 + vkd3d-proton (Proton Experimental), Series X mode, diagnostics build, native
d3dcompiler_47so indirect execution runs. Tree: #1433 with #1492 merged by hand, plus #1077 #1175 #523 #530 #1040 #1406 #542 #1056 #1392 #1516 #1388 #1189 #1523 (so wave64 programs run and very little work is dropped: at most 79 dropped draws or dispatches per frame, summed over the report lines).What happens at world entry (one run, GPU load sampled every 2 s, kernel log, VIctory log):
NVRM: Xid 109 ... name=title-main ... CTX SWITCH TIMEOUT; GPU load drops to 0 % and stays thereVICTORY_STACKS, during the 0 % phase the scheduler thread of #1388 (victory-gpu-wait) is inHost::executeat the unboundedWaitForSingleObjecton the submission's fence in 4 dumps in a row (18 s), and the title'spresentis waiting for thesubmittedmutex behind it.GetDeviceRemovedReasonis only looked at after that wait returns, so nothing is logged: under vkd3d-proton the killed channel never signals the fence.VICTORY_SHADER_LOOP_LIMIT=64does not change it here (stop 34 s after the first world frame started). More pipeline workers do not change it either (8 or 20).So on this card the sequence is: a GPU job that does not yield for about 8 s, the driver kills the channel, VIctory waits forever, the title's watchdog ends the run. I do not know yet which dispatch it is; I am adding a bounded first wait that names the stuck submission and will report.
A possible hardening on the VIctory side, untested: wait on the fence with a timeout and poll
GetDeviceRemovedReason(or the fence's completed value) so a dead channel is reported instead of waited on.@nicogunvis-boop on GitHub · 2026-11-24 20:41 UTC · original
Thanks, useful comparison. On the RTX 4070 (Windows), VICTORY_SHADER_LOOP_LIMIT=16 did move the hang (about 70-128 s to 268 s), and VICTORY_GPU_TIMING named the slowest single commands: 8bbcbda6008eaa37 and 42683eebec081520 (dispatch 128x64x1, 0.8-1.3 s each), then the mesh pair b7a81f5b96f4ca93 + 43e24028d4a1faef. In 42683eebec081520 the loop bounds come from integer divisors read from a buffer; zeros there give 4e9-iteration loops. That fits the NVIDIA raw-read bound from #951 (fix 0a4b89f, backport on jamesn-xt/test/rtx4080-raw-table-views). Is 0a4b89f in your tree? If not, it may be the dispatch you are looking for.
@AbdulPlayz03 on GitHub · 2026-11-24 21:51 UTC · original
Same hang on an RTX 3070. DRED and the debug layer point at mesh draws, plus resource state errors on title buffers.
Summary
The title runs for 2 to 5 minutes, loads data, presents frames and compiles shaders. Then the host GPU device is removed with
DXGI_ERROR_DEVICE_HUNG(0x887A0006) and Victory exits with code 5. DRED puts the stall on a mesh draw (op 42 or op 5) in four out of four runs. The D3D12 debug layer also reports about 130 resource state errors on title buffers before the hang.Environment
ffe310e(2026-11-24),diagprofile with--features diagnostics. The release build crashes the same way.game_scarlett_master.exe, v1.0.2.1victory run --execute game_scarlett_master.exewith the default--console series-xand--unimplemented trapWhat happens
The title opens files through dstorage, adds the offline local user and starts presenting frames at 3840x2160.
Many compute shaders fail to translate, for example:
GFX10 code at 0x3808: a descriptor read only as ...GFX10 code at 0x8d28: a lane mask holding lanes ...GFX10 code at 0xbaa8: a select on an untracked ...Some host pipelines are also refused with
The parameter is incorrect.Host submissions slow down (
slow host submission ms=4848 lists=20just before the first crash).The device is removed. With the debug layer on,
ID3D12Device::RemoveDevicegivesDXGI_ERROR_DEVICE_HUNG(a TDR timeout).DRED breadcrumbs across runs
VICTORY_D3D12_DRED=1VICTORY_SKIP_PIPELINESwith the five mesh shaders from run 20b15057954f1321e/ pixel055dd1a8f7b02013VICTORY_D3D12_DEBUG=1Mesh shaders in the stalled window of run 2:
c962201cddbdd7dd,0d9d1c59733d6340,37f363f0a5dcd806,3fd417e7d6f55114,89036e16fa081505. Skipping them moved the hang to another mesh shader, so the problem seems to affect mesh draws in general rather than a few shaders.Debug layer messages (run 4)
All of these name buffers labeled
title buffer <addr>+<size>:IASetVertexBuffers ... Resource state (0x8: D3D12_RESOURCE_STATE_UNORDERED_ACCESS) ... is invalid for use as a vertex buffer. Expected State Bits (all): 0x1: D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFERResourceBarrier: Before state (0x8: D3D12_RESOURCE_STATE_UNORDERED_ACCESS) ... specified by transition barrier does not match with the current resource state (0x1: D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER)The first message attached to the failure:
It looks like the tracked state of a title buffer falls out of sync when the title writes it from compute and then reads it as a vertex buffer. That may not cause the hang by itself, but it could feed a mesh shader bad data.
Logs
I can attach the full logs for runs 2, 3 and 4 on request. Each one is large because it includes the full DRED dump.
@Marvisak on GitHub · 2026-11-25 12:46 UTC · original
Automated triage for the maintainers.
Run report (RTX 4070 on Windows 11, fork branch built on
mainplus several PRs) with detailed narrowing; the comments add the same world hang on a GTX 1660 under Wine and an RTX 3070 onffe310e. Where the pieces are tracked:DEVICE_HUNGon NVIDIA: #71, the oldest complete report.maindeclares the console wave size incrates/victory-shader/src/emit/lower.rs(Lower::new); discussed in #71, with open PRs #1929, #1890 and #1922.0a4b89f) is on a fork and is not inmain.IASetVertexBufferson a title buffer still inUNORDERED_ACCESS(RTX 3070 comment): tracked in #199, with open PRs #1691 and #334.Host::executeincrates/victory-gpu/src/host.rswaits on the submission fence before checking the removal reason; the same request is in #714.The
VICTORY_HOST_WAVE32mode and the constant-buffer fixes indraw.rs(null CBV forView::Constant(0, 0), zeroed padding) live only on the fork branch. Pull requests are open to everyone; please open the constant-buffer fixes as a PR (and the wave32 mode, if it differs from the open wave64 PRs) so they can be reviewed here.Generated by Claude Code