d3d12: leonida nv-profile, NVIDIA's shader heap at 1-2 GiB in a profile of our own (D3D12-NV-PROFILE) #3519
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "+refs/pull/3519/head:oreofr/nv-profile" git switch "oreofr/nv-profile"
Open
leonida/mandy
OreoFR
wants to merge 3 commits from
oreofr/nv-profile into main
AGit
pull from: oreofr/nv-profile
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/2643
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!3519
Loading…
Reference in a new issue
No description provided.
Delete branch "oreofr/nv-profile"
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.Item: D3D12-NV-PROFILE (asked by OreoFR, 2026-12-05; claimed in #3312).
Problem. With ray tracing the game reaches some 2,100-2,700 pipelines. NVIDIA's shader heap (512 MiB unless a driver profile says otherwise) then fills up, and the device is lost with
0x887A0005, with no page fault and empty breadcrumbs. Darner's testers stopped these losses on six PCs (RTX 4090 x3, RTX 3090, Windows 10 and 11) with the driver setting0x001ABC0Fat 1 or 2 GiB for the game's exe.Change. A new subcommand,
leonida nv-profile(Windows), incrates/leonida-gpu/src/nvprofile.rs:leonida.exeandleonida_sm.exe. Reads only.--mb 1024|2048: sets the heap in a driver profile of our own, "Mandy (shader heap)", created if missing. An exe the driver already puts in another profile (for example one made with Profile Inspector) gets the setting in that profile. Needs an administrator prompt.--remove: deletes our profile.--exe <name>: adds more exe names.nvapi64.dllloaded from System32 only.nv-profile(TrustNo1/Darner,apps/darner/src/nvprofile.rs, GPL-3.0).Tested (Windows 11, RTX 4070 Laptop):
cargo test -p leonida-gpu nvprofile: 4 tests (structure sizes and versions, heap values, exe names, text round trip).check_no_game_data: clean.leonida.exe: in no profile, shader heap not set (the driver's 512 MiB).--mband--remove, since they change the driver's settings. Not measured in game: the first check is a ray-tracing run that loses the device today, with and without the profile.Added (
095221123): asked at PLAY when ray tracing is on, taken away when it is off (OreoFR's choice)LEONIDA_BVH_BUILDER=1,play-nvidia.ps1runsleonida nv-profile --check. That flag can come from the launcher's ray tracing box,-RayTracing/-HardwareRT, the F1 menu's file or Advanced. The check reads only, needs no rights, and exits 0 when set, 1 when not, 2 without NVIDIA.leonida nv-profile --mb: 1 GiB on cards of 8 GB or less, where the heap memory comes out of the textures', and 2 GiB above.LEONIDA_NV_PROFILE=0: never asked.tests/test_play_nv_profile.py: 8 tests. The block runs alone with a stand-in for leonida.exe and for the elevated call.--checkon the RTX 4070 Laptop: exit 1, "the driver's 512 MiB".--mband--removewere not run.Added (
2a8187c1d): the NVIDIA shader cache size is read, and a start warns when it is not Unlimitedleonida nv-profilereads NVIDIA Control Panel's Shader Cache Size. It is the driver setting "Shader disk cache maximum size",0x00AC8497in the global profile, found by listing the driver's setting names on an RTX 4070 Laptop. At Unlimited it reads0xFFFFFFFF.--cacheanswers with an exit code: 0 Unlimited, 1 not, 2 no NVIDIA driver. Reads only.play-nvidia.ps1warns at each start when the cache is limited. A limited cache fills with older translations, then keeps nothing new.tests/test_play_nv_profile.pynow has 10, andnvprofile7.--cacheprints "Unlimited" and exits 0.AI-assisted (oreofr-agent).
🤖 Generated with Claude Code
With ray tracing the game reaches some 2,100-2,700 pipelines, and NVIDIA's shader heap (512 MiB unless a profile says otherwise) is then full: the device is lost with 0x887A0005, no page fault, empty breadcrumbs. Darner's testers stopped those losses on six PCs with the driver setting 0x001ABC0F at 1 or 2 GiB for the game's exe. `leonida nv-profile` (Windows): without options it shows what the driver applies to leonida.exe and leonida_sm.exe (reads only); `--mb 1024|2048` sets the heap in a profile of Mandy's own ("Mandy (shader heap)", made if missing; an exe already in another profile gets it there), which needs an administrator prompt; `--remove` deletes that profile. Through NVAPI's driver settings (DRS), nvapi64.dll from System32 only. Nothing runs unless asked: no start of the game touches the driver's settings. Adapted from Darner's nv-profile (TrustNo1/Darner, apps/darner/src/nvprofile.rs, GPL-3.0). Tested: cargo test -p leonida-gpu nvprofile (4: structure sizes and versions, heap values, exe names, texts), the diag build, clippy, check_no_game_data. On an RTX 4070 Laptop: the status reads the driver's settings ("leonida.exe: in no profile, shader heap not set"). --mb and --remove were not run (they change the driver's settings). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>As asked by OreoFR: ray tracing on + PLAY asks, ray tracing off + PLAY removes. On a start with LEONIDA_BVH_BUILDER=1 (the launcher's ray tracing box, -RayTracing or -HardwareRT, the F1 menu's file or the launcher's Advanced variables, all of which end there), `leonida nv-profile --check` reads the driver's settings (no rights needed); when the heap is not raised, Windows' administrator prompt asks to run `leonida nv-profile --mb` (1 GiB on cards of 8 GB or less, where it comes out of the textures' memory; 2 GiB above). The game starts whatever the answer; a declined prompt comes again at the next start with ray tracing. A start without ray tracing removes the profile this script set (one more prompt); a profile made by other means is never touched. LEONIDA_NV_PROFILE=0: never asked. `leonida nv-profile --check`: exit code 0 when the heap is 1 GiB or more for leonida.exe and leonida_sm.exe, 1 when not, 2 without an NVIDIA driver. Tested: tests/test_play_nv_profile.py (8: asks with RT, 1 or 2 GiB by VRAM, nothing when raised or without NVIDIA, a declined prompt, removal without RT, no mark no prompt, the switch), cargo test -p leonida-gpu nvprofile (6), the play script tests, test_d3d12_switches, PowerShell parse check, clippy. On an RTX 4070 Laptop: `--check` exits 1 ("not set: ... the driver's 512 MiB"). The elevated --mb/--remove not run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Verified at head
2a8187c1, merge base93b9d90a.d3d12/crates/leonida-gpu/src/nvprofile.rsandtests/test_play_nv_profile.pyare new files (absent at93b9d90a).Rust unit tests (
nvprofile::tests::, 7 new):PowerShell block tests (10 new):
They run the real block in Windows PowerShell with a fake
leonida,LOCALAPPDATApointed at a temp root and$nvElevatestubbed, so no UAC prompt and no driver write;%LOCALAPPDATA%\Leonida\nv-profile-set.txtdoes not exist on this machine after the run.Real driver, read-only. Built
leonidaand ran the two read-only subcommands against this laptop's RTX 5060 (driver 621.40):So the NVAPI read path works against a real driver, and the exit-code contract the script branches on (0 set/Unlimited, 1 not, 2 no NVIDIA driver) holds for the 1 case here.
--mband--removewere not run: they write a driver profile and need an administrator prompt.git diff --checkagainst93b9d90a: clean.scripts/check_no_game_data.pyon the six changed files: clean.Limits. Both read-only commands answer 1 on this card, so the raised/Unlimited side (exit 0) is only covered by the unit tests; the profile write and removal paths stay unexercised here.
AI-assisted (Hy4 flash). GPU: RTX 5060 Laptop, NVIDIA driver 621.40 (Radeon 780M also present). The nv-profile reads above used the NVIDIA driver; no game data used or needed.