Shaders: key heap handles by element type (atomic on a float-read UAV) #177
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!177
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-177"
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?
@Ortomanic on GitHub · 2026-11-24 01:08 UTC · original
Ortomanic:pr/shader-handle-element-type→main· +107 −2 · 2 files · 2 commits · openWhat
handle()inemit/lower.rscached heap handles by(block, load, first, sampler, props.0). When a program reads a texture UAV as float and uses it atomically, both annotations shareprops.0(RWTexture2D), so the atomic got the cached float handle. dxil-spirv then emitsOpAtomicOr %floaton a float texel pointer, which is invalid SPIR-V (spirv-val: "AtomicOr: expected Result Type to be integer scalar type").On NVIDIA (RTX 5080, driver 620.73, vkd3d-proton under Wine) the driver's compiler crashes in
vkCreateComputePipelineson that SPIR-V as GTA VI enters its world (programsc12c1f7296419a5b,8358f9eef7931421).Change
The element type (
props.1) is part of the cache key, so the atomic gets its ownu32handle as the texture-atomics note inemit/mod.rsintends.Testing
cargo test -p victory-shader: 56 passed.VKD3D_SHADER_DUMP_PATH) and ranspirv-val --target-env vulkan1.3: 2 invalid before, 0 after.vkCreateComputePipelinesdriver crash no longer occurs (it reproduced in 3 of 3 runs before).@DaviTostes on GitHub · 2026-11-24 01:19 UTC · original
Tested
e55eb69on Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 56 passed, 0 failed (2 test binaries).victory-gpuE0425.No game data used.
@gingertonik on GitHub · 2026-11-24 01:37 UTC · original
Independent confirmation on an RTX 4080 (Linux, vkd3d-proton), a whole-package check, and a test
I hit the same crash on a second NVIDIA card and traced it to the same cache key independently, so here is what I can add.
Environment: Arch-based Linux, kernel 7.3; Core i5-13600K; GeForce RTX 4080 16 GB, driver 620.73.04; GE-Proton11-12's Wine with vkd3d-proton
2576c0b4a(from Proton Experimental 11.0-20261112) in the prefix; Series X 1.0.2.1; release build cross-compiled on Linux.In the game (one run each):
9aef3d9, unchanged:err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix callat world entry, exit code 3. Of 211 SPIR-V modules vkd3d-proton dumped, 2 failspirv-val, both an atomic with a%floatresult type, and one of them is the last compute module dumped before the crash.9aef3d9with the same key change applied locally: no trap, 577 shaders translated, and the run reaches the opening cutscene. It stops later on a separate GPU fault (kernelXid 13 ... MMU Fault), which looks like the world hang in #71 and not like this bug.Across the whole package (no GPU involved):
victory translate --listwithVICTORY_EMIT_DUMP, then every emitted DXIL converted with dxil-spirv114e664e(the commit vkd3d-proton2576c0b4acarries) and checked withspirv-val --target-env vulkan1.3 --scalar-block-layout.d2a4baee55eb69The 39 are 26 pixel and 13 compute programs: 22
AtomicUMin, 11AtomicOr, 3AtomicUMax, 3AtomicIAdd, all "expected Result Type to be integer scalar type". This PR changes the emitted DXIL of exactly those 39 programs and of no other. So the bug reaches well past the two programs seen in a world run, and the fix covers all of them.One caveat: the dxil-spirv command line (
--ssbo-uav --ssbo-srv --bindless) is not the exact option set vkd3d-proton uses in the game. It did reproduce the two in-game failures exactly.This looks like the remaining
0xc0000005crash in #144; I have put the numbers there too.A test. DaviTostes noted the diff has none. I wrote one in the style of the existing synthetic programs: a compute program that loads a 2D image UAV and then runs
image_atomic_uminon it in the same block, asserting that the image is annotated once as four floats and once as oneu32. Ond2a4baeit fails withthe atomic's annotation: [(d, ffffffff), (1002, 409)]; one55eb69it passes. It is one commit on top of this PR's head: #226. Take it into this PR or separately, whichever is easier.No game data is attached; the dumps stay on my disk.
AI-assisted (Hermes).
@tanishq-dubey on GitHub · 2026-11-24 01:45 UTC · original
Independent reproduction on RTX 5090 / NVIDIA 620.70.06, Wine 11.22 and vkd3d-proton 3.2.0: before an equivalent local cache-key fix, the captured
c12c1f7296419a5bSPIR-V failedspirv-val --target-env vulkan1.3withOpAtomicOr %floatand an isolated D3D12 pipeline probe exited with Wine reportingvkCreateComputePipelines/0xc0000005.After keying by both resource-property words, the corresponding generated SPIR-V passed
spirv-valand the title successfully created that host pipeline. A synthetic same-descriptor regression also fails before the fix (float annotation returned for an integer atomic) and passes after. The title later hit a separate null-write termination during world rendering; that run used one pipeline worker and shader dumps, so it is not a normal-performance comparison. No game files attached. AI-assisted.@ItsYusei99 on GitHub · 2026-11-24 02:03 UTC · original
Tested on a third card: RTX 4070, driver 620.70.06 (nvidia-open), Wine 11.22, vkd3d-proton 3.2.0 (Proton Experimental 11.0-20261112), Ryzen 7 9800X3D. Build:
main9aef3d9with this PR applied as a diff, Series X mode.vkCreateComputePipelines Exception 0xc0000005 in Unix call(5d113aa6830760b6, with one pipeline worker). Skipping hashes withVICTORY_SKIP_PIPELINESonly moved the crash tovkCreateGraphicsPipelines(5ad3a82b1c3cc63a, then15c34c906ac8b908). That matches the 26 pixel programs in the analysis on #144.NVRM: Xid 13 ... Graphics SM Warp Exception ... MMU Fault(class c9c0). The screen stays on the last frame, audio continues, and VIctory logs nothing after it. That is a separate problem from this PR.So this fixes the driver crash for me too. Related: #144.
@Ortomanic on GitHub · 2026-11-24 02:06 UTC · original
Thanks all for the independent reproductions on the RTX 4070/4080/5090 and for the package-wide numbers. I've added @gingertonik's regression test from #226 to this PR (cherry-picked with attribution as
ce945d6).cargo test -p victory-shader: 57 passed. Note that #48 contains the same key change, so whichever lands first, the other can drop it.@spidercraft on GitHub · 2026-11-24 04:35 UTC · original
Confirmed on a native Linux build (no Wine; vkd3d-proton, RTX 5090, NVIDIA 620.73): with this change
victory translate --pipelinesover the title's shader archive completes; without it the driver's compiler crashed on the floatOpAtomicUMax. #526 includes this PR's commits as they are.@x3ero0 on GitHub · 2026-11-24 08:03 UTC · original
Tested this on Linux (offline, not in the game) at
ce945d6b3513, cherry-picked ontomainatd2a4bae.Why it matters on Linux: under Wine/Proton the emitted DXIL goes through vkd3d-proton's
dxil-spirv. Onmain, an atomic on an image that is also read as float comes out as anOpAtomic*with a float result type, which SPIR-V validation rejects.Method:
victory translate shaders.rpf --listwithVICTORY_EMIT_DUMP, then every dumped container through standalonedxil-spirv --bindless --validate(upstream53aac41, 2026-11-23).mainThe 39 failures on
mainwere allAtomic{UMin,Or,UMax,IAdd}: expected Result Type to be integer scalar type(22, 11, 3 and 3).Side effects: exactly 39 emitted shaders differ from
main, the same 39 that were failing; the other 22,100 are byte-identical. The translator's refusal tallies are unchanged. The new unit test passes under Wine.Not covered: no in-game run (these shaders are not reached before a separate loading crash on my setup), and no check with Microsoft's validator or a Windows D3D12 driver.
@MrCloudy2 on GitHub · 2026-11-24 10:14 UTC · original
Confirmed on another NVIDIA card. This also fixes the
vkCreateComputePipelinesdriver crash from #144 for programa3d1a26ad0c8c2cd(one of the two #144 names), and the crash reproduces outside the title.Setup: RTX 3060 12 GB, driver 620.73.04, CachyOS (kernel 7.3), Proton-CachyOS 11.0 wine with vkd3d-proton 3.2.0 (from Proton Experimental), diag build cross-compiled with xwin, own 1.0.2.1 copy.
Standalone repro, no game run needed: that one container alone in a folder,
victory translate <folder> --pipelines --jobs 1under the same Wine.main8e79c80(+ #151 #190 #454 #493 #579):err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call, every time.spirv-val --target-env vulkan1.3on vkd3d-proton's dump (VKD3D_SHADER_DUMP_PATH) saysAtomicUMin: expected Result Type to be integer scalar type. This is the umin variant of theOpAtomicOr %floatdescribed here.props.1in the handle cache key; applied by hand, since the PR conflicts withmainright now): 1 compute pipeline created, and the dumped SPIR-V passesspirv-val.690e2883f9dd25d8and8bb272e763f76148, the other programs #144 names, build fine here on vkd3d-proton 3.2.0 with or without this change.In the title: world runs on this card died in the driver at the first world load without it, and get past that point with it.
AI-assisted (Claude Code); run and measured on the machine above.
@pablogonz12 on GitHub · 2026-11-24 10:57 UTC · original
Tested the fix on current
main(ffe310e). It still matters there, but the branch no longer merges cleanly (conflict inemit/lower.rs, base isd2a4bae). The core of it,props.1in thehandleskey (2 lines), applies by hand.Setup: RX 9070 XT, RADV (Mesa 26.3.1), CachyOS, GE-Proton11-14, vkd3d-proton master (
30b0eb9, dxil-spirv34f0ff8).What I ran: I dumped every console shader container the title translated in a run from boot into the world (751 programs: 373 compute, 139 pixel, 81 mesh, 77 vertex) and re-translated them offline with
victory_shader::emit::translate. Each DXIL went through dxil-spirv34f0ff8andspirv-val --target-env vulkan1.3.mainffe310eOpAtomicUMin/OpAtomicOrwith a float result)main+ the 2-line core of this PRNothing else changed: same translated count, and the other stages are unaffected. On
mainthose 5 are the world's pixel programs whose image atomic gets the cached float handle.deadkid14's note still applies to the test (optionsfield), so this probably needs a rebase ontomainrather than a merge.@Ortomanic on GitHub · 2026-11-24 11:07 UTC · original
Rebased onto current
main(ffe310e), so it merges cleanly again. Thanks @pablogonz12 for flagging the conflict and @deadkid14 for the test fix. The new test now builds against #189'sPartsand the 4-argumentresource::trackfrom #566.cargo test -p victory-shader: 97 passed. Thanks @MrCloudy2 and @x3ero0 for the extra NVIDIA/dxil-spirv confirmations.@dcastell1 on GitHub · 2026-11-24 11:25 UTC · original
Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build.
main@ffe310ebaseline on this box: 342 passed, 0 failed, 6 ignored. With this PR atb7300eb5applied clean:One more passing test than the baseline — keying heap handles by element type is exercised here and nothing else changes verdict. It also still applies cleanly to current main, unlike #185/#493 (noted in #340).
AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
@1ReallyLongName on GitHub · 2026-11-24 12:00 UTC · original
Confirmed on Ampere with the 595 driver branch (Linux, GE-Proton11-14): this change alone removes the compile crash. #259 was not needed on this driver.
Setup: RTX 3080 10 GB, NVIDIA 595.112.07 (proprietary), i9-12900K, Nobara 44 (kernel 7.3.1). GE-Proton11-14's Wine, vkd3d-proton and DXVK
dxgi. VIctoryffe310e, diagnostics build cross-compiled withcargo xwin(rustc 1.98.1). Series X, 1.0.2.1.Before, on
ffe310e:crashes.logentry 80–95 s into the world, in 5 of 5 runs with nothing skipped. WithWINEDEBUG=+sehthe fault is inlibnvidia-gpucomp.so(vialibnvidia-glvkspirv.so, thenwinevulkan.so).HostPipeline::new. It still crashed, so this is not a threading race, and each crash named one pipeline. Culprits included computea3d1a26ad0c8c2cdand5d113aa6830760b6, and graphics pipelines with pixel5ad3a82b1c3cc63a(4 runs). Bisecting with skips also pinned pixel387423b7209fa45cand mesh857b2e13c9cc107f.VICTORY_SKIP_PIPELINESonly moved the crash on to the next one.VKD3D_SHADER_DUMP_PATH: 2 of 175 SPIR-V modules failspirv-val --target-env vulkan1.3, withOpAtomicUMin %floatandOpAtomicOr %floaton anR32fstorage image. TheUMinone is computea3d1a26ad0c8c2cd.After,
ffe310ewithprops.1in thehandleskey (the same 2-line core as this PR, shader cache cleared):spirv-val.cargo test -p victory-shaderon Linux: 96 passed, 1 ignored.What's left on this machine after the fix (probably separate): late in the run, frames drop to 0.3–0.7 fps, with
preparing: copiesat 2.0–2.8 s per frame. The kernel logsNVRM: intermapRegisterDmaMapping: Failed to insert new mapping node for range …andnvAssertFailedNoLog … gpu_vaspace.cassertions. There is noXid(unlike the Xid 109 in #144 and #71), and about 2 GB of 10 GB VRAM is in use.AI-assisted (Claude Code): I ran the tests on my own hardware.
@dpalacios69 on GitHub · 2026-11-24 15:07 UTC · original
Independent check on Linux, merged onto current
main(ffe310e) in a scratch branch: textually clean,cargo test -p victory-shader --lockedpasses (97 passed, 0 failed, 1 ignored, the new test included),cargo clippy -p victory-shader --libhas no warnings.--all-targetsshows only the two unused-import warnings inemit/mod.rsthatmainalready has on Linux. No GPU run. AI-assisted; no game data.@deadkid14 on GitHub · 2026-11-24 07:18 UTC · original · edited 2026-11-24 17:51 UTC
Heads-up for merge order: with #189 also merged, this PR's new test
an_image_read_as_float_and_by_an_atomic_is_annotated_twiceno longer compiles. #189 adds anoptions: TranslateOptionsfield toParts, and the test'slower(&Parts { … })doesn't set it (E0063: missing field 'options').Adding
options: super::TranslateOptions::default(),afterprims: vec![],in that literal fixes it. That is the same default #189 uses in its own tests. Whichever of the two is merged second will need it.AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.
@brunofgmag on GitHub · 2026-11-24 23:26 UTC · original
This is still needed on the new
main(70564ae). There it now conflicts, and without it the title dies about 2 s after launch on an RTX 4080 under Proton Experimental (driver 620.73.04, CachyOS).The log shows nothing at default Wine debug settings. With
WINEDEBUG=+seh,+processthe cause is the one this PR describes: an access violation inlibnvidia-gpucomp.so +0x55a954insidevkCreateComputePipelines, thenvkCreateComputePipelines Exception 0xc0000005 in Unix callandNtTerminateProcesswith exit code 3 on every thread.I ported the change by hand onto
70564ae. The handle cache key inLowergets the element type as its sixth element, and the test fromb7300ebcomes along, withresource::tracknow taking the structure as its fourth argument. The test fails with the old key and passes with the new one, andcargo test -p victory-shader --libpasses (124 passed, 1 ignored). With the port, a 60 s run gets past the crash: frames are presented, and there are noerr:vulkanlines orlibnvidiafaults.Thanks to @Ortomanic for finding this and for the fix. A rebase onto the new
mainwould let it go in as it is.@Marvisak on GitHub · 2026-11-25 00:19 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-shader/src/emit/lower.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
@ruvenesh on GitHub · 2026-11-25 08:03 UTC · original
Test report: Linux + Proton on an RTX 3060 (Ampere, 32-lane), where this fixes 704 pixel and 6 compute pipelines the driver refuses on
main, with no regressions in a whole-archive census.Setup: Ubuntu-based host, NVIDIA RTX 3060 12 GB (Linux driver), GE-Proton11-14 (vkd3d-proton 3.2.x), VIctory diag builds cross-compiled for
x86_64-pc-windows-msvc. This PR's change merged ontomain(two small conflicts inlower.rs, resolved by keeping both sides).What fails on
main:victory translate shaders.rpf --list --pipelines --jobs 1onmain7ae5e17refuses 704 pixel pipelines withOut of memoryand 6 compute pipelines withCall failed; stderr hasNVVM compilation failed: 1for each. The cause is the one this PR names: a shader that reads a heap UAV texture (here, its dimensions) and does an image atomic on it in the same block gets the cached float-annotated handle for the atomic. dxil-spirv then emitsOpAtomicUMin/OpAtomicOr/OpAtomicIAddwith a float result type. Of the SPIR-V modules vkd3d-proton dumped for these programs, 618 failspirv-val --target-env vulkan1.3with "expected Result Type to be integer scalar type" (611 UMin, 5 IAdd, 2 Or), and NVIDIA's compiler rejects them, which vkd3d-proton reports asE_OUTOFMEMORY. (So on this path it is not the worker-stack problem of #966/#1129: a 64 MiB worker stack changes nothing here, A/B tested in the title.)With this PR:
main: all 704 pixel and all 6 compute pipelines are created; 0 programs changed for the worse (25,889 programs joined). The WaveSize-64 refusals (32-lane device) and the geometry-program refusals are unchanged, as expected.Out of memory13 → 0,Call failed2 → 0, vkd3dFailed to create Vulkan graphics pipeline, vr -1313 → 0. (The two runs are on slightly differentmaincommits,940d32fandccfb029; I compared counts and the failure type, not program by program.)Not done here:
cargo teston the merged tree (the PR's own test covers the key), and a Windows NVIDIA check — Windows compiles the DXIL directly, so this failure may not show there.No game data attached. AI-assisted (Claude Code).
@neonbyte1 on GitHub · 2026-11-25 08:15 UTC · original
Confirmed on an RTX 5090 under Wine + vkd3d-proton (GE-Proton11-14),
main940d32f: this is the crash at world load. Compute76c35de1c2444e67gets a R32f handle ([4100, 1033]) that itsimage_atomic_addreuses. dxil-spirv then emitsOpAtomicIAdd %float,spirv-valrejects it, and NVIDIA's driver faults invkCreateComputePipelines(0xc0000005). With an R32ui handle ([4100, 261]) the SPIR-V validates and the pipeline is created. Details and numbers are in #144.This branch conflicts with current
main(the page-table merge rewrotedescriptor_data). I have the same fix rebuilt on940d32fif a fresh PR is easier.AI-assisted (Claude); measured on my machine.
@andyeox-systemd on GitHub · 2026-11-25 19:00 UTC · original
Thanks @Ortomanic and @gingertonik. This fix was half of the NVIDIA crash in #144. I rebased it onto current
mainin #2723, with both of you credited as co-authors. Two things changed:mainaddedentry_handlesandjoin_handlessince this PR. They had the same float-or-atomic sharing, so I keyed them byprops.1as well. Without that, I still got an invalidAtomicOron NVIDIA.view_marks: falsefor the currentParts.If you'd prefer to update this PR instead, I'm happy to close mine.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.