d3d12: separate upload VA from BVH arenas so DLSS FG runs with ray tracing (D3D12-RT-FG-ARENA-VA-STORM) #2643
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/2643:github-pr/2643" git switch "github-pr/2643"
Open
leonida/mandy
zmasi wants to merge 10 commits from
github-pr/2643 into main
pull from: github-pr/2643
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2643
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/2643"
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?
This branch is out-of-date with the base branch
Reviewers 0 approvals
Details
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Claimed in #2570:
D3D12-RT-FG-ARENA-VA-STORM(https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7250446579)Summary
Fixes
D3D12-RT-FG-ARENA-VA-STORMacrossd3d12/crates/leonida-gpu/src/{upload.rs, memory.rs, fg.rs, lib.rs},d3d12/crates/leonida-hle/src/lib.rs, andd3d12/apps/leonida/src/main.rs(head9f39297d6a):[4 GiB, (MEMORY_PAGES - 1) * 64 KiB)) from host-only arena VA ([2^37, 2^40)) and reserve low upload space at startup:upload::reserveplaced both shader-addressed command-list upload blocks (Upload::new, whose CPU pointers are passed to shaders as 40-bit GPU addresses and indexed in the2^21-pageMEMORY_PAGESdirectory) andMemory's own CPU-side directory and 64 MiB BVH page arenas (memory.rs, which no shader ever addresses by CPU pointer) inside[4 GiB, 2^37)with nothing reserved ahead at process startup.fg::present_start), low-VA reservations alongsidexmemtitle mappings exhausted contiguous 64 MiB holes in[4 GiB, 2^37)(kept alive across toggles byDLSSGFlags::eRetainResourcesWhenOff).upload::reserve_space(wired vialeonida_hle::reserve_upload_space()right after logging init inapps/leonida/src/main.rs) now pre-reserves top-down write-watched address space (POOL_PIECES, uncommitted until sliced, bounded strictly below the emptyMEMORY_PAGES - 1clamp sentinel at0x1f_ffff_0000) forUpload::new(with 1-second failed-window scan backoff, non-destructivecommit_pool_slice, and overflow-checkedUpload::from_heapfallback), whileupload::reserve_out_of_reachplacesMemory's directory and 64 MiB arenas in[2^37, 2^40)first (with overflow-safeLEONIDA_LOW_EARLY_MBearly 64 MiB write-watched reservations andcommit_early_pieceretry). Adapted with credit from GPL-3.0 upstream commits inKemerd/VIctory-NVIDIA-RT(cbe02a6f9c,3e7e69cccf,1527faeac4) andtrustno1-coder/VIctory-NVIDIA(30b979ee48,e69e39c55b,0dd6ed89f7).VirtualAlloc2arena storm and 64 MiB VA leak inMemory::anotherandMemory::new:memory::readyandMemory::mapcalledMemory::another()->VirtualAlloc2under the globalMEMORYmutex on every BVH builder and ray-tracing dispatch (thousands of kernel VAD scans per frame, collapsing recording to~0.1 FPSwhile unmapped BVH pages stayed0indirectoryand blew ray-resolve passes out to white), andMemory::another/Memory::newleaked reservations whenshadow::by_addressorMemory::numberreturnedNone.Memory::another(another_from+ sharednumber_intoover disjoint struct field borrows) now memoizesfailed_arena_frameso a frame tries at most once and retries on the next frame, and bothMemory::anotherandMemory::newrelease reservations viaupload::releasewhenever host-copy creation or numbering fails.fg::wanted:wanted_forsoLEONIDA_FRAME_GENstarts withLEONIDA_BVH_BUILDER=1by default while preservingLEONIDA_FG_WITH_RT=0as an explicit opt-out.Verification
origin/main):[4 GiB, 2^37)reproduced both the multi-second Windows 11 kernelVirtualAlloc2scan stall across repeatedMEM_ADDRESS_REQUIREMENTSqueries andNonefailures for 64 MiBMemoryarenas;Memory::anotherhad no per-frame backoff and leakedatwhenshadow::by_address/numberreturnedNone;fg::wanted()returned0wheneverLEONIDA_BVH_BUILDER=1withoutLEONIDA_FG_WITH_RT=1.cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib upload::tests -- --test-threads=4->7/7passed ([2^37, 2^40)write-watch tracking +VirtualQueryMEM_FREErelease,[4 GiB, (MEMORY_PAGES - 1) * 64 KiB)POOL&MEM_TOP_DOWNsentinel-bound +Memory::mappable_pageproof, commit-failure retry, window backoff, overflow/heap fallback).cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib memory::tests -- --test-threads=4(default and--features diagnostics) ->4/4passed (2,048-dispatch per-frame storm backoff =1call,MEM_FREEverification on failed host copy, live D3D12shadow::by_addressUAV buffer above2^37).cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib fg:: -- --test-threads=4->3/3passed (wanted_tests,limit_tests,reflex_frame_tests).cargo test --manifest-path d3d12/Cargo.toml -p leonida-hle --lib tests::(210/210) &cargo test --manifest-path d3d12/Cargo.toml -p leonida --bin leonida(36/36) -> passed.cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-gpu -p leonida-hle -p leonida --tests&--features diagnostics->0warnings in modified files.python -I scripts/check_no_game_data.py->0issues, pure LF.GPUs tested: NVIDIA GeForce RTX 3090 (Windows 11, driver 610.88)
AI-assisted: yes
Checklist
mainand merges cleanly.CONTRIBUTING.md), including in logs or reports quoted here.docs/design.md, with how it was confirmed. (n/a: D3D12 runtime memory/FG management only)RTX 3090 / 621.40, validation on, 9f39297d6 merged onto main 1d22590b9: upload::tests 7, memory::tests 4, fg:: 10 pass (main 2/2/9), no validation errors. Unit tests only; the in-title DLSS FG + RT path isn't exercised.
RUN (independent run, #2643 head 9f39297d6 on main e1fe82f63; merged locally with
git merge --no-ff, no conflicts; also no conflict with #2566 head 70ea7d6ec pergit merge-tree --write-tree). Main has since moved to 012b79a67, which changes onlyd3d12/docs/findings.mdandd3d12/scripts/play-nvidia.ps1, so the crates tested are the same. It still merges cleanly there.Commands, in
d3d12/, target x86_64-pc-windows-msvc, toolchain 1.98.1, all with--locked:cargo test -p leonida-gpu --no-fail-fast: green, 567 passed / 0 failed / 50 ignored. Main gives 559 / 0 / 50, so the 8 new tests all pass and the ignored ones are the same.cargo test -p leonida-hle: 220 / 0 / 2.cargo test -p leonida(the app): 43 / 0 / 0. Both are the same as on main.cargo clippy -p leonida-gpu -p leonida-hle -p leonida --all-targets(without-D warnings, which already fails on main in leonida-shader and leonida-lua), on main and on the merge: no new warning in the six files the PR touches (9 already there on main, the same 9 on the merge).another_from,wanted_for,reserve_out_of_reach,release,commit_pool_sliceand others not found). That alone proves little, so I also ran the behavioural reds below.cargo test -p leonida-gpu --lib -- memory::tests upload::tests fg::wanted_tests. These 12 tests all pass in the full run above, without a mutant:another_from:failed_arena_backs_off_for_the_frame_and_releases_unnumbered_reservationsfails, with 2,048 reservation attempts instead of 1.release(at)removed after a failed copy: the same test fails later on. The reservation is still committed (state 0x1000, notMEM_FREE).wanted_forput back to main's rule (off with ray tracing unlessLEONIDA_FG_WITH_RT=1):frame_generation_starts_with_ray_tracing_unless_explicitly_disabledfails (0 for 1).reserve_out_of_reachwithout its [2^37, 2^40) step:out_of_reach_places_write_watched_memory_above_37_bits_and_releases_cleanlyandby_address_shadow_works_on_out_of_reach_reservationfail, both getting an address in [4 GiB, 2^37).window_allows_atdisabled:window_backoff_suppresses_repeated_scans_until_expiryfails.A default change to note: in
fg.rs, frame generation now starts withLEONIDA_BVH_BUILDER=1unlessLEONIDA_FG_WITH_RT=0. Main left it off there because the two together ran at 0.1 frames a second.scripts/play-nvidia.ps1is not changed, and on current main it still removesLEONIDA_FRAME_GEN(and FSR 3 frame generation) when ray tracing is on, unlessLEONIDA_FG_WITH_RT=1. So through the launcher, frame generation with ray tracing stays off, and the new default only applies to starts without the launcher.Perf: this needs an in-game A/B with ray tracing on.
d3d12/README.mdsays DLSS frame generation runs on RTX 40 and 50 cards only, so its frame-generation half cannot be run on an RTX 3090 (the PR lists a 3090 as the tested GPU). The arena and stall half can be (ray tracing on, frame generation off).No runtime/ C++ or Python in this PR, so no link or import check applies.
Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40.
Independent check on Windows (not the author), at
9f39297d6.cargo test --locked -p leonida-gpu --lib(shared warm target): 540 passed, 0 failed, 46 ignored in 13.7 s.The diff is source-only (
main.rs,fg.rs,lib.rs), so this is compile + regression coverage. The DLSS-FG-with-ray-tracing behaviour itself needs a game run, which I did not do.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, NVIDIA RTX 4070 Ti SUPER (driver 621.01), Rust 1.98.1 pinned.
AI-assisted: yes (opencode).
Independent game-run A/B test on Windows 10 + NVIDIA RTX 5070 12 GB (driver 621.40) with DLSS Frame Generation 2x + Ray Tracing enabled (
MEASURED, n=1 control / n=2 PR runs;d3d12/target/diagbuilt withdiagnostics,dlss,mimalloc, DLSS v310.9.16, Streamline v2.14.16).Verdict:
better(reproduces themain0.2 fps / 13-arena collapse and fixes it cleanly in both PR runs:5,391.0 ms->101.8 / 104.0 ms,0.2 -> 8.7 / 8.9 fpsin the3000-4999draw bucket, 20 arenas / ~1,157-1,187 MB allocated, 0 runtime errors, 0 device losses).One small launcher note (
READ IN CODE,d3d12/scripts/play-nvidia.ps1:519):play-nvidia.ps1still stripsLEONIDA_FRAME_GENwhen-RayTracingis passed unless-More @{LEONIDA_FG_WITH_RT='1'}is supplied, so both arms below passedLEONIDA_FG_WITH_RT=1explicitly (updatingplay-nvidia.ps1can be done here or in a follow-up). Also note: in unattended runs Streamline reportedtagged=true status=0withpresented=1 per=1on the periodic state snapshot alongside Reflex latency reports; interactive foreground focus was not manually tested for interpolation cadence, while the low-VA exhaustion and 5.4 s/frame collapse are completely resolved.Summary via
tools/d3d12_run_fps.py --compare(A vs B1):3000-4999draws: A0.2 fps (6)vs B18.7 fps (10)(+5700%), B28.9 fps (8)5000-6999draws: A0.2 fps (2)vs B110.4 fps (2)AI-assisted: Antigravity.
Required an actual GPU backing for the out-of-window reservation with
2cea6871c+ed867d7b2. I changed the optionalby_address_shadow_works_on_out_of_reach_reservationassertion locally to require a hardware D3D12 device and a successful backing allocation. The 128 KiB fixture created the backing and passed span and GPU-offset checks on AMD RADV 26.3.1 and RTX 4070 SUPER (620.73.4), under Wine 11.22 and vkd3d-proton 3.1.0. The upload, memory and frame-generation helper filters passed 7, 4 and 10 tests respectively on each device. These tests cover the reservation and backing path. DLSS Frame Generation with ray tracing in-game was outside this run.AI-assisted with OpenAI Codex.
RUN (provisional, n=1 per arm) of head 2cea6871c merged onto main 913b88b90 (tree 940650739), against main 913b88b90 as control. RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11, launcher
-SeriesS -RayTracingwith DLSS and frame generation left at their defaults, BAR 0, texture budget 1024, 330 s walking run each, the pull request first and main second.AI-assisted: Claude Code (oreofr-agent).
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Ran natively on Windows 11, head
2cea6871cmerged into currentmain(128648cfe, no conflicts),leonida-gpuwith--features diagnostics,--locked, toolchain 1.98.1. I ran the tests on the hardware card and again on WARP, with the same results.Earlier runs covered the PR's own tests, mutants and in-game runs. This run checks whether the split between the upload pool, the early pieces and the out-of-reach arenas can give out the same address twice or send a lookup to the wrong buffer.
Suite
cargo test -p leonida-gpu --lib(merge)memory::tests upload::tests fg::cargo clippy -p leonida-gpu --all-targetsmemory.rs,upload.rs,fg.rsorlib.rsAllocator probes (throwaway tests in
upload.rs, not committed)Upload::neweach (100 B to 9 MiB, sizes chosen so some need a new arena), plus 32reserve_out_of_reachof 4 or 64 MiBLOW_END), every out-of-reach block in [2^37, 2^40)LEONIDA_BVH_BUILDER=1: 8 threads × 10reserve_out_of_reach(64 MiB)commit_pool_sliceon a 3-piece fake pool, 5,000 random sizes from 1 B to 64 MiB + 1POOLmarked full, thenreserve(4 MiB)0x1_0000_0000, belowLOW_ENDand clear of all 32 pool pieces (0x1f7fff0000up toLOW_END)Upload::new(4 MiB)back to back...bff0000,...c3f0000), andshadow::extentat each start and each last byte resolves to its own bufferI found no overlap and no address given twice, and
shadow::extentresolves both ends of two adjacent arenas to their own buffers.Two behaviour changes, read in code, not tested in game:
Upload::newnow returns process-heap memory (above 2^40) wheremainreturnedNone. Soallocate_upload(list 0x4a0, the title's BVH instance descriptions) now gets a pointer that shaders read as zeros, wheremaingave a null pointer. The PR logs this once.reserve_upload_space()runs at startup whateverLEONIDA_UPLOAD_LOWsays. SoLEONIDA_UPLOAD_LOW=0("from the process heap, as before") still reserves the 32 × 64 MiB of address space, though it commits none of it.Not checked: DLSS frame generation together with ray tracing in game. How much room the low window has after Streamline/NGX/CUDA have loaded.
shadow::lookup, or an ask spanning two adjacent arenas.leonida-hleand the app on this merge. The same probes onmain(no comparison made).GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
RUN (in game, gate-style, as asked by MoonEyes): head 2cea6871c tested in a batch with #2643 (2cea6871c), #3031 (a47b86855), #2789 (4bd128a8c) and #2661 (1b3f3dee0), all merged with
git merge --no-ffontomain23a51c494 (no conflict; the only file the four share isd3d12/docs/switches.md). Built withdiagnostics,mimalloc, targetx86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).Launcher defaults, Series S settings,
-NoDlss -NoFrameGen, standing at the save; a warm-up run first (the batch changes the translator, so everything was re-translated), then one run of 420 s with the memory safety stop:Verdict: PASS for the batch (a pass covers each of the four; a failure would not have said which). Not covered here:
-RayTracing(a run with it is queued), DLSS frame generation with ray tracing (needs an RTX 40/50 card), other GPUs.AI-assisted: Claude Code (Claude Opus 5.5)
Checked #2643: Rust reviewed at the level of its structure, not built here (Windows-only). Merged onto current
mainthe switches registry check fails: the newLEONIDA_LOW_EARLY_MBis not ind3d12/docs/switches.md.2cea6871cbmain45dc41f95cgit merge-tree); merge basead25611b53, 884 commits behindRan (Linux, Python 3.13.18, on an export of the merge tree in its own git repository)
Same commands on
main45dc41f95calone: exit 0, 20/20 OK. The name comes from this branch:d3d12/crates/leonida-gpu/src/upload.rsreadsstd::env::var("LEONIDA_LOW_EARLY_MB"). The head's CI of 30 November was green; on today's merge the check fails, so merging as is would turnmainred. Fix: mergemain, runpython -I tools/d3d12_switches.py --out d3d12/docs/switches.md, commit.Review notes (not built)
[4 GiB, (MEMORY_PAGES - 1) * 64 KiB)) from host-only arena VA ([2^37, 2^40)), and stoppingMemory::anotherfrom callingVirtualAlloc2on every dispatch after a failed reservation, addresses the cause described (VA exhaustion and a per-dispatch reservation storm under the globalMEMORYmutex), not a symptom.d3d12/is GPL-3.0-or-later (d3d12/Cargo.toml:11), so the licences are compatible. A maintainer may still want the credited commit IDs in the commit message, not only in the description.main. The Windows checks (ghost, KelboLive, lixonik A/B, merzleckeier, OreoFR, Kal0s-design) are on this head or the earlier9f39297d6and agree.Verdict: defects. One regenerated
switches.mdon a current merge; otherwise covered by the Windows and in-game evidence already posted.AI-assisted: Claude Opus 5.5 (Claude Code), verification only.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Thanks @MoonEyes — merged
origin/main(45dc41f95c), regeneratedd3d12/docs/switches.md(LEONIDA_LOW_EARLY_MB,LEONIDA_BVH_BUILDER,LEONIDA_FG_WITH_RT), and recorded the credited GPL-3.0 upstream commit IDs in commitad354791d5as well. The PR's Rust diff from2cea6871cb(covered by @enlight3d's RTX 3090 in-game batch gate and @Kal0s-design's hardware + WARP runs) is completely unchanged.Verified on
ad354791d5:python -I tools/d3d12_switches.py --check d3d12/docs/switches.md-> exit 0python -I tests/test_d3d12_switches.py->20/20OKcargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib upload::tests(7/7),memory::tests(4/4),fg::(17/17), pluscargo checkwith and without--features diagnostics-> green.Merged current
origin/main(16243cd6eb, integrating #3154'stitle_range.rsina17a658ea9):leonida_hle::reserve_upload_space()now runs immediately afterleonida_gpu::title_range::keep()(skippingPOOLwhentitle_rangeholds[4 GiB, 2^37 - 64 KiB), while still reservingLEONIDA_LOW_EARLY_MBin[2^37, 2^40)forMemory), andupload::releasere-holds freed low-window spans intitle_rangewhile leaving[2^37, 2^40)out-of-reach reservationsMEM_FREE(11/11upload::,10/10title_range::,4/4memory::,17/17fg::,27/27xmem::, and20/20test_d3d12_switches.pypassing).In-game run (head a17a658ea9c04dfe47cdc45034838b994305a67d merged --no-ff onto main 81efe45669c83a4666b3801e8bd69d34adf57442): PASS (stability), with one frame-generation observation.
Setup:
Run A, this PR's case:
-SeriesS -HardwareRT -FrameGen 2 -PrecompileUsed,LEONIDA_FG_WITH_RT=1, BAR 0, texture budget 1024.LEONIDA_FG_WITH_RTset.Run B, standard gate:
-SeriesS -NoDlss -NoFrameGen -PrecompileUsed, BAR 0, texture budget 1024.AI-assisted (oreofr-agent)
Merged
origin/main(516c9eaabf, including#3230and#3244) into26e7b6057estrictly to regenerated3d12/docs/switches.md(needs rebase); all six Rust files (main.rs,fg.rs,lib.rs,memory.rs,upload.rs, andleonida-hle/src/lib.rs) have byte-identical diffs againstorigin/maincompared toa17a658ea9.@OreoFR Thank you for the RTX 4070 Laptop 8 GB run report! On the
A1observation (per=1in 20 of 21 state lines despiteStreamline started with frames=2, while 1 of 21 lines inA1and 11 of 11 inA2hadper=2):wanted_for(fg.rs:67-89, cached inOnceLock), which returned the same1(2x) asmainunderLEONIDA_FG_WITH_RT=1;present_start,present_end,tag, andSTALE_RESETS(12 resetsin bothA1andA2) are untouched.A1did reachper=2, Streamline initialized and generated at least one interval before dropping back toper=1(fg.rs:1509). The most common cause ofstatus=0, tagged=true, presented=1after an active interval is the game window losing Win32 foreground focus (fg.rs:1503-1504: DLSS-G suspends generation whenever the window is unfocused); checkingstatusandtaggedonA1'sframe generation: statelines (fg.rs:1512-1520) will show whether it was unfocused pass-through (status=0, tagged=true, presented=1) vs a non-zero Streamlinestatusortagged=false.#3230now onmain,play-nvidia.ps1setsLEONIDA_FG_WITH_RT=1automatically on Series S (and Series X>= 20 GB), whilewanted_forinfg.rsaligns direct runtime launches (play-d3d12.ps1/ Linux) and still honorsLEONIDA_FG_WITH_RT=0.AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).
VERIFY-2642 y
#2643— las dos grandes, las dos sin tests nuevos, y una de ellas mejora al fusionarLas dos de zmasi, las dos de 5-6 días, y las dos con
switches.mden el diff (la marca de esta noche para «cambia lo que el jugador puede encender»):La única falla en las dos es la de la iGPU.
#2643— y este número sí dice algo724es más que los715demain, con cero tests nuevos — o sea que su base trae nueve tests quemainya no tiene o tiene distintos, y aun así la suite pasa. Lo digo porque es lo contrario de un problema: un árbol que añade pruebas respecto amainy pasa entero es un árbol que se fusionó con cuidado.El cambio: separar la VA de subida de las arenas del BVH para que DLSS FG funcione con ray tracing — 570 líneas en
upload.rs, 229 enmemory.rs. Es un cambio de reparto de memoria, y el título nombra el síntoma exacto («DLSS FG runs with ray tra…»): el jugador enciende las dos cosas y una se rompe.#2642— compilar shaders SM 5.1 con DXC en WineY esta es la más ambiciosa de las dos: 13 ficheros, y
inplace.rs/replay/play/merge.rsen el diff — no es sólo el compilador, es el camino de la grabación.Lo que verifiqué en las dos: la suite completa del crate, con la única falla conocida, y que ninguna trae test nuevo.
Lo que no: que DLSS FG y el ray tracing convivan (
#2643) ni que un shader SM 5.1 compile en Wine (#2642) — son los dos estados que el título promete y ninguno está en la suite.Y una observación sobre la cola, con las dos delante: son las dos PRs más grandes que quedan sin revisar (1 003 y 771 líneas) y las dos vienen del mismo autor con la misma etiqueta de
switches.md. Si alguien va a fusionar dos de las antiguas esta semana, estas dos cambian el comportamiento del juego más que las otras cinco juntas — y por eso son las que más necesitan una fila engpu-test-results/, que es lo único que puede decir si funcionan.RUN (in game, RTX 5070 12 GB, Hardware RT + Streamline FG 2x init, 315 s in-world gate) -- PASS (stability), plus one parallel unit-test race finding
26e7b6057merged cleanly (git merge --no-ff) ontomain(d9b618f10)python -I scripts/check_no_game_data.py-- PASSpython -I tools/d3d12_switches.py --check d3d12/docs/switches.md-- PASScargo test -p leonida-gpu --lib --locked upload:: -- --test-threads=1-- 11/11 PASScargo test -p leonida-gpu --lib --locked memory::-- PASScargo test -p leonida-gpu --lib --locked fg::-- 17/17 PASS (includingframe_generation_starts_with_ray_tracing_unless_explicitly_disabled)cargo test -p leonida-hle --lib --locked-- 258 passed, 0 failed, 2 ignoredcargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked-- PASScargo test):cargo test -p leonida-gpu --lib --locked upload::without--test-threads=1failed 2 of 4 times atcrates/leonida-gpu/src/upload.rs:610(release_reholds_title_range_spans_and_leaves_out_of_reach_free:assert_eq!(mbi.State, MEM_FREE)got4096(MEM_COMMIT) instead of65536(MEM_FREE)).out_of_reach_places_write_watched_memory_above_37_bits_and_releases_cleanlyruns in parallel in the same[OUT_START, OUT_END)window and can immediately claim the just-freed lowest VA betweenrelease_in(&range, out)andVirtualQuery(out, ...). Serializing theOUT_START..OUT_ENDVirtualQuerytests (or holding a test mutex across reserve/release/query) should eliminate the flake.LEONIDA_HW_RT=1,LEONIDA_AMBIENT=0,LEONIDA_RT_RESOLVE=1,LEONIDA_ACTIVATE_RAYS=1) +-FrameGen 2, 315 s in world, 498.3 s total, 63 world samples, max 5,137 draws):eWarnOutOfVRAM: 0 (only StreamlinegetRefreshRatelines after the harness closed the window at teardown)title_rangeheld126,975 MiBacross124pieces before Streamline/NGX loaded (sl.dlss_gPRODUCTION)569 MB/1,074 MBbudget,0evicted)3000-4999draws bucket: 23.8 fps (57 samples)per=1): Streamline initialized cleanly (Streamline started frames=2,amount set (1 = off) result=sl::Result::eOk (0) frames=2,status=0across all 29 state lines,tagged=truein world), butpresented=1 per=1on all state lines on this Windows 10 automated test setup (the sameper=1behavior occurred on an unrelated FG-only run on this host, so this appears host/window-state related rather than PR-specific). Also not tested in-game here: software BVH (LEONIDA_BVH_BUILDER=1) withLEONIDA_FG_WITH_RTunset.AI-assisted: yes (Antigravity -- Gemini 4 Neon).
Merged
origin/main(6e97990505,#3318) into2e0b23a002to regenerated3d12/docs/switches.md(needs rebase), and serialized the four[OUT_START, OUT_END)VirtualQuerytests acrossupload::testsandmemory::testsunder#[cfg(test)]out_of_reach_test_lock()— thank you @lixonik for both the 315 s RTX 5070 Hardware RT + Streamline FG 2x gate report and catching that parallel test race! Zero non-test Rust bytes changed compared to26e7b6057e(15/15consecutive parallelupload::+memory::runs pass).AI-assisted: Gemini 4 Neon (XHigh) and Gemini 4 Carbon (High).
RUN (in game, third party, batch of five pull requests), each head merged with
git merge --no-ffonto mainb053a1813, in one build: #2686c5269801b, #26432e0b23a00, #27894cd9d71f8, #30720f1e26355, #299991537d2af. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 17.6 fps on other runs today: a check that nothing fell over, not a measurement of a gain.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. #2834 was left out of the batch (it conflicts with the others).
Limits: one run; arrival in the world was driven by keys and not checked on pictures. The precompile took 589 s (the batch changes shader code, so the pipeline cache was cold). Switches that are off by default were not turned on: this run covers their default path only.
AI-assisted (Claude Code, Claude Opus 5.5).
Game-run A/B on an RTX 5060 8 GB: same. Frame generation and hardware ray tracing ran together in both runs, with no errors and no device loss. On this card
maindid not show the arena storm within 315 s, so this run shows no regression but does not confirm the fix.PROVISIONAL (n=1 each).tools/d3d12_run_fps.py A --compare B: 3000-4999 draws a frame, A 29.9 fps (66 samples), B 29.6 fps (63 samples), -1%. No other bucket had 5 samples in both runs.ERRORlines, 0 device lost or removed, 0 panics. The hardware ray tracing builder was active in both (about 16,000-17,000 BLAS builds each).LEONIDA_FG_WITH_RT=1is set in both runs, so thatmainalso starts frame generation with ray tracing. Without it,mainwould not start frame generation at all.LEONIDA_FG_WITH_RTdefault change on its own.