rebar: direct GPU_UPLOAD writes for fed heap, bufobj and taken buffers #668
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!668
Loading…
Reference in a new issue
No description provided.
Delete branch "nyutt/merge-rebar-direct"
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?
What it changes
Uses Resizable BAR (
D3D12_HEAP_TYPE_GPU_UPLOAD, whenGPUUploadHeapSupportedis true) to eliminate staging-ring copies, copy-queue submissions, inter-queue fence waits, and global lock contention on CPU-to-GPU buffer uploads, with an A/B opt-out switchDARNER_REBAR_DIRECT=0:GPU_UPLOADheap pool (heaps::Kind::CardMapped) —crates/darner-gpu/src/heaps.rs,crates/darner-gpu/src/host.rsGPU_UPLOADplaced-buffer heaps (up to 16 MiB per placed buffer) to avoidCreateCommittedResourceoverhead onscratch_buffer()and uploaded buffer objects.rebar_direct(),flush_wc()(_mm_sfence),card_mapped_supported(),card_mapped_scratch(), andcard_mapped_buffer_in_heap().heapfeed) —crates/darner-gpu/src/heapfeed.rs,crates/darner-gpu/src/shadow.rsShadow::fed_copy()backs the fed graphics heap inGPU_UPLOADVRAM (shadow.mapped = falsesoMAPPED[0]budget is untouched).written_direct()writes directly into mapped VRAM without takingFEED, allocating fromStaging, queuingcopy_runs, or submitting tocopy_queue.for_each_outside(), per-writer WC flush (DirectGuard) +direct_flush()beforeExecuteCommandListsinHost::submit, and fullDARNER_HEAP_CHECK=1diagnostics model compatibility.bufobjand non-readbacktakenbuffers —crates/darner-gpu/src/shadow.rs,crates/darner-gpu/src/host.rsShadow::uploaded_copy()allocates fromcard_mapped_scratch()(zeroing[len..size]tail);Shadow::owned_copy()allocates committedcard_mapped_buffer_as()fortakenbuffers withoutreadback(readback objects stay onDEFAULT+ graphics queue).lookup()andowned_upload()write directly under a per-Shadowdirect_uploadlock +DirectUploadGuard, removing theOWNED_SENDSlock nested insideBUFFERSwrite lock and eliminatingStaging+copy_queuetraffic.crates/darner-gpu/src/safecopy.rs,crates/darner-gpu/src/host.rsdarner_read_in_place_wc(vmovdqu4×32 B unrolled for 256 B–16 KiB, 32 B alignedvmovntdqfor ≥16 KiB,vzeroupper) wired into theon_faultVEH handler, exposed viacopy_known_wc/read_wc/read_title_wc/copy_mapped_wc.Benchmarks & Live A/B Results (RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, ReBAR ON)
1. Live in-game A/B on
Merge(same binary,DARNER_REBAR_DIRECT=0vs1)1080p→1440p DLSS Quality, Hardware RT, Frame Gen OFF, unlocked FPS, warm pipeline blob cache (
0 being made,0 dropped), 60 s steady-state window per arm from fixedbench-basesave with scripted camera sweep:DARNER_REBAR_DIRECT=0(off)DARNER_REBAR_DIRECT=1(on)(Note: median draws/frame were
8,355inoffvs6,007inondue to camera angle drift; on matched-draw samples8,418vs8,435draws/frame, CPUpreparingstill dropped from 8.2 ms → 1.9 ms (−77 %) and FPS rose from 36.1 → 38.5 fps.)2. D3D12 hardware microbenchmark (RTX 5070 Ti)
GPU_UPLOAD59.5 µs/op vs committedGPU_UPLOAD609.5 µs/op (10.2× faster) vs committedDEFAULT388.3 µs/op (6.5× faster).copy_queue0.768 ms/frame vs ReBAR direct 0.410 ms/frame (1.88× faster).CopyBufferRegion(8×64 MiB):DEFAULT→DEFAULT455.41 GB/s vsGPU_UPLOAD→GPU_UPLOAD451.12 GB/s (<1% delta).Verification
cargo test --workspace: all passed, including 5 new unit tests (card_mapped_kind_invariants,for_each_outside_edge_cases,with_stripes_stress_no_deadlock_and_linearizable,copy_known_wc_sizes_and_alignments,copy_known_wc_recovers_from_page_fault).cargo check --workspace --features diagnostics: 0 errors.cargo clippy --workspace --all-targets: 0 warnings in all modified files.DARNER_REBAR_DIRECT=0fallback.[pr-performance][rendering] rebar: direct GPU_UPLOAD writes for fed heap, bufobj and taken buffersto rebar: direct GPU_UPLOAD writes for fed heap, bufobj and taken buffersView 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.