gpu: fix transient RT aliasing barriers, DiscardResource, and 64 KiB alignment #1994
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1994
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1994"
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?
@AndyLatimer on GitHub · 2026-11-29 06:17 UTC · original
AndyLatimer:fix/alias-rt-barriers-and-alignment→main· +844 −121 · 6 files · 1 commits · openFixes #1976
Summary
Fixes the physical-page transient RT aliasing hazards introduced in
6ba7fa8(stale tile compression/warm memory bleeding across passes, premature barriers inprelude(), and sub-64 KiB overlap):inplace::aliased_section_pages)start & 0xffff != 0instead of roundingstartdown, preventing tile 0 from aliasing onto an adjacent live resource's tail page.DiscardResourceordering (host.rs,alias_rt.rs,resource.rs)D3D12_RESOURCE_STATE_COMMONat creation (try_create) and across command list boundaries (HostList::aliased_rts_commonatHostList::close).if copy.aliased_rtaliasing & initial-transition loop fromHostList::prelude(), which previously activated overlapping later-pass targets before earlier passes finished reading the active alias.ListAliases) and physical(section, [start, end))tile extents (AliasExtent), retiring only genuinely overlapping active aliases toCOMMONbefore emittingAliasing(None -> tex)+DiscardResource(forALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL) on takeover. Disjoint MRTs and same-aliasRT -> SRV -> RTtransitions do not trigger false retirement/discard.OWNERS) inprelude()so cross-list takeovers emitAliasing+DiscardResourcein exact queue submission order while incremental multi-list rendering of the same RT is preserved untouched.HostList::transition_and_record's prior-state return contract fortexture::aliasand updatetwo_queues::probeforStateBook.alias_rt.rs)texture.GetDesc()afterCreateReservedResource(handlesMipLevels == 0), verifynum_sub == subresource_count,NumStandardMips + NumPackedMips == mips, and full subresource tile coverage before mapping, retain strong Tier-2ID3D12Heaprefs insideAliasExtent, and retire removed section heaps asynchronously insection_gone.Verification
cargo test --release -p victory-gpu --locked --lib -- alias_rt inplace: 14 passed, 0 failed (unit tests for 64 KiB start alignment,ExtentRangescoalescing/overlap, intra-listListAliasesMRT/takeover tracking, cross-listOwnerTabletracking, and a real D3D12 Tier-2 reserved RT aliasing +DiscardResourcereadback test on RTX 3060 Ti).cargo clippy -p victory-gpu --all-targets --lockedand--all-features: 0 warnings/errors in all 6 modified files.cargo build --release -p victory --locked: passed (exit code 0).cargo test -p xtask --locked: 0 asset-policy issues in all 6 modified files (pre-existinglower.rssize violation onmainuntouched).@MagroDaniel on GitHub · 2026-11-29 14:17 UTC · original
Tested this PR on hardware: the coloured blocky glass corruption from #2233 is still there with it.
Build: v2026.11.29.01 (
829188e9) plus this PR, cherry-picked. It conflicted with the release'sListAliasTracker/OwnerTablerework (4d98ca87). I took this PR's wholealias_rt.rs, removed the oldalias_trackerfield fromHostList, and movedlet detiles = self.deferred().detiles.clone();back to the top ofprelude(). Built with #2392, #2261, #2265 and #2421 too.cargo test -p victory-gpu aliaspasses 10/10, andvictory-shaderpasses 468/468.System: RTX 3070 8 GB, driver 610.88, Windows 11 26200. Series S, DLSS Ultra Performance, FG off, RT off, warm cache.
Result in the prologue window shot (the same frame every time):
saved_mbaliased_rts=100 virtual_mb=39 physical_mb=248)VICTORY_ALIAS_TARGETS=0So with this PR only about 100 targets alias, presumably because the 64 KiB start alignment rejects the rest. The pool then costs more than it saves on Series S, and the corruption remains. It seems to come from something other than the barrier/Discard ordering, such as reading another alias's pages with a different format through the undefined swizzle.
For Series S, an opt-in default as in #2042 looks safer until this is understood.
@xteral67 on GitHub · 2026-12-01 08:59 UTC · original
Tested a smaller take on the same problem on current main (
5fabb46e): commit 37afe344 on xteral67/VIctory-NVIDIA, branchalias-discard(alias_rt.rsandhost.rsonly).DiscardResourcein its RT/DS/UAV state, then back. A partial takeover gets the barrier only.RTX 3080 Ti 12 GB, driver 621.40, Series X profile, 1440p, DLSS quality, FSR 3 FG 2x,
VICTORY_ALIAS_TARGETS=1, ~8 min of town driving plus walking at night: render targets 2,030 → 1,345 MB (logsaved_mb=524), card use in town 10.1–10.6 → 9.4–10.8 GB, no artifacts seen. Not checked on Series S, where the coloured glass blocks above were seen.cargo testwas not run.@xteral67 on GitHub · 2026-12-01 13:59 UTC · original
Correction to my earlier comment: the discard fix is not enough. On a night scene over water and in shadows under street lights, aliased targets still show coloured noise and dark blocks, with or without the discards. A census of the aliased targets shows the title reads, every frame, pages that another target of a different size or format wrote last (for example a 853x480 target over a 1706x960 one of the same format). The console reads those bytes in its own layout; the host's 64 KiB undefined-swizzle layouts differ, so the reader gets garbage. Giving such readers their own memory made it worse, because some of those reads are deliberate reinterpretations. With VICTORY_ALIAS_TARGETS=0 the same scenes are clean. So aliasing needs a layout-aware copy for cross-shape reads, not only barriers and discards.
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.