RDNA2: keep the 2 GB aperture segment from filling (device loss at world load) #127
No reviewers
Labels
No labels
accessibility
bench-bm-v1
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/PastiiJay--klbf-lab!127
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-127"
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?
@MalarkZA on GitHub · 2026-11-27 13:43 UTC · original
MalarkZA:fix/rdna2-aperture-segment→beta-amd· +337 −78 · 5 files · 7 commits · openWhat
On RDNA2 cards, with submissions sent ahead (
VICTORY_RELAY=1/2, theplay.ps1default), the host device is removed at the first world load, ~40-51 s in:
0x887A0007, no work in flight (DRED breadcrumbs empty,"nothing of ours was running on the card"); with the debug layer on:
"Kernel memory failure. There might be a memory leak." (id 834).
Reproduced here on an RX 6900 XT (driver 32.0.21045.29003, Win11 26300) in
every relayed run; upstream reports match on RX 6700 XT / 6800 / 6950 XT
(kyokyotosh/VIctory-6700XT FINDINGS-6700XT.md; avatarmanz/VIctory-7900XTX #394, #289).
Why (GPU ETW trace, FINDINGS-6700XT.md)
The video memory manager's 2 GB aperture segment holds the driver's command
buffers (1 MB + 64 KB per D3D12 command list), upload scratch and the
D3D12_HEAP_TYPE_CUSTOMwrite-back buffers.land()kept the newest 64flights' finished lists (up to ~716 host lists) and every host list carried
its own prelude for life (~950 preludes, ~1 MB of the segment each). Live
lists climbed to ~1,150-1,250 at the world load, the segment ran full,
ReserveResourcefailed and the kernel scheduler marked the device faulted.No GPU hang, no page fault, no timed-out packet.
What this PR does
Four commits cherry-picked from kyokyotosh/VIctory-6700XT
(
f173347,018d372,e3c0703,63a773e), kept attributed:waits the bury lag through
retire.D3DKMTQueryStatisticsand saidonce at the start; while an aperture segment holds more than
VICTORY_SEGMENT_TIGHTpercent (85; 0: never) of its limit, flights sentahead land first.
idle host lists trimmed to 64 (on at 80%, off at 70%).
transitions, given back at its reset (128 kept idle, 16 while the segment
is tight).
Two follow-ups for this tree:
trim_idlematches our three-fieldIdle(the picked pattern predatesthe retire timestamp our
list.rshas).PreludeSlotmechanism andVICTORY_MAX_PRELUDESgo withthe pool that replaces them (the prelude-pool pick left them orphaned here;
scripts/play-3070.ps1capped them at 32 - see note below).Measured (RX 6900 XT, Series X, diag build, this PR's base + relay on)
VICTORY_RELAY=20x887A0007, nothing in flight)VICTORY_RELAY=0(the workaround) also survives, at 7-8 fps. Upstream: RX 6700XT 8.8-12.6 fps at relay 2 with zero removals in 10+ min; RX 6950 XT 18.1 fps
same.
CI notes (diffed against the base; the branch carries pre-existing debt)
cargo clippy -D warnings, plain and--all-features: this PR adds zeronew findings (114 pre-existing on the base, unchanged).
cargo test --workspace: identical to the base (4 pre-existingvictory-gpu lib failures: hlehooks, indirect x2, descriptor).
xtask::repository_passes_policy): zero new violations fromthis PR (pre-existing:
klbf-lab.ico/.rc,klbf_card.png,shader_cache.rs,tools/patches/*.patch,tools/ghidra-scripts/*).Note for the 3070 setup:
VICTORY_MAX_PRELUDES=32no longer exists - thenew pool is capped in code at 128 idle / 16 tight. If the 12 GB 3070's smaller
segment needs a lower cap, that is a follow-up (a pool-shaped knob).
@HandshakeHackin on GitHub · 2026-11-27 13:56 UTC · original
One boundary case in
segments::tightaffects adapters reporting multiple aperture segments. With 80,001/100,000 bytes resident in the first and 160,000/200,000 in the second, both sort to 800 per thousand. The second wins the tie, so back-off stays off even though the first exceeds 80%. Reversing the segments changes the decision. The same case applies at the 70% release threshold.Patch and two regression tests compare the fractions exactly. The segment source is identical on
rdna2-testateb6feb8and this PR at3c825b3. On Windows both tests passed with the patch. Restoring the rounded comparison failed the ordering test. This uses synthetic segment readings. Windows test log@PastiiJay on GitHub · 2026-11-27 14:04 UTC · original
Thanks @MalarkZA, a careful write-up with DRED and debug-layer evidence, and @HandshakeHackin, good catch on the tie in
segments::tight. On the AMD line we port changes ourselves with an A/B bench rather than merging, so this one goes to our list next to the kyokyotosh fix already onrdna2-test, and you'll be credited. Next step: could you fold966c562into the PR and attach the console of one relayed run that reaches the world with it?@HandshakeHackin on GitHub · 2026-11-27 14:17 UTC · original
I applied the threshold fix to your exact
3c825b3head. The combined commitd61c030is one commit ahead of this PR and can be fast-forwarded onto the author branch. Both aperture tests passed on that tree and the Windows diagnostic build compiled. Build and test logI have no physical Radeon attached here. The remaining check is the console from a relayed world-load run on this combined revision.
@MalarkZA on GitHub · 2026-11-27 14:37 UTC · original
Folded in: the PR head is now
d61c030(HandshakeHackin's exact-fraction fix + both regression tests, which pass locally on Windows).Relayed world-load run on
d61c030, RX 6900 XT, diag build, defaultplay.ps1(VICTORY_RELAY=2,exact=true), console attached:Note: the early log line "RDNA 2 adapter: VICTORY_RELAY defaults to 0" is printed for any RDNA 2 card, but
play.ps1's explicitVICTORY_RELAY=2overrides it, and the relay lines confirm the relay was on.pr127-d61c030-rx6900xt-relay2-console.txt
@PastiiJay on GitHub · 2026-11-27 14:47 UTC · original
Thanks @MalarkZA, 3.5 minutes in the world on relay 2 with no device removal, past the old 40-50 s point, is the result we were hoping for. The note about the RDNA 2 log line is useful too. We'll port it onto the AMD line ourselves, crediting you and HandshakeHackin. Next step, if you have the time: a longer relayed session (10 min or more, with some driving) so we can see whether the back-off ever fires.
@MalarkZA on GitHub · 2026-11-27 15:00 UTC · original
Longer relayed session on the same
d61c030, RX 6900 XT, diag build, defaultplay.ps1(VICTORY_RELAY=2), console attached:pr127-d61c030-rx6900xt-relay2-17min-console.txt
@PastiiJay on GitHub · 2026-11-27 15:06 UTC · original
Thanks @MalarkZA, 17 minutes on relay 2 with no device loss is the proof we needed, and noting that the old build died around the same list count you now hold is a nice touch. That's enough for us to start the port. One last thing whenever convenient: a BM-v1 run on
d61c030, so the fix gets an RX 6000 row on the board.@MalarkZA on GitHub · 2026-11-27 18:16 UTC · original
Created #131 to record the BM-v1 run card as per the docs
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.