GPU & shader: full Root SRV extent refresh, safe fallback VAs, and Root UAVs #294
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!294
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/294/head"
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?
@wbkepler on GitHub · 2026-11-24 02:06 UTC · original
wbkepler:gpu/root-srv-bounds-and-uav→main· +1485 −123 · 11 files · 4 commits · closed without mergingSummary
Fixes Root SRV truncation past 1 MiB, null/unmapped root view faults, and adds full Root UAV support end-to-end:
draw.rs):Shadowbuffer extent (shadow.left(address)) for Root SRVs and Root UAVs while keeping Root CBVs at the 64 KiB D3D12 limit.shadow.rs,draw.rs):shadow::find/looseagainst low (< 0x10000), overflowing top-of-u64, and uncommitted addresses, and binds permanently-alive 4 MiB zeroed/sink fallback GPU VAs instead of skippingSet*Root*View.victory-shader,victory-gpu):u<slot>, space1RWByteAddressBuffer) acrossvictory-shader(descriptor handle,global_store_dword*,s_load_dword*on root descriptors,PSV0/dx.resourcesmetadata,SFI0/ShaderFlagsUAVsAtEveryStage),shader_cache(VSH2),pipeline::host(deduplicating shared(kind, slot)root views across stages), anddraw.rs(binding,gpu_writeswrite-back, and post-draw/dispatch/ExecuteIndirectUAV barriers).Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passed (victory-gpu: 47 passed, 1 ignored;victory-shader: 71 passed includingdxil.dllvalidation, WARP, and host GPU tests)cargo xtask policy— passed (151 files ok)@r4tedx on GitHub · 2026-11-24 03:11 UTC · original
Review question on cost (built on
maind2a4bae;cargo test -p victory-gpuand-p victory-shaderpass on an RTX 5070). Inroot_view, a root SRV and a root UAV now take the whole rest of the backing copy:maincapped root SRVs at 1 MiB. Testers report one host copy of about 174 MiB behind most of the title's buffers (#199:title buffer 0x19b10000+0xae00000). For a root UAV into it,gpu_writeskeeps the range's bytes before the submission and the copy-back compares the range afterwards, so a root UAV near the start of that heap means on the order of 174 MiB kept and compared per submission. A direct-SRV refresh of similar size (#185) took an RX 7800 XT from about 1 s to about 6 s per frame, and long submissions are what ends in the device removal.Has this been measured on a large buffer? If the view's real extent cannot be known, a cap with a logged warning when it is hit (as
maindoes for SRVs) would keep the worst case bounded.From reading and synthetic tests only; I have no copy of the title.
@miniongk on GitHub · 2026-11-24 03:22 UTC · original
Tested
bffaefdon an RTX 5080, driver 621.24, Windows 11 26300, with a local Xbox Series 1.0.2.1 copy.cargo test --workspace: 270 passed, 0 failed, 4 ignored.DXGI_ERROR_DEVICE_HUNGat a compute dispatch. There were again no null or unmapped root-view fallback warnings.So this does not resolve #97 on my machine; that is not evidence against the root-UAV functionality itself. Only aggregate counts and error classes shared, no game data or raw game logs. AI-assisted (Kimi Code).
@wbkepler on GitHub · 2026-11-24 03:39 UTC · original
Thanks @r4tedx, good catch: it had not been measured on a large buffer, and the UAV snapshot/compare is the expensive part. Pushed
0050ce5:root_lenbounds every root view instead of usingshadow.left(address): CBVs stay at the 64 KiB D3D12 maximum, root SRVs refresh at most 4 MiB, root UAVs refresh, snapshot and copy back at most 2 MiB (smaller because that range is kept and compared on every submission).maindoes.// shortcut:. The translated shader does not report the range a root view reads or writes yet. Once it does, that range should replace the caps.main's 1 MiB, so the >1 MiB geometry reads this PR fixed still work. The existing +1.5 MiB SRV/UAV tests still pass, and a unit test checks the caps and that shorter extents are taken whole.The fallback VAs and root UAV support are unchanged. Gate: clippy (both configs),
cargo test --workspaceandcargo xtask policyare clean.@ghost on GitHub · 2026-11-24 06:04 UTC · original · edited 2026-11-24 06:05 UTC
In game on AMD RDNA4 (RX 9060 XT, Windows 11), opening cutscene:
d2a4bae+ #135 + #365 + #318 + #385 + #346 + #305 + #500 + #489 (279eac1),diag+ a local logging patch; this PR'sdraw.rsconflict resolved to its side.With
0050ce5,3b90165a77d95cdf(the largest compute dropper) and4ddd6f9702fab2a7run: 3,003 and 120 dispatches in 5 traced frames, none dropped.But the device hangs (
0x887A0006) 16–23 s after the world starts in every run I didn't stop first: 4 runs (3 at0050ce5, 1 atbffaefd, so not the new caps). Two short runs I stopped at 20–21 s hadn't hung yet, and onebffaefdrun ended at 12 s in a title access violation instead. Each time3b90…,4ddd…and969c1cef8b783b39dispatches are in flight, and the fault is in no title memory copy. Without this PR: 79 and 219 s, the knowninside freed texturefault with mesh draws.969c…runs without this PR too.With
VICTORY_SKIP_PIPELINESfor3b90…and4ddd…, 1 of 2 runs still hung (28 s), with three other programs this PR enables in flight (14394a322f6dd5c2,f94e5d8bf4e1cf05,5c09eb42b7a3c362). So it looks like the root-UAV programs as a group.Not checked: which dispatch faults; GBV.
AI-assisted (Claude Code, Claude Opus 5.5); no game data.
@Raxstreams on GitHub · 2026-11-24 06:14 UTC · original
I checked the root-SRV extent change on Windows in a local integration that also uses the bounded root-SRV tables from #493. The synthetic
root_srv_refreshes_dirty_data_past_one_mibregression passed.I also replayed six dropped world compute shaders offline on that integration. All six reached the program IR, but none produced a host compute pipeline. Four stopped during resource tracking with “an address in an SGPR that is no root parameter” and the two meshlet-culling variants stopped in emission with “a hardware SGPR input”. In this configuration the translator stops before these programs can exercise the runtime root-UAV binding. This check verifies the SRV refresh separately from the title’s lighting.
@jeremygold02 on GitHub · 2026-11-24 05:05 UTC · original · edited 2026-11-24 06:55 UTC
Tested this PR at
0050ce50together with #489 at279eac1(which includes #302) on Windows 11 and a physical RTX 5070. Five previously refused compute shaders reached fence-complete direct dispatches during mission loading.d2a4baeAll six previously stopped on root UAV / typed root view handling with #489. The SDK preserved all six emitted DXIL hashes. For the live comparison I kept the previous mission build, including #457 and the same readback instrumentation, and added #489 and this PR. The startup logs show 682 early pipeline keys for the previous build and 683 for the combined build. I staged identical 682-key seeds, but the harness set only the data directory and both launchers used the shared pipeline cache. The runs therefore do not give a controlled cache or frame-time comparison. A diagnostic observer matched nonempty direct dispatches for five distinct shaders to their submitted command lists. The native queue fence completed at the submitted value for both batches. The mission screen remained near black. This run establishes dispatch progress, with visible rendering and frame-time impact still unresolved.
I also isolated why the sixth shader fails pipeline creation on this adapter. Its validated DXIL requires a 64-lane wave, and DXC accepts the production root signature for it. The RTX 5070 reports WaveOps support with both the minimum and maximum wave size at 32. I compared two ordinary 512-thread compute shaders with 1,024 bytes of group-shared memory and the same root signature. Both passed SDK and root-signature validation. Changing only
[WaveSize(32)]to[WaveSize(64)]changed native pipeline creation fromS_OKtoE_INVALIDARG(0x80070057), the same refusal as the sixth shader. This is a sufficient reason for that PSO refusal. The test created no command list or queue. Related wave-size handling in #223.Separately, the production root-binding and guest copy-back path passed a bounded synthetic check on the same GPU. A direct dispatch and a one-group indirect dispatch both wrote the expected guest dword. An unmapped UAV wrote to the designated sink, the separate zero buffer stayed zero, and surrounding guest bytes stayed intact. Each submission completed its fence with the device reporting
S_OK.@wbkepler on GitHub · 2026-11-24 07:13 UTC · original
Thanks @nullmarsh and @miniongk for the live hardware reports!
Re: the 16–28 s
0x887A0006hangs across the root-UAV compute group (3b90165a77d95cdf,4ddd6f9702fab2a7,14394a322f6dd5c2,f94e5d8bf4e1cf05,5c09eb42b7a3c362) with the fault outside any title memory copy:#294'sdraw.rs,pipeline/host.rs, andvictory-shader/src/emit/{lower.rs,shader.rs}root-UAV paths. The binding slots, deduplication,VSH2cache, and UAV barriers match up cleanly (as confirmed by @jeremygold02's bounded hardware dispatch/readback test).SetComputeRootUnorderedAccessView/SetComputeRootShaderResourceView) carry no hardware size or bounds check. On the console,Source::BuiltV# descriptors enforcenum_records(silently dropping OOB stores and zeroing OOB loads), andglobal_load_*/global_store_*can receive negative or OOB offsets when an earlier producer pass is dropped or returns zeros. On a raw D3D12 root UAV, any OOB byte offset writes/reads straight past the end of the hostShadowbuffer into unmapped GPU VA space ("in no title memory copy") and triggers0x887A0006— the same class of unbounded root-descriptor fault seen on Root SRVs in #71 / #493 (c48b240) and addressed by bounded root views in #650.#294withVICTORY_D3D12_GBV=1or stacked with #650 (or capture which of the 5 hashes DRED stops on), that would confirm whether the fault is an OOB root-UAV offset vs a shader loop timeout (like the wave64/loop compute hangs in #97 on @miniongk's RTX 5080).@Vaximous on GitHub · 2026-11-24 07:33 UTC · original
A memory-corruption hazard in the root UAV path here, which I ran into with my own root-UAV binding on a local branch. The mechanism is the same in this PR.
root_view(.., RootView::Uav)gets the host copy withcrate::shadow::find(address, 1). When no registered title buffer holds the address,findfalls back toloose(), a window copy of whatever committed title memory is at that address. That is harmless for reads (CBV/SRV). But the UAV branch then callsshadow.gpu_writes(list, address, len), so whatever the shader writes there is copied back into that CPU memory after the submission. When the address is wrong, or points at memory the title uses for its own CPU-side records, the shader's bytes overwrite title objects.Observed on an RTX 4070 Ti (local integration branch with root UAVs and address tracing through two root constants / readfirstlane):
0xc0000005reading a non-canonical address. It had loaded a pointer field from one of its own pool objects, and that field held two floats (0xbf116000bf4e8000).find_bufferthat sharesfind's lookup minus theloosefallback), and drop the draw/dispatch otherwise. With that, the same build ran ~145 s in the world (to the run's time limit) with no exception.Suggested change for this PR: use a buffer-only lookup for
RootView::Uav(and anything that callsgpu_writes). When it misses, take the zeroed fallback VA this PR already has, instead of a loose window. The fallback keeps the dispatch running without touching title memory. A loose window stays fine for CBV/SRV.Not tested on this PR's branch itself (only on my local branch with the equivalent binding), so treat the above as a review note rather than a repro on #294.
@itsRevela on GitHub · 2026-11-24 07:43 UTC · original
A data point from the title's opening cutscene, in case it helps with the device-hung reports here. Setup:
diagbuilds with a warm shader cache.VICTORY_GPU_TIMING.This PR is what lets compute program
4ddd6f9702fab2a7translate.mainit stops atan address in an SGPR that is no root parameter.a root UAV or typed root view.In a local integration build it is what hangs. That build is this PR plus #302 #489, my #709 #710 and two more translator changes.
0x887A0006) while a singledispatch 1x1x1of that program is in flight, a few frames into the heavy part of the cutscene. Two runs out of two.VICTORY_SHADER_LOOP_LIMIT=4096. That cut the slow commands from 98 to 42 (7.05 s to 1.62 s of timed GPU work) but not this one, so it doesn't look like a loop that merely runs long.VICTORY_SKIP_PIPELINES=4ddd6f9702fab2a7), the cutscene runs about twice as long, 24 frames past the first heavy frame against 6 to 12. Then the device goes on an indirect mesh dispatch, the hang #325 and #71 describe.So one workgroup of this program never finishes. Either its root-UAV accesses translate wrongly, or it waits on something written by passes that are still dropped. On #302 #489 #307 #346 + this PR alone, the first hang was the indirect mesh one instead. So it may need the extra work the integration build runs before it spins.
Counts and hashes only. AI-assisted (Claude Code).
@ghost on GitHub · 2026-11-24 07:45 UTC · original
@wbkepler The removal report says where the list stopped, and it is the same program every time:
0050ce5, 1 atbffaefd)dispatch 1x1x1 [compute 4ddd6f9702fab2a7], op 6 of its list3b90…and4ddd…skippeddispatch 39x1x1 [compute 14394a322f6dd5c2], op 651ff151f75cd5759,c962201cddbdd7dd), op 42No
binding zeroed fallbackwarning appears in any of these runs. Onebffaefdrun ended instead with a title access violation 12 s into the world, which might be @Vaximous's loose-window case; I can't tell from here.#650 conflicts with this PR directly (
git merge-tree prs/294 prs/650:draw.rs,lower.rs,valu_tests.rs). A combined branch from you would be a fairer test than my hand merge; I'll run it on the same stack. GBV: my one GBV run (on the base, not this PR) hit the title watchdog before the world; with #454'sVICTORY_NO_WATCHDOGI can try it on this PR.AI-assisted (Claude Code, Claude Opus 5.5); no game data.
@LooperSalty on GitHub · 2026-11-24 09:38 UTC · original
Tested on an RTX 4070 SUPER (diag build, main
58fed37+ ~25 PRs including #493, #688, #483, #189; conflicts resolved by keeping #493's one-view tables for root SRVs and sending root CBVs/UAVs through this PR'spush_root_view; + #709):DXGI_ERROR_DEVICE_HUNG). DRED stops on aDispatch 1x1x1of it, and one of its tables reads a null heap slot.VICTORY_SHADER_LOOP_LIMIT=32does not prevent it, so it looks like a wait on data that a still-dropped producer never writes, rather than a problem in this PR.🤖 Generated with Claude Code
@MichaelSmithAI on GitHub · 2026-11-24 10:32 UTC · original
For the requested combined source and the two mission-1 compiler refusals reported here, there are now two pinned revisions for an offline translation and validation comparison.
afa5bdc, bounded root views combines #294, #650 and #709 with their prerequisites. The normal dispatch test checks that an interior root view gets the correct start and remaining byte count.6649785, sub-dword comparison adds #571 for LDS byte/halfword access and a focused implementation ofbuffer_load_ushortthrough bounded root views. The latter covers a halfword crossing a dword boundary and is narrower than all of #164. The combined source passed 69 Linux shader tests, the asset check, and Windows-target checks for the CLI and shader/GPU tests.If the original two compute programs are available locally, the useful result is one line per program and revision: whether it validated, or the first remaining refusal. The public report does not identify the descriptor class for the halfword load. The combined revision has no measured title coverage or HDR output result yet.
AI-assisted integration and verification.
@ghost on GitHub · 2026-11-24 11:27 UTC · original
@wbkepler @MichaelSmithAI In game on an RX 9060 XT (driver 32.0.32029.2010),
diag+ DRED, 2 runs of 200 s per build:afa5bdc(this PR0050ce5, #65006657a8, #709e50ed36, #489279eac1, #307, #346 ond2a4bae) + #135 + #365, #135'sdraw.rsconflict resolved to the branch's side.afa5bdc66ac451(#650) reverteddispatch 1x1x1 [compute 4ddd6f9702fab2a7], op 6, both timesThe reverted build stops where this PR alone did in my four earlier runs. In both builds
3b90165a77d95cdf,4ddd6f9702fab2a7,14394a322f6dd5c2,f94e5d8bf4e1cf05and5c09eb42b7a3c362translate, get host pipelines, and have no drop lines, so they run either way. Reverting that merge brings the hang back. (@LooperSalty's NVIDIA hang on aDispatch 1x1x1may be the same one.)Not checked: #650 without #709; past 140 s, which is short of where the baseline's own fault comes (79–219 s).
AI-assisted (Claude Code, Claude Opus 5.5); no game data.
@itsRevela on GitHub · 2026-11-24 07:48 UTC · original · edited 2026-11-24 12:25 UTC
Follow-up on
4ddd6f9702fab2a7. Its code (read locally, not posted) has no loop at all: 52 instructions, only forwardexeczbranches, 2 buffer loads, 2 buffer stores and 2 scalar loads. The buffer accesses are raw (offen, noidxen) through its two root UAVs (Descriptorparameters, declaredstride: 1). So it can't be spinning, and my "waits on something" guess above is wrong. A single straight-line workgroup that never completes points instead at one of those root-UAV accesses hitting an address the host can't serve: an unmapped address, a fallback/sink buffer, or an offset past the refreshed extent. That would be the thing to check in this PR's binding path. Counts only. AI-assisted (Claude Code).Addendum: in the DRED dump of that hang, both root UAVs of the dispatch are the same title address, and the host maps it to one host copy
0x60700bytes long, the same for both. So the two views alias one 394 KB region, and any access past it goes beyond the host copy. Root views carry no size, so nothing stops that on the GPU.Second addendum, an experiment: I had
root_viewaskshadow::findfor the whole capped extent (root_len(u64::MAX, kind)) instead of 1 byte. That made 4 loose copies. Then4ddd6f9702fab2a7is no longer what hangs, but the device still goes 8 frames into the heavy part. This time it's on another singledispatch 1x1x1of a small compute program that accesses memory through root UAVs (5552dac6a2b7a1fd, which also needs #709 to translate). So it looks like a class: one-workgroup compute programs that access memory through root UAVs. It doesn't look like one program's extent.@erickbobd on GitHub · 2026-11-24 12:44 UTC · original
A data point on an RTX 5070 Ti (617.14, Windows 11, Series S,
VICTORY_SHADER_LOOP_LIMIT=32), in case it helps with the root UAV part.On a base that stays in the world (
d2a4bae+ #493 #483 #189 #89 #205 #206 #469 #459 #454 #211 #472 #688 #489, 10 min with no device removal), adding this PR lost the device at 118 s and 127 s, still during loading; DRED stopped at compute4ddd6f9702fab2a7, one of the programs whose root UAV this PR lets translate.As a local experiment I kept this PR's shader and root-signature side but bound each root UAV as a one-view table with a raw UAV of the host copy, sized to what is left of that copy (the way #493 binds root SRVs), so a write past it is dropped instead of going through an unbounded VA; no copy-back. That build stayed 10 min in the world with no device removal (one run; two other runs ended in host OOM during loading: peak private bytes rose from about 15 GB to 20 GB).
4ddd6f9702fab2a7and3b90165a77d95cdfnow translate;caa78b8ca62bc3d6and28918b7150a7aad5then stop atbuffer_load_ushort. The 3D scene is still black, and the world was slower (0.7 fps against 1.2).So the device loss looks like unbounded root UAV writes, not the root UAV programs themselves. One root UAV address here was only 4-byte aligned, which a raw view cannot start at.
No game data attached. AI-assisted (Claude Code); runs on my machine.
@ghost on GitHub · 2026-11-24 13:13 UTC · original
Follow-up on the RX 9060 XT.
afa5bdc(+ #135 + #365) over four runs: no device loss in any; two ran to the 200 s limit, two longer ones ended in title access violations 35 and 137 s into the world.@MichaelSmithAI your
6649785on the same base, from the runtime log:afa5bdc6649785caa78b8ca62bc3d6an LDS write of bytes or halvesbuffer_store_short28918b7150a7aad5buffer_load_ushortWith
6649785as is, 4 of 4 runs end in a title access violation 10–14 s after28918…is first bound, before the first world frame. With it skipped, 4 of 4 reach the world (3 to the limit). In 3 of those 4 crashes the pointer register holds two floats (0x7f8000007f800000), and the skip run's one crash shows another float pair. That looks like @Vaximous's case above: a root-UAV write-back landing on title data. So28918…, a root-UAV writer, may be triggering this PR's write-back rather than the halfword read being wrong. Not checked: which memory its root UAV points at.AI-assisted (Claude Code, Claude Opus 5.5); no game data.
@dpalacios69 on GitHub · 2026-11-24 19:01 UTC · original
Read of head
c00c1bcagainst currentmain(ffe310e; this PR's base isd2a4bae). It merges without a text conflict, but the Windows test build should stop compiling:pub root_uavs: Vec<u8>toHostShader(emit/mod.rs:159, noDefault).emit/waterfall_tests.rsexists onmainbut not in this PR's base, and itsbuild()makes aHostShader { stage, dxil, user_data, samplers, static_samplers, root_cbvs, root_srvs }literal (line 77, no..). After the merge that literal has noroot_uavs, socargo test -p victory-shaderon Windows should fail withE0063: missing field root_uavs.Adding
root_uavs: lowered.root_uavs,next toroot_srvs: lowered.root_srvs,there should be enough (Loweredcarriesroot_uavsin this PR,lower.rs:38). The module is#[cfg(all(test, windows))], so I could not compile it on Linux; this is from reading both files. It is the same kind of base drift as theresource::trackarity change tracked in #801. AI-assisted; no game data.@wbkepler on GitHub · 2026-11-24 20:34 UTC · original
Thanks @dpalacios69 for the catch. The branch is now rebased onto upstream
ffe310e(heada4e0feb), androot_uavsis added to theHostShaderliteral inwaterfall_tests.rs(plus theresource::tracksignature change in the new Root UAV tests). Clippy,cargo test -p victory-shader -p victory-gpuand the asset policy check are clean.For the earlier in-world reports of a device hang at a compute program with two raw root UAVs (@nullmarsh, @itsRevela, @erickbobd): your own data shows the hang goes away once #650 (bounding root view accesses by the host-bound size) is stacked on this PR, so #650 should land with or before this one.
AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
Pull request closed