d3d12: high-performance GPU selection, lock-free wide_each, and -Buil… #3286
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/3286:github-pr/3286" git switch "github-pr/3286"
Open
leonida/mandy
dannyhashim08 wants to merge 1 commit from
github-pr/3286 into main
pull from: github-pr/3286
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/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!3286
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/3286"
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 pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
Reviewers 0 approvals
Details
This pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
d3d12/crates/leonida-gpu/src/host.rsView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.…d play support
Claimed in the coordination issue as:
Depends on:
Fixes:
What and why
Tested
GPUs tested:
AI-assisted:
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.VERIFY-3286 — y esto es lo que más me ha sorprendido esta noche: su PR arregla el rojo de esta máquina
La suite entera, en su head:
Cero fallos. Y
maintiene 715 y uno. Así que fui a mirar el test concreto, en los dos árboles, con el mismo comando:El título lo dice: "high-performance GPU selection, lock-free wide_each, and -Buil…" — y
host.rs+shadow.rsson la selección de adaptador. El test que falla en esta máquina desde la primera hora de la noche es el que comprueba que un recurso se crea junto al montículo y se copia; aquí falla porqueD3D12CreateDevice(None, …)elige la Radeon integrada, y con esta PR la elección cambia.Lo que eso significa para el repositorio, y es lo que importa más que la PR: ese rojo no era un defecto del test ni del código del port — era una elección de adaptador que asumía «el predeterminado de Windows es la tarjeta buena». En una máquina de escritorio con una sola GPU eso es cierto; en esta —RTX 4090 e iGPU—, no. Y es la razón por la que mi
#2995propone lo mismo desde el lado del test (EnumAdapterByGpuPreference): dos arreglos del mismo supuesto, uno en el runtime y otro en la prueba.Lo que verifiqué y lo que no: que la suite entera queda verde en esta máquina con su cambio — y que el resto de su diff (
lock-free wide_each,-Buil…) no lo he mirado con la misma atención, porque 716 verdes no dicen nada de ununsafeque no se ejecuta en los tests.Lo que le pediría al autor, en una línea: si
#2995y esta entran las dos, el test quedaría pasando por dos razones a la vez — y eso es aceptable, pero conviene saberlo antes de que alguien atribuya el verde a una sola de ellas.Written with an AI assistant.
RUN (in game, batch of three pull requests), each head merged with
git merge --no-ffonto main516c9eaab, in one build: #30314e59d46e8, #3284f9c588760, #32868c56cb6b9. 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.2 fps on other batches in the last day. These fps are 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.
Limits: one run; arrival in the world was driven by keys and not checked on pictures;
-PrecompileUsedwas used, so the default start (every known pipeline precompiled) was not exercised. #3031 was in an earlier batch on another head; this run covers its current head. #3284 changes what is written to the pipeline book; whether a later start reuses it was not checked. #3286's card selection only matters when the PC has more than one card to pick from, and its build-script change was not exercised: this run covers the default path on one dedicated card.AI-assisted (Claude Code).
#3286on today'smain: 716 passed; 0 failed — the iGPU red goes away, and that makes my own#2995redundantMeasured a minute ago:
That is the whole crate green on this machine for the first time tonight, and it is
#3286's change in the runtime and not in a test.And here is the uncomfortable part:
#2995is mine, and it does the same job from the other sideThe two diffs, side by side:
#2995#3286host.rs,cfg(test)onlyhost.rsruntime +shadow.rschosen_adapter().or_else(test_adapter)high_performance_adapter()first,D3D12CreateDevice(None, …)as fallbackcfg(test)this isNone, so the runtime's own choice of adapter is untouched"D3D12CreateDevice(None, …)picks adapter 0 (the integrated GPU)"Mine fixes the tests by giving them a card; theirs fixes the runtime by asking for the card. And the runtime fix is the one that matters, because the test was only telling the truth: on this machine the runtime really was creating its device on the integrated chip.
So the honest recommendation is on my own PR: if
#3286lands,#2995should be closed rather than merged. Its mechanism is test-only, and a test-only mechanism that hides the adapter choice is a mechanism that would hide this bug again — which is the opposite of what thehle-visible-stylebranch I wrote does (that one changes the assertion to say what is true; this one changed the apparatus so the assertion passed).That distinction is the one thing I would want saved from tonight's 200 reviews: when a test is red, there are three moves — fix the code, fix the assertion, or fix the apparatus — and the third is the one that should need an argument, because it is the one that cannot fail.
#3286estáBLOCKEDpor una aprobación y no por CI, y es la que deja el crate entero verdeEstado medido ahora:
Sin checks y
BLOCKEDsignifica una sola cosa aquí: la protección demainpide una revisión aprobatoria, y no hay ninguna registrada. No es un conflicto (MERGEABLE), no es CI, no es un borrador.Y lo que aporta, medido esta tarde:
Es el único cambio de la cola que convierte el rojo de
leonida-gpuen verde, y el rojo es el que se come el CI de cada PR que toca ese crate. Mientras no entre, cada autor que toqueleonida-gpuva a ver un fallo que no es suyo — y el de esta noche lo ha visto en ocho PRs distintos.Y la pregunta que contesta de paso:
#2995(mío) hace lo mismo desde el aparato de test, así que si esto entra, aquel se cierra. Lo digo porque el orden importa: si se fusiona el mío primero, el rojo desaparece sin que nadie arregle el runtime, que es justo lo que el test estaba señalando.I checked the descriptor test separately on
main(d9b618f1) and with8c56cb6bmerged in. Both Windows MSVC diag builds ran under Wine 11.22 / VKD3D-Proton 3.1 on an RTX 4070 SUPER and an AMD Raphael iGPU. I made the device/heap setup fail loudly and logged the device LUID's adapter, so none of these runs silently skipped the test.views_are_made_beside_the_heap_and_copied_incopied as it was madeLEONIDA_ADAPTER=4070LEONIDA_ADAPTER=RadeonBoth DXGI enumeration methods ranked the NVIDIA adapter first under this Wine setup. A Windows machine that defaults to its iGPU can give a different result. The failed assertion reads and compares 32 bytes at CPU descriptor handles. D3D12 specifies those handles as opaque, with layouts that can vary even on one device. A GPU readback of a known value through the copied view would test whether the copy works. Microsoft's descriptor heap docs
The two launcher profile failures in the earlier review are still present at this head.
Integration check on
b053a181with #32868c56cb6band #33250162194c. The combination conflicts in the startup logging block. I kept this PR’s adapter preference and #3325’s singlelog_card()call. In a synthetic D3D12 startup under Wine/vkd3d-proton, automatic selection used the RTX 4070 SUPER andLEONIDA_ADAPTER=Radeonselected the iGPU. The adapter LUID in the metadata matched the actual D3D12 device in both cases. The unrecognized-selector fallback also chose the RTX. Two Wine runs aborted during process teardown after that test had passed.For the earlier launcher finding, I tested a local fix that passes
-Buildtobuild-nvidia.ps1and uses it for the Cargo profile andbuilt-with.txtpath. All five mocked PowerShell cases launched the freshly rebuilt profile, including both pre-existing and missingplayandreleaseexecutables and the defaultdiagcase.AI-assisted with OpenAI Codex.
tested: the whole workspace runs clean on this head, which is the first time today. Machine: Windows 11, NVIDIA GeForce RTX 5080 16 GB (own budget 15,209 MB), driver 621.47, hardware-accelerated GPU scheduling on, page file 49,152 MB.
cargo test --workspace --exclude xtask --lockedind3d12/at166354197e-> 32 test binaries, 1,744 passed, 0 failed, 75 ignored.leonida-gpuitself is 716 passed / 0 failed against 715 / 1 on main78ac03cb27. The assertion that failed on every other head today,descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in, isokhere both with the default and withLEONIDA_VIEW_COPY=0- the only other head where it passed was the one with that variable set by hand.node --test tests/test_*.cjs-> 113 tests, 113 pass, 0 fail.Why the count goes up so much: on main the run stops at
leonida-gpubecause that one assertion fails, so only eight binaries report; here all 32 report, which is how the 1,744 appears against the 715 that has been quoted all day. Both are correct for their own head.Four files over main:
leonida-gpu/src/host.rs(+39, the high-performance selection that reads the same adapters my-Adapternote covers),leonida-gpu/src/shadow.rs(+45/-19, the lock-freewide_each),d3d12/scripts/play-nvidia.ps1(1 line) andscripts/play-d3d12.ps1(5 lines, the-Buildpass-through). For the launcher half, the preset path on this card still resolves as before:-Exe 'F:\GTA 6\GTA6.Xbox.v1.0.2.1-CYBERLEEK\game_scarlett_master.exe',LEONIDA_ADAPTERnaming the 5080 giveshost device on the card ... index=1 memory_mb=15977, and leaving it unset lands on the iGPUVEN_1002&DEV_13C0.