d3d12: spill placed textures to host-cached memory, out of the BAR #575
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/575"
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?
Imported from brcly/TuxBox. Originally posted by NathansDomainSolutions on 2026-11-30T06:26:38Z.
Follows @Kayotic1337's finding on #292: on a resizable-BAR card, the "system memory" heap that residency spills placed textures into is
CUSTOM+WRITE_COMBINE+L0. vkd3d-proton places that in BAR memory (video memory), so the spill fills the BAR budget and vkd3d falls back. WithVKD3D_CONFIG=no_upload_hvv, which keeps it in host memory, their RX 9070 XT run had 0 fallbacks and got further than any other.Change: residency asks for a
CUSTOM+WRITE_BACK+L0heap first. vkd3d maps that to host-cached memory, which is never in the BAR, so this works without the globalno_upload_hvvswitch, and upload heaps keep their BAR placement. If the driver refuses that heap (no host-cached memory type its images can use), the first refusal is logged, and from then on residency uses the write-combined heap as before.TUXBOX_SPILL_WRITE_BACK=0keeps the old heap.GPU reads of the spilled textures go over PCIe either way. Host-cached memory is snooped, which can be a little slower than write-combined on some platforms. These are textures that didn't fit in VRAM, and the alternative is vkd3d falling back.
Checks: d3d12 builds, and clippy (
-D warnings) and fmt are clean. Not run on hardware yet: I'd welcome a run on a ReBAR card (AMD or NVIDIA) withTUXBOX_VRAM_RESERVE_MIB=4096to force spilling. Watch for the vkd3d fallback count and thehost-cached spill heaps refusedline.This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T09:39:11Z.
Thanks, this follows @Kayotic1337's finding on #292 neatly: it gets the effect of
no_upload_hvvfor the spill heap only, without the global switch.I'm holding it until it has run, because unlike an opt-in diagnostic it changes the default heap every spilled texture lands in. Before merging I'd like:
TUXBOX_VRAM_RESERVE_MIB=4096). Report vkd3d's fallback count with and without the change, and whetherhost-cached spill heaps refusedappears.CUSTOM+WRITE_BACK+L0differs between RADV and NVIDIA. If one of them refuses it, the log line and the fallback to the old heap are the part to check.@Kayotic1337, if you have your RX 9070 XT setup handy, you're the one best placed to confirm it.
Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-30T13:23:37Z.
i'm currently in school and dont have any remote access setup to that machine. i'll report back this evening
Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-30T17:43:28Z.
Ran #575 (
be15fac8) on an RX 9070 XT (1002:7550, RDNA 4, RADV, ReBAR, GE-Proton11-14), withTUXBOX_VRAM_RESERVE_MIB=4096and withoutno_upload_hvv. Run A hadTUXBOX_SPILL_WRITE_BACK=0. Run B used the new default. One run each. A was the first run on this build, so it was still translating shaders. B ran with a warm cache.host-cached spill heaps refusedVK_ERROR_DEVICE_LOSTRADV accepts the host-cached heap, but it doesn't change the fallback count. So #575 doesn't fix the fallbacks, as @JeffreyBytes predicted: the write-combined L0 spill already stays out of the BAR.
I followed up on #292 with two more runs (
log_memory_budgetplus one diagnostic log line). The fallbacks are TuxBox's own texture-upload staging buffers (placement/upload.rs, committedUPLOAD). They go over vkd3d's fixed ReBAR budget, and each refused request matches a staging create of exactly that size. Details and a correction of my earlier claim: https://github.com/brcly/TuxBox/issues/292#issuecomment-7286748306 So the fallbacks come from the staging path, not from the spill heap.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T19:12:46Z.
Thanks @Kayotic1337, that answers it: RADV accepts the host-cached heap, but the fallback count doesn't move (4 against 5), and your follow-up on #292 traces the fallbacks to the upload staging buffers in
placement/upload.rs, not the spill heap.@NathansDomainSolutions so I'm not merging this as it stands: it changes the default heap for every spilled texture without a measured gain. If you want to take the next step, the staging buffers are where the fallbacks come from (#292). A change that keeps those inside vkd3d's ReBAR budget, with a run showing the fallback count drop, would be welcome. It also needs a rebase on
main.Imported from brcly/TuxBox. Originally posted by NathansDomainSolutions on 2026-12-01T00:28:40Z.
Closing this one. Kayotic's run traced the fallbacks to the upload staging buffers, and #595 (merged) already keeps those out of vkd3d's ReBAR budget, so the spill-heap change would be redundant. Thanks both. (AI-assisted: Claude Code.)
Pull request closed