rebar: pool GPU_UPLOAD heaps, direct ReBAR uploads, and configurable large-BAR caps #689
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!689
Loading…
Reference in a new issue
No description provided.
Delete branch "Canigia/Darner:pr/rebar-gpu-upload-pool"
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?
Contributor role (optional)
What it changes
post-merge: On 24 GB Resizable BAR GPUs (RTX 3090, 23.55 GiB DXGI budget), three hardcoded caps and unpooledGPU_UPLOADallocations leave large amounts of VRAM unused while spilling buffers and staging to system RAM:WINDOW_MAPPED_MOSTincrates/darner-gpu/src/shadow.rsis hardcoded to4096 MiB: in gameplay telemetry (cardledger),window-mappedhits4092 MiBand spills3,286 MiB(530windows) out of ReBAR into non-mapped copies, even with ~11 GiB of VRAM still free.CARD_MOSTincrates/darner-gpu/src/shadow.rsis hardcoded to1024 MiB: in higher-demand profilesbuffer-copyreaches935+ MiBagainst the 1 GiB cap.Host::card_mapped_buffer_asincrates/darner-gpu/src/host.rscallsCreateCommittedResourcefor every non-UAVGPU_UPLOADbuffer (list scratch chunks, bind tables, etc.), bypassing the 128 MiB placed-buffer heap pool incrates/darner-gpu/src/heaps.rs.Host::upload_bufferalways allocates fromD3D12_HEAP_TYPE_UPLOAD(system RAM) even on large-BAR GPUs with abundant VRAM headroom.What this PR does (keeping Darner's write-watch guards and shader-write copy-back completely intact — zero coherency regressions):
crates/darner-gpu/src/heaps.rs: AddsKind::GpuUpload(D3D12_HEAP_TYPE_GPU_UPLOAD, accounted underhostmem::Place::Card) to the 128 MiB placed-buffer heap suballocator.crates/darner-gpu/src/host.rs:card_mapped_buffer_asallocations (where the CPU writes every byte before GPU read) viaheaps::Kind::GpuUpload(D3D12_RESOURCE_STATE_COMMON), keeping UAV mapped windows committed so D3D12 guarantees zeroed memory for unmapped holes.Host::upload_buffer(DARNER_REBAR_UPLOAD=0to disable; active only whenGPUUploadHeapSupportedis true andcardmem::may_place(size)has VRAM headroom) routing CPU-write / GPU-read-only staging uploads directly into pooledGPU_UPLOADVRAM.SPARE_MOSTfrom128 MiBto256 MiBto reduce list-scratch churn.ReBAR GPU_UPLOAD:infotelemetry line reporting live mapped windows, spilled count, scratch chunks, and ReBAR uploads.crates/darner-gpu/src/shadow.rs: MakesWINDOW_MAPPED_MOSTandCARD_MOSTconfigurable viaDARNER_WINDOW_MAPPED_MB(default12288MiB) andDARNER_CARD_MOST_MB(default4096MiB), while remaining strictly bounded under 80% of the actual adapter budget bycardmem::may_place().(Note for maintainer: if you prefer
DARNER_REBAR_UPLOADand/or the raised caps to be opt-in off-by-default until tested on 8–12 GB cards, I am happy to flip the defaults in a follow-up commit.)How it was tested
Tested revision:
b710605(based onpost-merge28a9b42)Commands and results:
cargo build --release --locked -p darner— passed (0 errors, MSVC, Windows 11 24H2, DXC 1.10)cargo test --release --locked -p darner-gpu --lib— 13 passed, 0 failed, 0 ignoredcargo clippy --release --locked -p darner-gpu -p darner-core --no-deps— 0 warnings in modified files (heaps.rs,host.rs,shadow.rs)Changes a default: yes, on GPUs where
D3D12_FEATURE_DATA_D3D12_OPTIONS16::GPUUploadHeapSupported == trueandcardmem::may_placereports headroom (all switches can be overridden viaDARNER_REBAR_UPLOAD=0,DARNER_WINDOW_MAPPED_MB=4096,DARNER_CARD_MOST_MB=1024).Observed gameplay result (single-rig measurements on RTX 3090 24 GB + Ryzen 9 5950X + 32 GB DDR4-3600, Windows 11 24H2, ReBAR ON):
v2026.12.04.01)b710605onpost-merge)0.2–0.3 fpsbeforepost-mergeRT rewrite)darner nv-profile --mb 2048)(Note: formal same-commit A/B table on
post-mergewithDARNER_REBAR_UPLOAD=0+4096/1024vs1+12288/4096can be added on request, or switches can be made opt-in.)Checks run on that revision (
b710605):cargo build --release --locked -p darner,cargo test --release --locked -p darner-gpu --lib,cargo clippy --release --locked -p darner-gpu -p darner-core --no-deps.Gameplay: NVIDIA GeForce RTX 3090 24 GB (Ampere, ReBAR ON, driver 630.20,
darner nv-profile --mb 2048), AMD Ryzen 9 5950X, 32 GB DDR4-3600, Series S profile, DLSS Quality, FSR 3 Frame Generation 2x, Hardware RT ON, Reflex Boost.Hardware dependence: Benefits GPUs with Resizable BAR (
GPUUploadHeapSupported == true), especially 16–24 GB cards; on 8–12 GB cardscardmem::may_placecaps placement at 80% of VRAM budget, though those cards are untested.Coverage gaps: Untested on 8–12 GB NVIDIA cards, AMD GPUs, Intel Arc, and Linux/vkd3d-proton; formal same-commit A/B run on
post-mergenot yet recorded.Checklist
post-merge.Checked for overlap
rebar: direct GPU_UPLOAD writes for fed heap, bufobj and taken buffersalso adds aGPU_UPLOADheap pool inheaps.rsand toucheshost.rs/shadow.rsfor fed heap,bufobj, andtakenbuffers).heaps.rs(Kind::GpuUploadvsKind::CardMapped); this PR focuses on lifting the hardcodedWINDOW_MAPPED_MOST/CARD_MOSTcaps for high-VRAM ReBAR cards, pooling non-UAVcard_mapped_buffer_asallocations, and routingHost::upload_bufferstaging into ReBAR VRAM (DARNER_REBAR_UPLOAD), and can be cleanly rebased on top of #668 if #668 merges first.AI-assisted analysis, profiling, and patch authoring: Antigravity (Google DeepMind); all code reviewed, built, and validated in-game on local hardware by the author.
[pr-performance][rendering] rebar: pool GPU_UPLOAD heaps, direct ReBAR uploads, and configurable large-BAR capsto rebar: pool GPU_UPLOAD heaps, direct ReBAR uploads, and configurable large-BAR capsView 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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.