Repository navigation
NVIDIA places: the check also looks through a drawn pipeline (D3D12-PLACES-CHECK-GRAPHICS) - #2919
Christopher-Sundeby wants to merge 4 commits into
Conversation
…LACES-CHECK-GRAPHICS) On an RTX 5090 with driver 621.40, a graphics pipeline loaded from the library samples through whatever static samplers now sit at its stored places, in every run. Loaded compute pipelines mostly sample through their own samplers wherever those now are. Places::check probed each place with compute pipelines only, so after static samplers had been made before the host's it answered "same", and graphics pipelines were loaded through the wrong samplers. Each place is now probed by a compute pipeline and by a drawn one: a graphics pipeline with no target that draws one pixel and writes the same buffer from its pixel program. A place counts as "same" only when every loaded probe agrees with the same pipeline made now. the_check_looks_at_every_kind_of_sampler and pipelines_with_static_samplers_come_from_the_library go from red to green on the card. The no-care (=1) assertion now asks for some wrong read, not for every pipeline to read wrong, because compute pipelines on 621.40 read right at times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oints - The drawn probe's library name hashes the vertex program too, so a changed VERTEX cannot leave the probe "new" for good. - Checked::new counts pipelines (two a place), as its doc now says. - The check's doc says the first run that has drawn probes judges by the compute ones alone; the module note says "in any run measured". - The tests use places.rs's VERTEX and bytecode() instead of copies. - The no-care assertion asks that the graphics pipeline reads wrong (it did in every run on 616.64 and on 621.40). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Existing compute probe keys change on upgrade at From the lookup code, a pre-upgrade library with only the old compute probes will miss both new compute and drawn keys. The first run can therefore accept the library while storing replacement probes, without comparing the previously stored compute probes described in the PR. Keeping the original one-part key for compute and the two-part key for graphics preserves that check. I separately ran the new drawn probe with freshly created PSOs under Wine 11.22 / VKD3D-Proton 3.1.0 on RTX 4070 SUPER (620.73.4) and Radeon (RADV 26.3.1). On both GPUs the same-sampler draw matched all 12 vectors for each sampler kind. Changing the sampler with the shader code held fixed changed 12 regular vectors and two comparison vectors. The Wine cache scenarios did not exercise the NVIDIA-specific gate, so the upgrade effect above follows from code and the measured keys. MEASURED with synthetic fixtures. AI-assisted (Codex). |
The previous commit hashed an empty vertex part into the compute probes' names, so a library stored before this change missed them all and the first run after it held nothing against the old probes. Stage::name gives a compute probe its code alone, as before, and a drawn one both programs; the_compute_probes_keep_their_names pins it (reported on ProjectLeonida#2919). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @merzleckeier, you are right. The empty vertex part came in with the review fix in Fixed in
So a library stored before this change is still checked against its compute probes on the first run, and the drawn probes are added beside them. AI-assisted: yes (Claude Opus 5.5, via Claude Code). damn an ai assistant thanking someone from your account feels kinda wrong / strange... |
KelboLive
left a comment
There was a problem hiding this comment.
The drawn probe itself is sound: it compares a loaded graphics PSO with a freshly made one of the same desc, and the per-place AND (places.rs:641) only makes same stricter — mutating &= to |= fails the new test (places: "same", graphics wrong: 2). On this host the =1 careless run is also meaningful: compute wrong: 0 / [1,2,3], graphics wrong: 2 / [2,3].
But the compute probe does not keep its library name. places.rs:603 passes [vertex, stored] for both stages; compute's vertex is empty (:776-780), and library::name length-prefixes every part (library.rs:562-568), so the hash changes — I measured old 97583e2c… vs new 0397481c… while the compiled cs_5_1 bytes are identical (3,336 both). Consequence: on the first run after landing, no probe is found, check runs nothing, differ is empty, and same() returns true with same = 0 (places.rs:517-524, :629-632), then stores both baselines at whatever layout it found. That is not "judges by compute alone" — it trusts the library unchecked, and on a machine with moved places it can bless a poisoned drawn baseline. Passing only stored for compute (or otherwise preserving the old names) restores the historical comparison.
Second: the new wrong > 0 graphics assertion encodes 621.40 behaviour, while #2921's measurements say loaded pipelines keep their places on 621.24 — which would make that assertion fail there. Please gate it on the observed driver behaviour or name the supported range.
Two smaller notes:
- The drawn probe has no RTV/DSV, so pixel-shader invocation is driver-dependent; a 1×1 dummy RTV would make it less brittle.
- The timing claim needs a second look:
the_check...measured 4,658 ms stored / 5,337 ms first held against / 480 ms steady, so the "~410 ms" figure matches only the steady state.
Threading is fine: check still runs once through same()'s OnceLock, the probe owns its queue/fence and waits, and Library::load/store are name/save-locked. Merge is clean against current main (ea6caf88), and no textual conflict with #2887/#2921.
|
Thanks @KelboLive for the review. This review is on 1. The compute probes' names. Fixed in 2. The graphics That is the same vector as here on 621.40. The compute pipelines read their own samplers, and the graphics pipeline reads 3. No RTV/DSV. This is UAV-only rendering: a pixel shader with UAV side effects runs without a bound target. D3D11.1 made this explicit, D3D12 keeps it, and a PSO with 4. Timing. Agreed, the "~410 ms" was the steady state only. The PR body now has the table for both branches (store / first check / later starts) and quotes your numbers too. The lasting cost is about 0.2 s per start; the first two runs are dominated by driver compiles and vary. AI-assisted: yes (Claude Opus 5.5, via Claude Code). |
|
Compute probe key follow-up on the updated head Fresh graphics probes again matched all 12 vectors on RTX 4070 SUPER (620.73.4) and Radeon (RADV 26.3.1), under Wine 11.22 / VKD3D-Proton 3.1.0. With only the sampler changed, 12 regular vectors and two comparison vectors changed on each GPU. Each run passed five stock and two additional tests, with eight ignored. This follow-up covers key generation and fresh draws. MEASURED with synthetic fixtures. AI-assisted (Codex). |
KelboLive
left a comment
There was a problem hiding this comment.
Re-checked at e5895f9b8 on RTX 4070 Ti SUPER / 621.01.
- Compute names: fixed.
Stage::name(places.rs:790) passes onlystored, with the same kind string and parts as7fbdf8511;the_compute_probes_keep_their_namespasses, and putting the empty vertex part back fails (b4e5d35b…vs8e67b0f9…). Stored compute probes are found on the first run after landing, and the drawn probes are added beside them. - Graphics
wrong > 0: I withdraw this one. #2921's 621.24 "keeps its places" result is measured with compute pipelines only; its own graphics run readsgas[43,44](wrong 2), and this host reproduces[[6,7],[43,44],[1,2,3]]. So the assertion holds on 616.64 / 621.24 / 621.01 / 621.40, not just 621.40. Only nit: the comment attests.rs:1130could name 621.24/621.01 too. - RTV/timing: not blocking. The draw writes correctly here and on the RADV/VKD3D runs, and the body's table now covers store / first check / later starts (5,272 / 5,497 / 464 ms cold; 267 / 407 / 410 ms warm here).
--lib pipeline::places: 5 passed; -- --ignored: 6 passed, 2 failed — the two 616.64-model tests that are red on main too, not a regression. &=→|= and same = true both fail in ~2 s, so the AND and the per-place comparison still bite. merge-tree against current main is clean (24ae9e45).
621.01 and 621.24 read the loaded graphics pipeline wrong too (KelboLive's re-check), not only 621.40. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Nit done in 33e2e4c: the comment above the careless run now names 621.01, 621.24 and 621.40 for the graphics pipeline, and keeps "compute only at times" to 621.40, where that was measured. Comment-only change; nothing else moved. @KelboLive, with the three points settled, could you approve if you're happy with it? Your earlier review still shows as "changes requested". AI-assisted: yes (Claude Opus 5.5, via Claude Code). |
|
Independent check of
(Unable to collect the ignored Blackwell AI-assisted: Antigravity |
|
A finding this PR should know about, measured while making the tests ask a real card: on driver 621.24, 4 of the 8 They have never been seen failing because the device every test in this crate made came from
What I cannot say: whether these are assertions of a driver behaviour that 621.24 changed (the places note in AI-assisted: yes - DeepSeek v4.1 (flash). Written with an AI assistant. |
|
RTX 3090 / 621.47, 33e2e4c merged onto main 393901a: pipeline::places --ignored is 5 passed / 3 failed on main and 6/2 on the merge. static_samplers_come_from_the_library and every_kind_of_sampler go green; a_stored_pipeline_reads_through_the_places_of_the_run_that_stored_it goes red (left [[6, 7], [43, 44], [1, 2, 3]] right [[45, 46], [43, 44], [40, 41, 42]]); the_table_of_static_samplers stays red. With no places: graphics wrong 2 read [2, 3], compute and sampler wrong 0. |
Claimed in the coordination issue as: D3D12-PLACES-CHECK-GRAPHICS (#2570 (comment))
What and why
Places::check(d3d12/crates/leonida-gpu/src/pipeline/places.rs) decides whether pipelines with static samplers may come from the pipeline library on NVIDIA. It loads a small stored pipeline for each listed place and compares what it samples with the same pipeline made now. Until now it used compute pipelines only.On an RTX 5090 with driver 621.40, a graphics pipeline loaded from the library samples through whatever now sits at its stored places, in every run. Loaded compute pipelines mostly sample through their own samplers wherever those now are. So when static samplers were made before the host's list (the case the check exists for), the check answered
sameand graphics pipelines were loaded through the wrong samplers. Inpipelines_with_static_samplers_come_from_the_library, at stepmake=50,51;host;..., this happened 3 of 3 times onmain:places: "same", and pipegwas loaded withread [2, 3],wrong 2. Measurements are in #2887 (comments from 2026-12-01).The change probes each place twice: with the compute pipeline as before, and with a drawn one. The drawn probe is a graphics pipeline with no render target that draws one pixel (1x1 viewport and scissor) and writes the same buffer from its pixel program. A place counts as
sameonly when every loaded probe agrees with its freshly made twin.ENTRYmacro that expands to the same tokens, andStage::namehashes a compute probe's code alone, asmaindoes.the_compute_probes_keep_their_namespins this without a card (fixed ine5895f9b8after merzleckeier's report).Test changes:
=1) assertion now requires the graphics pipeline to read wrong, instead of every pipeline. On 621.40 compute pipelines read right in most runs.places.rs'sVERTEXandbytecode()instead of their own copies.drawn: falsefield is set where a test builds aRun.Cost, with 320 samplers listed (
the_check_looks_at_every_kind_of_sampler, RTX 5090):mainThe first two columns are dominated by the driver compiling, and they vary between runs (KelboLive measured 4,658 / 5,337 / 480 ms). The lasting cost is about 0.2 s more per start.
Tested
On the card:
cargo test -p leonida-gpu --features diagnostics --lib pipeline::places -- --ignored --nocapture --test-threads=1main7fbdf8511Red to green:
the_check_looks_at_every_kind_of_sampler: onmainit fails withleft: "same" right: "differ". On this branch it findsdiffer.pipelines_with_static_samplers_come_from_the_library: onmainit fails atmake=50,51;host;...(a pipeline read through another sampler). On this branch bothmake=50,51andmake=3wanswerplaces: "differ"and every pipeline is made by the driver withwrong 0.Still red, on
mainand here, and untouched:a_stored_pipeline_reads_through_the_places_of_the_run_that_stored_itandthe_table_of_static_samplers. These assert the 616.64 driver's behaviour for compute pipelines, which #2887 documents.Other checks:
cargo test -p leonida-gpu --lib --locked: 633 passed, 59 ignored.cargo clippy -p leonida-gpu --all-targets --features diagnostics --locked: no warning in the changed files.rustfmt --check: no new differences (four existing ones inplaces/tests.rslines 961-986 are onmainalready).python -I scripts/check_no_game_data.pyon both files: clean.GPUs tested: NVIDIA GeForce RTX 5090, driver 621.40, Windows 11 Pro (native D3D12). Not run on 616.64 or on AMD/Intel. The new probe only runs on NVIDIA, as before.
AI-assisted: yes. Code, tests and measurements: Claude Opus 5.5 (Claude Code). Separate read-only reviewer: Claude Opus 5.5. It found no bugs; its points are applied in the second commit.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code