test: the crate's device tests ask the card with memory of its own, not the default one #2995
Closed
leonida/mandy
fiestorra wants to merge 0 commits from
test-device-on-the-card into main
pull from: test-device-on-the-card
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
1 participant
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!2995
Loading…
Reference in a new issue
No description provided.
Delete branch "test-device-on-the-card"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
test: the crate's device tests ask the card with memory of its own, not the default one
Every
#[test]in this crate that makes a D3D12 device goes throughhost(), whichcalled
D3D12CreateDevice(None, ..)- "Windows' default card". On a machine whosemonitor hangs off the motherboard that is the integrated chip, so the tests ran there:
pipeline::places' children print the vendor of the device they made, and on a7800X3D + RTX 4090 they printed
vendor=1002(AMD's) andnot an NVIDIA card;dlss_starts_on_this_cardasked that Radeon whether it can start DLSS, gotFeatureNotSupported- correct for it - and read as a statement about the 4090.Neither could be seen on CI, where the runner has one adapter and it is the right one.
Outside
cfg(test)nothing changes:test_adapter()returnsNoneand the runtimekeeps choosing as it did (
LEONIDA_ADAPTER, else the default card). In a test build itpicks the adapter with the most
DedicatedVideoMemorythat is not software - the card agame would be run on, whatever its vendor.
Measured on
main1fff69129 + this change, RTX 4090 / driver 621.24:cargo test -p leonida-gpu --lib -- --test-threads=1
644 passed; 0 failed; 59 ignored (on the iGPU: 653 passed, 1 failed)
cargo clippy -p leonida-gpu --all-targets 1 warning, host.rs:7628, on main already
The one that failed on the iGPU and passes here is
descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in- the "copied asit was made" byte comparison, reported in #2570 as a failure on an RTX 4090 by me. It is
not: it is a failure on the AMD iGPU, and #2975 (the functional test added beside it)
describes it wrongly for the same reason.
Separately, and not caused by this change: with the tests on the card, 4 of the 8
#[ignore]dpipeline::placestests fail on 621.24 (they pass vacuously on an iGPU,which is how this went unnoticed). Those are the driver's behaviour, not this diff; they
are reported on their own.
Written with an AI assistant.
The places child can still create its early root signatures on a different adapter from the one whose sampler table it later examines. In the existing sequence
make=20,21;host, the first step reachesD3D12CreateDevice(None, ...)at pipeline/places/tests.rs:566. Only the later host step uses this PR's selector. The test expects the sampler state to carry across both handles on the same adapter.At 2e2e16323 I added temporary GetAdapterLuid logging to those two points and ran the child with diagnostics:
The WARP override makes the split reproducible on a single physical GPU. On a hybrid machine where default and highest-VRAM adapters differ, the same code paths can split without the override. The child reports only the host vendor today. Could both creation sites share adapter selection while preserving the required pre-host ordering? This affects how the reported places failures can be interpreted; I did not reproduce the four 4090 failures here. Codex-assisted.
You are right, and thanks for instrumenting it rather than guessing. A run whose
make=steps are on one device and whosehostis on another is not testing what the module says it tests.Fixed at
9e1e95930:test_adapter()now returnsNonewhenLEONIDA_D3D12_WARPis on (withdiagnostics), so nothing is preferred and the switch means what it says.One thing I could not reproduce, and it may tell you something about the harness: in my runs with
LEONIDA_D3D12_WARP=1the two steps are both on the card, becauserun()removes the switch for the child -hostcannot go to WARP from there. Your table must come from a harness that kept the switch (or from calling the steps directly); either way the guard is the behaviour you want, and if your instrumentation is easy to re-run, the new head is worth a look.Measured at
9e1e95930, RTX 4090 / 621.24:AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
Confirmed your observation about run(). My earlier reproduction invoked a_run directly. I reran both paths at 9e1e95930 with the same diagnostics binary, make=20,21;host, and LEONIDA_D3D12_WARP=1 in the parent:
The wrapper strips the override as you said. The direct-child split persists because the pre-host make uses D3D12CreateDevice(None, ...) without calling test_adapter(), while host takes its explicit WARP branch before reaching test_adapter(). The new guard therefore does not change either measured path. The remaining question for hybrid systems is whether the Windows default adapter and the highest-VRAM test adapter have the same LUID during a normal run(). Logging both on the hybrid host would settle it. Codex-assisted.
A run I cannot do, on the card you have, and it would settle something in #2919.
The question: on driver 621.24 the
pipeline::placesbehaviour thatplaces.rsguards against no longer happens (the_check_looks_at_every_kind_of_samplergetsplaces: "same", wrong: 0, read: [1, 2]where it used to get"differ"). On 616.64 the note infindings.mdsays it reproduced every time. Your 5070 is on 616.92 - between the two. If it reproduces on 616.92 and not on 621.24, the finding is a driver change with a version on each side instead of one card's word.On this branch (
9e1e95930, which is what makes these tests use a card at all):What to report, whatever it says:
vendor=from thePLACESline of any child (mine printedvendor=1002before this branch, which was the whole story).test result:- 8 passed on 616.64 per the note; on 621.24 four fail.places: "same"or"differ"fromthe_check_looks_at_every_kind_of_sampler's panic/print, and theread:list ([[6, 7], [43, 44], [1, 2, 3]]is "its own",[[45, 46], [43, 44], [40, 41, 42]]is "another run's").No test changes needed and it costs two minutes. If it fails the four, that is the answer: 616.92 behaves like 616.64 and 621.24 is the one that changed - and the four failing tests are asserting a driver that is gone, which is #2996's point.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
An explicit Radeon override also splits the places child across two real adapters.
I added the same
GetAdapterLuidtrace before and after the host step at2e2e16323and9e1e95930on002bd88f8, then invoked the ignoredpipeline::places::tests::a_rundirectly withLEONIDA_PLACES_RUN="make=20,21;host". With both adapters visible and no override, both steps used the RTX 4070 SUPER. WithLEONIDA_ADAPTER=Radeonand WARP unset, both heads made the early root signatures on NVIDIA and then used a different Radeon LUID forhost. The directD3D12CreateDevice(None, ...)ina_runbypasses the override as well astest_adapter(). With WARP requested, both heads reached the host WARP branch without entering the preference helper. DXVK does not provide a software WARP adapter here, so those lanes ended atPLACES none.I also tried a local variant that moves the existing device creation into one helper, called both by
hostand by the earlya_runstep. Both steps then used the same Radeon LUID under the override and the same NVIDIA LUID in the default control. When WARP was requested, the shared path reached the unavailable WARP selection before making any root signatures on hardware. This covers device selection under Wine 11.22 / VKD3D-Proton 3.1.0, with RTX 4070 SUPER and Radeon Raphael visible. Synthetic test only. AI-assisted with OpenAI Codex and independent raw-log verification.On a PC with two discrete 8 GB cards, an RTX 3070 driving the display and a Radeon RX 580, the most-dedicated-memory pick lands on the RX 580. That card has no mesh shaders, so it can't run the runtime at all. Head
9e1e95930merged ontomainf37c4a87d,cargo test -p leonida-gpu --features diagnostics --lib, NVIDIA 621.40, AMD 31.0.21927.4000:LEONIDA_ADAPTER=3070LEONIDA_ADAPTER=RX 580mainThe test that fails is
descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in, atdescriptor/host.rs:7649("copied as it was made": the copied record's first 16 bytes differ). So this PR doesn't break anything; it moves the tests onto a card wheremainalready fails. With the RX 580 pinned,mainfails the same way.A suggestion, since the runtime refuses such a card anyway: the pick could skip adapters without the features the runtime needs (mesh shader tier, as
host.rs:6269checks), or prefer the one DXGI's GPU preference names. Then a second, older card wouldn't take the tests.Tested with the help of Claude Code (Claude Opus 5.5).
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).
RUN (in game, batch of six render-path pull requests), each head merged with
git merge --no-ffonto main83046a713, in one build: #293345e0aae53, #28314375de941, #28404db84a195, #28873be77fdeb, #28555e4cd9bcb, #29959e1e95930. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x, 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 15.2 fps today on main with single pull requests and 14.9 with the first batch; no compile ran beside the game this time. 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. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; free system memory was low (median 1.3 GB); arrival in the world was driven by keys and not checked on pictures.
AI-assisted (Claude Code).
Code review only, not built (Windows-only
leonida-gpu). Two reported defects are still open on this head.9e1e95930, merge base1fff69129, 334 behind currentmain45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass. MoonEyes's in-game batch (15:53) passed.test_adapteriscfg!(test)-only, so that run says nothing about this change.Defects (
d3d12/crates/leonida-gpu/src/host.rs,test_adapter):host.rs(mesh-shader tier check).descriptor::host::tests::views_are_made_beside_the_heap_and_copied_inthen fails with no override set, wheremainpasses. A test-adapter choice should apply the same feature gate as the runtime: skip adapters without the required mesh-shader tier. Failing that,DXGI_GPU_PREFERENCE_HIGH_PERFORMANCEviaIDXGIFactory6::EnumAdapterByGpuPreferencewould at least not pick by VRAM alone.placeschild still splits devices. Reported by andrew-ai and merzleckeier:pipeline/places/tests.rs'sa_runmakes themake=steps withD3D12CreateDevice(None, ..), which uses neitherchosen_adapter()(LEONIDA_ADAPTER) nortest_adapter(), whilehostuses this selector. WithLEONIDA_ADAPTER=Radeonand two cards, the root signatures land on NVIDIA and the host on Radeon. TheLEONIDA_D3D12_WARPguard added in9e1e95930does not change either measured path. merzleckeier's local variant, one creation helper shared byhostanda_run, fixed both.Otherwise: gating on
cfg!(test)keeps the runtime's own choice untouched, and preferring a discrete card over the integrated default fixes the 7800X3D + 4090 case the PR measured.Verdict: defects. Share one adapter-selection helper with
a_run, and skip adapters without the runtime's required features.AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Both defects are fixed in
49a98807c, and the first one is measured on a machine that has the two cards.1. It picked a card the runtime cannot use
You are right about the cause: "most dedicated memory" is not a usable card. It now asks DXGI for
DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, which is whatD3D12CreateDevice(None, ..)gets and whatmain's tests already run on - so the test device is on the card the OS would pick for a high-performance app, and on this machine that is the one the runtime accepts.Measured here (integrated Radeon + RTX 4090, no override set):
That is the same test
upipibi's RX 580 case broke, on the two-card machine I have - before the change it failed with no override, after it passes, which is exactly the difference the report describes.2. The
placeschild still split the devicesa_runnow asks for the same adapter (crate::host::test_adapter(), madepub(crate)) and falls back toNonewhen there is none, so withLEONIDA_ADAPTER=Radeonand two cards themake=steps andhostland on the same device. Your suggestion - one selection path shared by both - is what it does now, rather than two copies that can drift.What I did not do
The
IDXGIFactory6route has a cost worth naming:EnumAdapterByGpuPreferenceexists on Windows 10 1803 and later, and the olderIDXGIFactory4loop I removed had no such floor. The repository already targets Windows 11 in every measured run I have seen, so I took it - if the floor matters, say so and I will fall back to the memory loop with a mesh-shader gate instead.And
upipibi's exact pair (RTX 3070 + RX 580) is not reproducible here: I have the integrated Radeon + 4090, which is the case the old code also got wrong - so the fix is checked on a two-card machine, not on that one.AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
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).
RUN (in game, batch of three pull requests), each head merged with
git merge --no-ffonto maind5b30be1c, in one build: #29119a2e9f607, #2995a2cd1dda5, #30506934967a0. 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. #2995 and #3050 change tests only: this run shows they leave the game path as it was, nothing more. #2911 was run in game on an earlier head by another tester; this run covers its current head.AI-assisted (Claude Code).
This pull request may be superseded by
#3286— and I would rather say it than let it sitI opened this because
D3D12CreateDevice(None, …)takes Windows' default adapter, and on a machine whose monitor hangs off the motherboard that is the integrated chip — so theplacestests ran on the iGPU and could not pass. My fix is a test-only adapter preference:chosen_adapter().or_else(test_adapter)inhost.rs, plus a test that uses it.Tonight I reviewed
#3286— "high-performance GPU selection, lock-freewide_each, and -Buil…" — and it fixes the same thing from the runtime side:And I measured what that does to this machine's red:
So the question is not whether
#3286fixes it — it does — but whether this pull request should still land. Two things say it should not, and I would rather one of the maintainers decided with them in front:#3286changes the runtime's choice, which is the real defect: a player on a hybrid machine was rendering on the iGPU, not just a test. This one changes what tests ask for, and the runtime would still pick the wrong card for a player.git merge-treesays the two conflict inhost.rs— so merging both means a resolution in the file that matters, and one of them would have to be dropped or re-expressed anyway.What I would do, if it were mine to decide: merge
#3286, close this one, and keep theplacestest that comes with it — which is the only part of this pull request that#3286does not have:That test asserts the device the tests run on is the one the runtime would pick — and it stays true after
#3286, because it asks the same question the runtime now answers.What I am not doing: closing it myself.
#3286is not merged, itslock-free wide_eachhalf is not something I verified, and closing a pull request because a candidate fix exists is how a fix gets lost when the candidate stalls. But if#3286merges, close this one the same day — and the honest thing to say now is that its value is theplacestest, not the adapter 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.
Cerrando esto en favor de
#3286Lo escribí hace una hora en este mismo hilo y lo cumplo: este PR da a los tests un adaptador distinto del que el runtime usa, y el rojo que arregla era verdad — en esta máquina el runtime creaba su dispositivo en la iGPU.
#3286lo arregla donde está el fallo (high_performance_adapter()en el runtime), y medido sobremainde hoy dejaleonida-gpuen716 passed; 0 failed— el crate entero verde, no el test verde.Así que cierro el mío y dejo la rama por si alguien quiere el
test_adapterpara otra cosa (es la parte que sí tiene valor: un mecanismo explícito para decir en qué tarjeta corren los tests, que hoy no existe en ningún sitio). Lo que no sostengo es usarlo para que un rojo deje de serlo.Y la frase que se lleva el PR: ante un test rojo hay tres movimientos — arreglar el código, arreglar la aserción, o arreglar el aparato — y el tercero es el único que no puede fallar, así que es el que hay que justificar. Yo no lo justifiqué; lo elegí porque era el más corto.