Shaders: scalar buffer loads from a UAV read it raw #1055
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!1055
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1055"
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?
@adamdotpy on GitHub · 2026-11-24 15:20 UTC · original
adamdotpy:shader/smem-uav-raw→main· +28 −2 · 2 files · 1 commits · openWhat
Lower::smemreads a scalar buffer load (s_buffer_load_dword*) through a raw handle when the descriptor's range is an SRV. Any other kind took the constant-buffer path (handle(.., (13, 0x1_0000)), thencbufferLoadLegacy), a table's UAV included. That is a CBV handle at the heap index where the host has a UAV.A scalar buffer load from a UAV now reads it raw. It uses a handle with UAV properties
(11 | 0x1000, 0), which is how a raw SRV is read here and how vector buffer accesses read a UAV, so all of a load site's accesses share one handle. Root UAVs are unchanged; they are still refused with "a root UAV or typed root view".Why
Reading a UAV through a CBV handle removes the device. On
main(ffe310e) withVICTORY_WARP=1, the test below fails with "The GPU device instance has been suspended". I did not run the unfixed program on hardware, because it is undefined behaviour there.How often the title does this is unknown. A translation census can't show it, since these programs translate. Any program that does would remove the device, so this may be one cause of device-removal reports such as #653.
Related: #1015 fixes the neighbouring case, a heap descriptor with no listed kind that vector loads also read. This PR covers a descriptor whose listed kind is a UAV. The two touch the same lines of
smem, so whichever lands second needs a small rebase.Test
scalar_buffer_loads_read_a_uav_through_its_table(emit/valu_tests.rs) usesbuild_valu_cs, whose output UAV is a raw UAV in a table. The program:s_buffer_load_dword;The test removed the WARP device before this change. With the change it passes on an RTX 4060 Ti and on WARP.
Checks
cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored. The GPU tests ran on an RTX 4060 Ti and WARP, with no "skipped" lines.cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: clean.cargo xtask policy: ok.No title data was used.
🤖 Generated with Claude Code
@ThomasHFWright on GitHub · 2026-11-24 15:29 UTC · original
Independent Linux/Wine validation of
21d1b4682735b59a2742b6cf4696716e07e04d99, based onffe310e. The newscalar_buffer_loads_read_a_uav_through_its_tableregression passes: both patterns (0x12345678,0xDEADBEEF) survive the UAV store/scalar-load/readback path. I did not run the unfixed device-removal case on hardware.Full workspace unit/integration suite, all features, all 14 generated Windows MSVC test executables:
ffe310ebaselineThe five failures match baseline: empty pipeline library (#347), missing Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask attempting to launch host Git. Native Linux shader tests separately pass 96 / 0 / 1, xtask 4 / 0 / 0, and asset policy passes. Windows-target workspace Clippy with all targets/features and
-D warningspasses.Environment: Rust 1.98.1, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton
30b0eb9bc12dc9f; natived3dcompiler_47supplied for GPU fixtures, identical runtime DLLs to baseline. Both requested device paths in the new test completed, but this Wine/DXVK setup is not genuine Windows WARP coverage. Optionaldxil.dllvalidation was unavailable; GPU pipeline creation and dispatch/readback executed.Offline and offscreen, no game data or gameplay. No native Windows or Wine doctests. Aggregate counts include existing early-return tests without optional console compilers or the DXIL validator; the new regression executed. AI-assisted testing with Codex.
@adamdotpy on GitHub · 2026-11-24 16:02 UTC · original
Thanks — that is the second independent environment (Wine 11.22, RTX 5090, vkd3d-proton) on this branch, and the 342/5/6 line matches the baseline failures one for one, so the fix costs nothing elsewhere.
One thing would close this completely, and it is the half you flagged: the red side. The test asserts the load succeeds; the bug it fixes is the device, so the evidence that matters is that the same program on unfixed
ffe310eeither removes the device or reads back the wrong dword. If your harness can run the regression against the base commit once and paste the failure, the PR stops needing anyone to take the mechanism on trust. If the unfixed path is hard to reach there (device removal is the expected symptom, not a clean assertion), say so and I will leave it — the mechanism is written out in the commit message either way.@shortselow-byte on GitHub · 2026-11-24 16:08 UTC · original
This PR has no CI run yet, so I ran the CI's checks at head
21d1b46(onmainffe310e) natively on Windows with an AMD GPU, to complement the Linux/Wine run above: Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2).cargo test --workspace --locked -- --test-threads=1: 343 passed, 0 failed, includingscalar_buffer_loads_read_a_uav_through_its_table(AMD device and WARP).cargo clippy --workspace --all-targets --locked -- -D warnings, and with--all-features: clean.cargo xtask policy: ok.Like you, I did not run the unfixed program on the hardware device.
@adamdotpy on GitHub · 2026-11-24 16:19 UTC · original
Thanks — that is the native-Windows/AMD half of the evidence the Wine run could not give, and it matches the other two environments (343 passed / 0 failed with the new regression, clippy and
xtask policyclean). Nothing further needed from us on this branch; the only open item anywhere here is whether the unfixed program can be made to fail on a hardware device, and both testers have said the same thing — that it is the device-removal symptom rather than a clean assertion, so I will leave it as it stands rather than ask a third person to chase it.@Zipettte on GitHub · 2026-11-24 16:30 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
21d1b46:cargo test -p victory-shaderpasses, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@adamdotpy on GitHub · 2026-11-24 17:10 UTC · original
Thanks for the RDNA3 run @Zipettte — 121 passed / 0 failed at
21d1b46with the workspace baseline green on main noted, that's the fourth independent validation of this branch (Wine + RDNA3 hardware here, RX 7900 XT by jtrudeau1530 earlier). Nothing actionable in the report.@MamaLeVrai on GitHub · 2026-11-24 17:23 UTC · original
Heads-up: this PR and #1015 both change the raw-view choice for a scalar buffer load of a descriptor in
emit/lower.rsand conflict with each other. The resolution (SRV range reads a raw SRV view, UAV range a raw UAV view, descriptor of no listed kind the heap buffer view) is in the bundle #1319, with both PRs' tests kept; clippy and tests pass on it. AI-assisted (Claude Code); no game data.@Marvisak on GitHub · 2026-11-25 00:32 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,crates/victory-shader/src/emit/valu_tests.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
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.