GPU: drop the unordered-access permission a format cannot carry, before any call names it #1832
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!1832
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1832"
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?
@fiestorra on GitHub · 2026-11-24 23:08 UTC · original
fiestorra:gpu/drop-uav-on-formats-that-cannot→main· +132 −0 · 1 files · 1 commits · openThe device removal comes from a description we hand the host, and it is measured: with this, three runs in a row do not remove the device
After installing the debug layer on a machine that has the failure, the message that ends the device is this one and only this one:
Two things make it fatal where a creation ladder would not help:
GetResourceAllocationInfo, a query we make before creating anything, so any retry ofCreateCommittedResource— including the ladder in #1630 — happens after the device is already going;severity=1means it does not come back as a return code.The change
host_desc— the one place a title description becomes a host description — now asks the host whether the format can be a typed unordered access view (CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT),Support2 & (UAV_TYPED_LOAD | UAV_TYPED_STORE)), caches the answer per format, and dropsALLOW_UNORDERED_ACCESSwhen the answer is no, once per format, with a warning naming the format:The answer is tri-state on purpose: when the host cannot be asked, the description is left exactly as the title wrote it. Dropping a permission that was legal would lose a texture's writes silently, which is worse than the bug.
Verification, on the machine that removes the device
Same setup each time:
mainat70564aeplus this change, release, empty cache, real window (3840×2160), debug layer on or off as noted, default adapter (AMD Radeon(TM) Graphics, driver32.0.21045.29003), session 1.id=599mainmain+ this, run 1main+ this, run 2main+ this, run 3The rule fires twice per run (
format=27andformat=86), and the run continues past the point it used to die.cargo test -p victory-gpu --locked→ 78 passed, 2 ignored.typed_uav_follows_the_format_not_the_request: prints the host's answer per format and asserts the rule (the permission follows the answer) rather than a hard-coded table.cargo clippy --workspace --all-targets --locked -- -D warningsand with--all-features→ clean;rustfmt --checkonresource.rs→ 15 hunks, the same asmain.cargo test --workspace --locked: the one failuremainhas in a headless session (sdr_and_display_deferrals, fixed by #1630), unrelated.What I am not claiming
no host texturefor theB4G4R4A4_UNORM1440p target (that is #1630's ladder) and the view heap capped at 1,000,000 with 310,720 slots past it (#1760) are both still in the log after this change. They no longer remove the device; they still cost the frame.No game data is involved: a description, a format number, warnings and counts only.
Written with an AI assistant.
@upipibi on GitHub · 2026-11-24 23:11 UTC · original
Overlap for the reviewers: #1787 (22:33) also drops
UNORDEREDfrom a texture's host description inresource.rswhen the host can't store the format (host_unordered_format), for the sameB5G5R5A1_UNORMdevice removal. #1763, #1775, #1780 and #1801 handle the view side indescriptor/host.rs. This PR and #1787 edit the sameresource.rspath, so one of the two is enough. From reading the file lists and descriptions; nothing built.AI-assisted (Claude Code).
@fiestorra on GitHub · 2026-11-24 23:16 UTC · original
Tested against the real failure, and against the other two candidates: it is one of three causes
With the debug layer installed on a machine that reproduces the removal, the same scenario (session 1, window 3840×2160, empty cache, default adapter
AMD Radeon(TM) Graphics, driver32.0.21045.29003):id=599id=1419main70564aeSo on this machine this change alone is enough to stop the removal, while the texture ladder alone is not — it removes the
no host textureline and then uncovers a second rule violation (id 1419, the sampler heap) that was previously invisible because the run died at 599 first.That is worth saying in the pull request rather than in a later comment: a reviewer testing only this change on an NVIDIA card may see the removal go away and a different one appear later, and it is the id 1419 of #1778 in that case.
Full write-up with the chain: #1754
Still in the log with all three, and a different problem:
host view heap capped at 1000000and 310,720title slot past the host heap(#1760). No removal on this machine, still costing frames.No game data is involved.
Written with an AI assistant.
@fiestorra on GitHub · 2026-11-24 23:41 UTC · original
Correction to my own measurements: those runs were on the RTX 4090, not on the integrated GPU
I have been writing "default adapter, integrated
AMD Radeon(TM) Graphics, driver32.0.21045.29003" on the runs I made in session 1. That attribution is wrong, and the cause is worth knowing because it is the exact trap this repository keeps warning about.DXGI enumerates the adapters in a different order in the two sessions. Measured on this machine, same binary, same moment, with
cargo test --release -p victory-gpu -- --ignored adapters:So the default adapter is the integrated AMD in the agent's session and the RTX 4090 in the session where the title runs, which is precisely where every number I published in the last few rounds came from. With my selector in place the run says it plainly:
—
index=1is the AMD in session 1, the reverse of session 0, which is what made me notice.What this changes, and what it does not:
32.0.16.2124), not on the integrated GPU — which is the same vendor as the machines in #1754, #1755, #1758 and #1760. The chain in #1754 is NVIDIA evidence, not AMD evidence.B5G5R5A1_UNORM), the title in session 1 (RTX 4090, which does not). There was never a discrepancy — different device, different answer.32.0.21045.29003for a session-1 run should read32.0.16.2124(NVIDIA GeForce RTX 4090). I will put this note on the threads where the numbers were used rather than editing old comments, so the record keeps both.VICTORY_D3D12_ADAPTERis session-dependent, and a name substring is not. UseVICTORY_D3D12_ADAPTER=nvidiaor=amd, and check thehost GPU adapter=line rather than assuming which card the default is.No game data is involved: adapter descriptions, vendor ids and memory sizes only.
Written with an AI assistant.
@fiestorra on GitHub · 2026-11-24 23:47 UTC · original
On the card that refuses it:
maindies at frame 64 with id 599, this branch reaches frame 256 with noneRe-ran the comparison on the RTX 4090 (driver
32.0.16.2124) with the D3D12 debug layer on, since that is the adapter where the rule fires — the integrated AMD here accepts the same description, which is why an AMD-only test cannot judge this. Session 1, real window 3840×2160, empty cache,diagbuild withVICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1:main70564aeid=599(ALLOW_UNORDERED_ACCESSon aB5G5R5A1_UNORMtexture, inGetResourceAllocationInfo)id=1419draws=line)draws=1636, still presentingdropping unordered accessSo on the NVIDIA card the change does exactly what it claims: the description is made without a permission the format cannot carry, before any device call names it, and the device survives.
The log line from
mainfor the record, with the driver's own wording:Why this cannot be fixed where the rest of the texture work happens: the message is raised by a query (
GetResourceAllocationInfo), three calls before anything is created, so a retry ladder aroundCreateCommittedResource— including the one in #1630 — never gets to run. Andseverity=1means it is not returned as anHRESULT.Also worth saying plainly, because it decides how the fix should be judged: on this machine's integrated AMD the same
mainbuild shows no id 599, no cap and no removal, and ran 1,024 frames / 6,656 draws in the same 40 s (#1754). The failure is the NVIDIA driver's answer, so a reviewer with only an AMD card will see nothing here — the card to test this on is the one that refuses.Still in the log after this change, and deliberately not touched: the capped view heap (
host view heap capped at 1000000, 310,720 slots past it — #1760/#1779) and oneno host texture(#1630). They no longer remove the device; they still cost the frame.Verification of the branch:
cargo test -p victory-gpu --locked78 passed / 2 ignored, the ignored GPU testtyped_uav_follows_the_format_not_the_requestpassing,clippy --workspace --all-targets --all-features -D warningsclean,rustfmt --checkonresource.rsat the same 15 hunks asmain.No game data is involved: a format number, debug-layer ids, warnings and counts only.
Written with an AI assistant.
@fiestorra on GitHub · 2026-11-24 23:50 UTC · original
The 120-second run: frame 2,048,
draws=13312,dispatches=1024, still no removalShort follow-up to the table above, because 40 seconds does not prove the device stays: same card (RTX 4090, driver
32.0.16.2124), samediagbuild with the debug layer and DRED on, session 1, empty cache, but for 120 s:versus
mainon the same card, which ends at frame 64 with id 599 and a removed device. So the skip is not a postponement: nothing else trips the layer in two minutes, and the draw and dispatch counters keep climbing.That also fixes what the frame does to the card's load: 2,048 frames and 13,312 draws in two minutes means it is not sitting in a corner avoiding the texture that used to kill it.
Nothing else changed in the branch; the verification in the comment above still holds.
Written with an AI assistant.
@fiestorra on GitHub · 2026-11-25 01:54 UTC · original
Measured both bit choices on the cards where this matters: they agree, so the queue has two pull requests for one fix
I ran the two format-support tests side by side on the RTX 4090 (driver
32.0.16.2124, session 1 — the adapter that refuses this format) and on the integrated AMD of the same machine (32.0.21045.29003, session 0):Support1TYPED_UAV(0x100000)Support20xc0)B5G5R5A1_UNORM0xe4d3f00x200R8G8B8A8_UNORM0x33fcd3f30x102c0R32_FLOAT0x6f4d7fb0x2c8B8G8R8A8_UNORM_SRGB0x1010f00x200So for the format this is about,
Support1 & TYPED_UNORDERED_ACCESS_VIEW(#1926) andSupport2 & (UAV_TYPED_LOAD | UAV_TYPED_STORE)(#1832, mine) give the same answer, and the one format where they differ — the sRGB one — never reaches the check:host_descmaps sRGB with the unordered-access permission to its UNORM family before it, which is why the pair disagrees there harmlessly.Two consequences, and the second is the one worth acting on:
Support1is the flag the D3D12 documentation points at;Support2's typed load/store is what a shader actually does. On these two drivers they agree on the formats the title uses, and the sRGB case shows they will not always.host_descdrops the permission, tri-state when the host cannot be asked, measured on the 4090 — noGetResourceAllocationInforefusal, no removal, 2,048 frames in 120 s) and #1926 (+214/−34 across nine files, which also carries CPU, pipeline and manifest changes). A maintainer should only have to review one of them.I am not precious about which. Mine is smaller and was measured on the card that fails; yours is the one that reads the documented flag and additionally refuses the unsupported view at creation, which is a real improvement over dropping the permission alone. If you want yours in, say so and I close mine — I would only ask that the tri-state behaviour be kept: when the host cannot be asked, the description should stay as the title wrote it, because dropping a permission that was legal loses a texture's writes silently.
If it is easier the other way round, mine is
MERGEABLE/CLEANwith a green check today and yours is too, so it is a choice and not a queue problem.No game data is involved: formats, support masks and counts.
Written with an AI assistant.
@SamuelGDMG on GitHub · 2026-11-25 02:38 UTC · original
Tested this fix locally and it's working — it resolves the
0x887A0001(DXGI_ERROR_INVALID_CALL) device removal onB5G5R5A1_UNORMand gets past the crash cleanly.Specs: Windows 11 (10.0.26200), Ryzen 5 5500, RTX 3050 8 GB, driver 610.88. Running
diagbuild on 940d32f withVICTORY_D3D12_DEBUG=1, andVICTORY_D3D12_DRED=1(Series 1.0.2.1, 0 missing imports).Written with an AI assistant.
@fiestorra on GitHub · 2026-11-25 04:14 UTC · original
Merge check: the three GPU fixes together keep the suites where
mainhas themNobody can run this from CI, so I did it here:
main940d32fwith #1630, #1832 and #1778 merged into one tree (they touchresource.rs, the descriptor heap and the shader cache, and they do not conflict), then the tests and a boot.mainalonecargo test --workspace --lockedcargo test -p victory-shader --locked --libcargo test -p victory-gpu --features diagnostics --lib32.0.16.2124, session 1The one failure in both columns is
victory-hle::modules::lifecycle::tests::showing_a_title_window_shows_its_stand_in, which fails onmaintoo in a session without a desktop — it is the agent's environment, not the change.The GPU suite gained two tests and four skips because those are the tests the three pull requests add (the ladder's attempts, the typed-UAV rule, the sampler fallback), and some of them skip without a host. That is why the counts differ and why they are written out instead of "all green".
So, for a reviewer deciding whether these can go in together: they do not regress the suites, and together they change what a boot does — which is the only reason to merge them as a set rather than one at a time.
What this check does not cover: it says nothing about the title beyond those 120 seconds, and the run still stops at the terms-of-service screen, which is not a GPU matter. It also does not cover other people's fixes: the cap (#1779) is untouched here and still logs
host view heap capped at 1000000once per run.No game data is involved: test counts and frame numbers.
Written with an AI assistant.
@Marvisak on GitHub · 2026-11-25 06:18 UTC · original
Automated triage for the maintainers.
Needs work.
host_descincrates/victory-gpu/src/resource.rsdropsALLOW_UNORDERED_ACCESSwhentyped_uav(d.format)(Support2typed load/store) is false for the texture's own format. Issues:castable(format), and forB5G5R5A1_UNORM(86) that list includesR16_UINT/R16_FLOAT, which take typed UAVs. With the flag dropped,fitsindescriptor/host.rsrefuses all unordered views of the texture, including those 16-bit aliases. The check needs to consider the castable formats the texture is actually created with.typed_uavalso asks about typeless formats (for example 27 in the test). If a driver reports no typed-UAV support for a typeless format, its textures lose UAV access, even though every UAV view of them is typed. #1787 exempts typeless formats explicitly.CreateUnorderedAccessView(id 342), which #1763 (merge candidate) refuses. A log showing removal at resource creation with #1763 applied would show this is still needed.#1787 overlaps this change. One of the two should carry it forward.
CI:
checkpassing.Generated by Claude Code
@KainanP on GitHub · 2026-11-25 19:35 UTC · original
RTX 4060 Laptop (610.47), merged onto main
13f91caewith a reproduction test: B5G5R5A1 UAV half fixed (flag dropped, UAVs null so stores are lost), B4G4R4A4 target half still removes the device; no new failures incargo test -p victory-gpu; also fixes the UAV half on Intel UHD, where main gets no host texture. Details and the side-by-side table with the other #1753 PRs: #1753. Tested with the help of an AI assistant (Claude Code).f1e53b8758to1a2057a3e1@catminou4 on GitHub · 2026-11-24 23:47 UTC · original · reviewed
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Drop the unordered-access permission a format cannot carry: fourth leg of the host-capability gating (#1775/#1787/#1801/#1843) — keep them consistent.
@fiestorra on GitHub · 2026-11-26 12:18 UTC · original
The rule now covers the formats a texture can cast to, and the typeless case with it
All three points are in, in
host_desc(crates/victory-gpu/src/resource.rs), head1a2057a3:uav_of_elementaskstyped_uavacrosscastable(format)and the format itself, and returnsSome(true)on the first that answers yes, so a texture that legal casts to a UAV format keeps its flag — exactly the case the old rule lost.castablereturns them), and the answer is the same for the typeless spelling and its family;a_typeless_format_is_judged_by_the_formats_it_casts_topins that with 27, 24 and 16.CreateTexturerather thanCreateUnorderedAccessView. If #1763 lands first, this change is a guard that never fires and I would rather close it than keep a second way to drop the flag; say so and I will.the_permission_follows_the_whole_elementchecks that 115 and 86 — both two bytes a texel, and castable to each other — get the same answer, which is the property the old unconditional test asserted for one spelling only.CI: passing locally (
cargo test -p victory-gpu --lib -- resource::tests, 20 passed; clippy-D warnings). The pushed branch was rebased onto842b0cb7first, so it no longer carries the stalepc_formatreverts the earlier head had.Written with an AI assistant.
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.