GPU: a root constant's dword 4 is a value, not a view offset (#2699) #2703
No reviewers
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!2703
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2703"
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?
@Calvix2k on GitHub · 2026-11-25 18:28 UTC · original
Calvix2k:codex/gpu-root-view-offset→main· +23 −1 · 1 files · 1 commits · openFixes #2699.
In the user-data loop, a dword numbered
ROOT_VIEW_OFFSET(4) was taken for a root view's offset without asking whether the parameter was a root descriptor at all. Root constants with five or more dwords have a real dword 4; it was looked up as a root view, none was found, and the draw or dispatch was refused (a root view's offset: no root view, or outside title buffers) with no log line. The ray-tracing builder's dispatches were among the casualties.Ask
u.root == RootType::Descriptortoo, through a helper besideis_root_view, so a root constant's dword 4 goes to the title's user data as the value it is.The test pins the predicate: a descriptor's dword 4 is an offset; constants' and tables' dword 4 are not.
Tests:
cargo test -p victory-gpu --lib --locked only_a_root_descriptors_dword_four(pass),cargo clippy -p victory-gpu --all-targetsclean.In the user-data loop, a dword numbered `ROOT_VIEW_OFFSET` (4) was taken for a root view's offset without asking whether the parameter was a root descriptor at all. Root constants with five or more dwords have a real dword 4; it was looked up as a root view, none was found, and the draw or dispatch was refused ("a root view's offset: no root view, or outside title buffers") with no log line. The ray-tracing builder's dispatches were among the casualties. Ask `u.root == RootType::Descriptor` too, through a helper beside `is_root_view`, so a root constant's dword 4 goes to the title's user data as the value it is. The test pins the predicate: descriptor dword 4 is an offset, constants and table dword 4 are not.@andrewpozdnakov7-jpg on GitHub · 2026-11-25 18:48 UTC · original
The same WARP shader goes through VIctory's dispatch and reads a user-data word into a buffer. A root constant at dword 4 leaves the output at 0 on main
13f91caee2and writes 1.25 on7bb3ebaf46. The control puts a real root view 16 bytes into its buffer and reads the offset 16 on both revisions. Six paired runs across both debug settings reproduced this.The serial GPU suite had 200 passes and one ignored in each setting. Strict GPU Clippy in both configurations and asset policy passed.
Test-only commit c4e53db is directly on your current head and checks the dispatch and readback in addition to the predicate. Please keep the Git author if you cherry-pick it, or add this trailer if folding it into another commit:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
@kotekompotek on GitHub · 2026-11-25 18:50 UTC · original
Real bug, minimal fix - dword 4 is ROOT_VIEW_OFFSET only in the root-descriptor encoding; a constants param has a genuine value there. Gating on root == Descriptor matches how is_root_view already treats the namespace. The predicate test pins all three root types.
@fuzeofficlal on GitHub · 2026-11-25 18:51 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and full-repo audit of
7bb3ebaf(on13f91ca):Verification (
rustc 1.98.1MSVC)cargo clippy --locked -p victory-gpu --all-targets -- -D warningsand--features diagnostics: 0 warnings.cargo test --locked -p victory-gpu --features diagnostics --lib draw: 14 passed, 0 failed (includingonly_a_root_descriptors_dword_four_is_a_view_offset).VICTORY_D3D12_WARP=1):cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1: 199 passed, 0 failed, 1 ignored.Code Review & Repo Audit
ROOT_VIEW_OFFSET,ROOT_SRV_VIEW,ROOT_UAV_VIEW,RootType, anduser_dataacrossvictory-gpuandvictory-shader: no other call site conflatesRootType::Constants/RootType::Tabledword 4 with a root view offset (user_value,is_root_view, andlower.rsall gate onRootType::Descriptor).c4e53dbend-to-end dispatch test would be a nice bonus, though not blocking; also supersedes older #2295 on currentmain).@oni-swr on GitHub · 2026-11-25 18:56 UTC · original
Independent WARP/CPU verification (claim: Marvisak/VIctory#1633)
7bb3ebaf46081958a6546cd74bd8290cd3a3b715/origin/main:13f91caee25f2fdf2c062be5f7a27f058e51cbcagit merge-tree --write-tree origin/main <head>merges cleanly; no prioroni-swrcomment on this head.VICTORY_WARP=1+VICTORY_D3D12_WARP=1(WARP only, no physical GPU, no game files/dumps/retail hashes),dxil.dll1.8.2502.11 (Windows SDK 10.0.26100.0, viaVICTORY_DXIL), rustc 1.98.1 (48a229cea 2026-09-01), debug profile,--locked.Commands / results (baseline =
origin/main, same environment)draw::tests::only_a_root_descriptors_dword_four_is_a_view_offsetok.Negative control: with the predicate loosened back to the old condition (
u.dword == ROOT_VIEW_OFFSET, root type ignored), the new test FAILS; reverted afterwards.Code review: No bugs found. Minimal fix: the offset substitution now requires
RootType::Descriptor, so a root constant's dword 4 stays a value. The test is a unit test of the predicate (Descriptor/Constants/Table); it does not exercise the surrounding fill loop end to end.Not tested: physical GPU hardware (RX 7800 XT or any), retail game run, release build, other crates.
AI use: Claude Code (Claude Sonnet 5.5) ran the commands and reviewed the diff; the results above are from the actual runs.
@Marvisak on GitHub · 2026-11-25 22:21 UTC · original
Automated triage for the maintainers.
Merge candidate (recommend a look). This is a real bug fix. In the user-data loop of
State(crates/victory-gpu/src/draw.rs), anyUserDatawithdword == ROOT_VIEW_OFFSET(4) was treated as a root view's offset. The translator (Lower::user_dwordinemit/lower.rs) also emitsdword: 4for the fifth dword of a root constants parameter, so such draws and dispatches were refused. The newis_root_view_offsetalso requiresRootType::Descriptor, the only root type for whichLower::root_view_offsetemits that dword. The test pins the predicate. A contributor's comment adds an end-to-end WARP readback (main 0, this branch 1.25). It fixes the same thing as the older #2295 (needs work) and merges cleanly, so this is the one to take.CI:
checkpassing on this head.Generated by Claude Code
@Anzymanz on GitHub · 2026-11-25 23:10 UTC · original
From a tester working with Claude (AI-assisted, Claude Code): a second machine where this is the biggest drop class in the world.
Setup: RX 9070 XT, RADV (Mesa 26.3.1) through vkd3d-proton (GE-Proton 11-14), CachyOS; diagnostics build of
main13f91ca+ #1997 + #454, Series X, 1.0.2.1; Microsoft'sd3dcompiler_47in the prefix so the indirect clamp builds.Drops (
a root view's offset: no root view, or outside title buffers, highest per-frame rate of each program over one world run):3b90165a77d95cdf1,014,f6e47efa50226beb768,6f6a359d1166bb27314,5e68767498c57eb6298, andffd93c8a029ff016,c42a31951201f9a0,5062bc7a48e842f8,190fbf0ebe040169,c85822de2e41cfaa10-58 each. That is more than thebeing madedrops (839) in the same run.Why, checked offline: all of these are compute programs from
XboxBvhBuilder.dll, and translating them (emit::translate_with) gives each a user-data entry withroot: Constants, dword: 4(3b90165a77d95cdfslot 2,f6e47efa50226bebslot 8,6f6a359d1166bb27and5e68767498c57eb6slot 0), which theROOT_VIEW_OFFSETarm takes for a root view. So the RDNA4/Linux drops are this bug too. I haven't run the title with this PR yet; I'll post the A/B when I have it.No game data here: hashes and counts only.
@Anzymanz on GitHub · 2026-11-25 23:35 UTC · original
The A/B I promised above, same machine (RX 9070 XT, RADV/Mesa 26.3.1 via vkd3d-proton, GE-Proton 11-14), same base (
13f91ca+ #1997 + #454 + #2644), diagnostics builds, warm shader cache, one run per arm, 30 s in the world each (the opening cutscene),VICTORY_GPU_TIMING=1:a root view's offsetsummary linescaa78b8ca62bc3d6,28918b7150a7aad5)So on RDNA4 under Linux this PR removes that drop class completely, and the ray-tracing builder's other programs now run; no new fault in the 30 s. Frame times aren't comparable between the two runs (different cutscene moments, and the timing mode serialises lists), so I'm not quoting them. The one 808 interval is right after the world loaded (pipelines still being made).
AI-assisted (Claude Code, Claude Opus 5.5); no game data, hashes and counts only.
@davesousa on GitHub · 2026-11-26 00:59 UTC · original
NVIDIA in-game A/B: RTX 3070 Ti 8 GB (Ampere), driver 621.40, Windows 11 26200, TDR delay 8 s.
diagbuild, warm caches. Base:main63bcca4+ #2319 + #2178 + #2634 (what this card needs to reach the world). Then the same with this PR (7bb3eba, merges cleanly;only_a_root_descriptors_dword_four_is_a_view_offsetpasses here). Scripted input walks in the prologue from 150 s.0x887A0006at 133 s and at 81 sa root view's offsetdrops per frameSo the fix does what it says on NVIDIA too: the drop class is gone, and the builder programs the thread names (
3b90165a77d95cdf,f6e47efa50226beb,6f6a359d1166bb27,5e68767498c57eb6and the rest) run. But on this card what they then submit does not fit the timeout. In the second run, withVICTORY_D3D12_DRED=1, the removal follows a 2-list submission of 17,406 commands (the first list alone 11,969). DRED's stop is at an ordinary texture upload in that first list, so I read it as where the GPU was at 8 s, not as the cause. Threenvlddmkmresets at the moment of removal; no event 13.That matches the 5080/Linux report in #1968's thread of the builder list running past the timeout until #2167. So on NVIDIA this PR seems to need the builder's work cut into smaller submissions (or made cheaper) to land without turning a running world into a hang. I haven't tried #2167 or #2214 with it yet.
AI-assisted (Claude Code); the runs are on my machine.
@crashbashash on GitHub · 2026-11-26 01:13 UTC · original
AMD data point for comparison with the RTX 3070 Ti above: RX 6800 XT (RDNA2), Linux, Mesa RADV 26.2.6,
vkd3d-proton
71cae091b(GE-Proton11-14 with a newer vkd3d-proton),diagbuild ofmain219878aplus our Linuxcommits, the same prison scene from a save, 120 s in the world, idle machine.
So on RDNA2 the builder's work lands at most at a small GPU cost (a few ms a frame, within run-to-run noise here),
unlike on Ampere. In the same runs nothing in the picture changed that I could attribute to it.
AI-assisted (Claude Code). No game data attached.
@davesousa on GitHub · 2026-11-26 01:21 UTC · original
Follow-up: the same card and base, with this PR and #2167 (
3cb308d, rebased on63bcca4, merges cleanly; its mark and memory tests pass here), shader cache and pipelines rebuilt.0x887A0006at 133 s and 81 s0x887A0006at 101 s (1 run)So #2167 takes about a quarter off, but not enough for an 8 s TDR here.
With
VICTORY_GPU_TIMING=1(each list run on its own; its times are inflated, FIND-29), a single list of 10,730 commands is what removes the device:slow host list ms=21168. DRED's stop is inside a barrier-free run of about 400 commands (1,267..1,668) that starts atdispatch 4x1x1 [compute f6e47efa50226beb], one of the builder programs this PR lets through. The per-command times in that list came back 0 because the device was gone, so I can't single out one dispatch. On this card the builder's work needs to reach the GPU in more than one submission (or with barriers that let the timeout breathe) before this PR can land without a hang on NVIDIA.AI-assisted (Claude Code); the runs are on my machine.
@davesousa on GitHub · 2026-11-26 02:34 UTC · original
Follow-up 2: the same card and base (
63bcca4+ #2319 + #2178 + #2634), this PR with #2118 and, separately, with #2841. Scripted walking from 150 s, 10-minute runs, warm caches (the #2841 build got its own shader cache and pipelines first). Both merge cleanly on this stack; #2118's three tests pass here.af8b9ad)274cdad)VICTORY_GPU_TIMING=1)0x887A0006at 133 s and 81 s0x887A0006) and at about 90 sa root view's offsetdropsFor comparison, the base without this PR, summarised the same way: 835 ms median (GPU 431), longest submission 0.78 s. My first comment's 815 ms picked its frames slightly differently.
With #2118 the builder never starts on this card:
BVH builder held back: not all its pipelines are made pipelines=53 made=44 refused=9at the first world frame, and it stays held back for the whole run. The 9 are programs this card cannot make (its wave64 ones; the driver returns 0x80070057). So the resets need the builder dispatches this PR lets through, and on a 32-lane NVIDIA card those run without the 9, which is the case #2118 is for. With #2118, this PR lands here without a reset and keeps its drop count at 0.#2841 on its own does not change that. Its thread-count path does run here (
4ddd6f9702fab2a7and5062bc7a48e842f8get their cut-short pipelines), but the long submission and the reset stay. The timing run has no DRED stop: VIctory crashed while writing its device-removed report.Not tested here: the builder running whole on NVIDIA, which needs the wave64 work in #439/#2214. So whether its whole work fits the timeout on this card is still open.
AI-assisted (Claude Code); the runs are on my machine.
@Dukestar69 on GitHub · 2026-11-26 04:23 UTC · original · approved these changes
Tested merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-gpu --lib draw::tests::only_a_root_descriptors_dword_four_is_a_view_offset: 1 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@lhnizdo on GitHub · 2026-11-26 08:04 UTC · original
A data point from a 32-lane NVIDIA card, in case it helps: with this change, the first frames in the world became heavy enough here to trip Windows' 2-second GPU timeout.
TdrDelayat its default (2 s), a story save that loads straight into the world.main63bcca4plus #2460, #2461, #2464 and some local work that isn't upstream: #1960 and an experimental console mode for wave64 programs on 32-lane hosts. So this isn't plainmain. The only difference between the two sets of runs is #2703.DXGI_ERROR_DEVICE_HUNG) as the world appeared. Right before it, a single submission took 2.9–3.5 s, once 12 s. DRED's in-flight command moved from run to run (e30970f1727063fd,3b90165a77d95cdf,cb9647e77864cb3a): the GPU was simply past the timeout, not stuck on one command.My reading is that the change makes programs that read a root constant's dword 4 get their real value and do their real work, which is presumably correct (@Anzymanz saw fewer dropped draws with it). On a slower card the first world frames then cross 2 s, so raising
TdrDelay(asvictory_gpu::tdr's warning suggests) would be needed. I haven't measured it with a raisedTdrDelayyet.AI-assisted (Claude Code); the runs were on my machine. No game data.
@arogan178 on GitHub · 2026-11-26 10:39 UTC · original · edited 2026-11-26 10:41 UTC
Confirmed in game: this removes almost all dropped draws and dispatches on AMD under Proton, with no new translation failures.
Setup: GTA VI 1.0.2.1, RX 9070 XT, Linux/Proton (vkd3d-proton). Diag builds of
main63bcca4with and without this PR. #1722 was applied locally in both runs for the pipeline library.Heavy scenes (>3000 draws/frame), ~20 five-second reports per run:
main, nearly all of the heavy-scene drops (~285/frame) werea root view's offset: no root view, or outside title buffers, across 11 compute shaders. With this PR that reason never appears.shader does not translatehashes. None are new.@fuzeofficlal on GitHub · 2026-11-26 11:04 UTC · original · approved these changes
Verified
7bb3ebaflocally on Windows 11 (RTX 5090 and WARP, withVICTORY_D3D12_DEBUG=1):cargo xtask policyandcargo clippy -p victory-gpu --tests -- -D warnings(default and--all-features): clean.draw::tests(12/12, includingonly_a_root_descriptors_dword_four_is_a_view_offset): passed on RTX 5090, RTX 5090 +VICTORY_D3D12_DEBUG=1, and WARP +VICTORY_D3D12_DEBUG=1.Checked every other
ROOT_VIEW_OFFSET/ROOT_SRV_VIEW/ROOT_UAV_VIEW/is_root_viewsite across the workspace; this branch inState::bindwas the only place missing theRootType::Descriptorguard (matchingis_root_view). Clean, minimal fix — ready to merge.@lhnizdo on GitHub · 2026-11-26 11:09 UTC · original
Follow-up to my comment above, now measured with a raised
TdrDelay: on this 32-lane card the change needs #2118 alongside it, and with both there is no reset.TdrDelay10 s andTdrDdiDelay20 s. Same stack as before (main63bcca4plus #2460, #2461, #2464 and the local wave64 work), same story save that loads straight into the world. 12-minute runs.af8b9ad)a root view's offset: no root view, or outside title bufferspipelines=53 made=45 refused=8So @davesousa's reading holds here too. My earlier resets with this PR (submissions of 2.9–12 s) look like the builder running without the 8 wave64 programs this card refuses. With #2118 holding the builder back, the submissions stay where they were without this PR. The rest of the drops in the right column are local diagnostics skipping programs on purpose, plus ~20 a frame for programs that don't translate here. None of it comes from this PR.
One unrelated note in case it saves someone time: with
TdrDelayat 10 s, the programs I had blamed for hangs earlier ran fine. They had just been over 2 s. Raising it is worth doing before reading a device removal on a slower card as a stuck program.AI-assisted (Claude Code); the runs were on my machine. No game data.
@JurajSimicevic on GitHub · 2026-11-26 13:15 UTC · original
Blackwell data point: this PR with #2118, on top of #2461
Setup:
main63bcca4+ #2178 + #2461 (6544a52), with and without this PR (7bb3eba) and #2118 (af8b9ad). All of them merge cleanly.VICTORY_D3D12_DRED=1, warm caches.a root view's offset: no root view, or outside title buffersreport lines in the worlda dispatch of the BVH builder held backThis matches lhnizdo's RTX 2080 and davesousa's RTX 3070 Ti results above. The root-view drops are gone, and with the builder held back, no submission gets longer than before. I didn't run this PR without #2118 on this card.
Local diagnostics only. No game data: log counts only.
AI-assisted.
@Jackster on GitHub · 2026-11-26 14:30 UTC · original
A named program this restores, and the scale of the effect on the title
On the retail build (RX 7900 XTX, driver 32.0.32029.2010, Windows 10 26300.10075, 300 s world runs, diagnostics build at
63bcca4plus a stack of open PRs), the difference this makes on one program and on the frame:main, computec85822de2e41cfaatranslates and makes its pipeline, then is dropped at dispatch with:a root view's offset: no root view, or outside title buffers [compute c85822de2e41cfaa], about 5 draws/frame. With this PR in the tree the same program binds and the drop disappears.dropped/framefrom 431 (1,216 still being made) to 64 and then 0 as the queue drained. Shaders translated in the run rose from 500 to 1,711 because those programs now reach the device.Those numbers are from a 300 s A/B on the same save with this PR as the only difference in the second step; the per-program line above is from a
VICTORY_LOG=victory=inforun and is reproducible by grepping for the hash.The per-program name is the part this PR's description does not have, and it is the same class as #3094's report — a root constant's dword 4 read as a view offset.
Written with an AI assistant.
@zed6000 on GitHub · 2026-11-26 16:45 UTC · original
Tried in the game: this removes every
a root view's offsetdrop in the intro, on AMD.Setup: RX 7900 XTX (RDNA3), driver 32.0.32029.2010, Windows 11 26200, Ryzen 9 7900X3D; diag builds (
--profile diag --features diagnostics), Series X profile, played by hand from boot into the intro cutscene. Warm caches (the counts below exclude the AMD driver's first-run compile).dispatch: a root view's offset: no root view, or outside title buffersmain63bcca47bb3ebafcherry-picked cleanly)The release build of the stack without this PR still dropped 200–370 draws/frame in the same scene (posted on #400), and its shaders all translate, so this reason accounted for most of what remained there. No new warnings and no hang. The intro draws far more of the scene; some surfaces (skin) still look too dark, which this PR would not be expected to change.
#2295 makes the same change, so it should behave the same; I only ran this one.
@lhnizdo on GitHub · 2026-11-26 16:51 UTC · original
@zed6000, thanks, that matches what I saw on NVIDIA. On an RTX 2080 in the world, root-view drops went from about 248 dispatches a frame to 0.
One note for anyone trying this on a 32-lane NVIDIA card: there it needs #2118 alongside. Without it, the BVH builder's dispatches run while the card refuses some of its wave64 programs. On the RTX 2080 that gave single submissions of 12–15 s and a device reset in the world, and @davesousa saw the same on an RTX 3070 Ti. With #2118 holding the builder back, the longest submission stayed at about 2.5 s, the same as without this PR. JurajSimicevic's RTX 5080 run with both agrees. On your RX 7900 XTX the builder's programs all run, so the PR stands on its own there.
AI-assisted (Claude Code). No game data.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.