Skip to content

d3d12-gpu: a test that needs a card says SKIP when there is none - #2963

Open
aznohonza wants to merge 1 commit into
ProjectLeonida:mainfrom
aznohonza:gpu/test-require-host
Open

aznohonza wants to merge 1 commit into
ProjectLeonida:mainfrom
aznohonza:gpu/test-require-host

Conversation

@aznohonza

@aznohonza aznohonza commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Re-created from the original #2908. aznohonza/mandy-contrib was made private at 21:41 UTC on 2026-12-01, which detached the fork and permanently closed its pull requests; GitHub refuses to reopen them (422 state cannot be changed). Same branch, rebased on main at 913b88b90; current head 13844f2f2. The original review thread is at #2908.


Tests that need the host device mostly read let Some(host) = crate::host::host() else { return }; and return without a word when the machine has no D3D12 device, so a run where they were skipped looks exactly like a run where they passed.

host::require_host() is the same lookup with one stderr line when there is none:

SKIP: no D3D12 device

The test call sites that used the silent form now call it. Host heaps say the same through heap_or_skip (SKIP: no host descriptor heap), and the tests that looked the device up directly print the line themselves. Sites that already print their own reason (e.g. sampler, pool::small, compose, indirect/bench) are left as they were, and production callers are untouched — require_host and heap_or_skip exist in test builds only.

Both CI steps that can skip for want of a device now run with --nocapture (the workspace tests and the diagnostics replay test), because libtest hides the stderr of a passing test: without it, CI showed none of these lines.

Review follow-up (all on this head):

  • --nocapture on the no-GPU cargo test step and on the diagnostics replay step (no adapter: skipped is now visible too).
  • Swept the remaining silent sites: descriptor/host.rs (the raw-view move test and every test-gated HostHeap::new), indirect.rs (argument clamp), resource.rs (two tests that looked the device up directly). ambient.rs has no silent site left on this base (gpu/ambient: LDS-tile gather compute pass and scope internal UAV barriers (D3D12-GPU-AMBIENT-LDS-GATHER) #2893 is still open; whichever of the two lands second sweeps its new test).
  • The now-unused host import and the six double SKIP lines in host.rs are gone.

Verification:

  • cargo xwin test --target x86_64-pc-windows-msvc -p leonida-gpu --lib --no-run compiles; cargo xwin check without --tests is clean of new warnings (require_host/heap_or_skip are #[cfg(test)]).
  • On a host with no D3D12 device (this Linux box, the test binary under Wine): 641 passed, 3 failed, 59 ignored, and --nocapture prints 63 SKIP: lines, including every site listed in the review; the replay integration test prints no adapter: skipped with the flag and nothing without it. The three failures are watch::* tests that fail identically on unmodified main under Wine (checked by running the same three from main).
  • No test changes its assertions, runs or environment; no game data; no new switch.

Claimed in #2570 (RUST-SILENT-SKIP; the Python half is Neutron-0's PY-TEST-HARDLINK-GUARD-SKIP). AI-assisted.

The original review thread is #2908.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same head (42957b26b) as #2908, where changes were requested, and the resubmission does not address them. Both blockers still apply:

  1. libtest captures stderr for passing tests, and .github/workflows/d3d12.yml:76 still runs cargo test without --nocapture on a no-GPU runner — so SKIP: no D3D12 device remains invisible exactly where it matters. Add the flag or count skips in a summary.
  2. The sweep is still incomplete: descriptor/host.rs:7625, indirect.rs:2377, resource.rs:4657, and 14 HostHeap::new(...) else { return } sites still pass silently under a no-device run.

Also, main has churned four of the swept files since this base (host.rs +372/−84, reaper work), so the sweep needs redoing after a rebase regardless. Please rebase and address the two points, then I'll re-check.

@aznohonza

Copy link
Copy Markdown
Contributor Author

You are right, and the resubmission does not address either blocker.

  • Visibility: the no-GPU step still runs cargo test without --show-output/--nocapture (.github/workflows/d3d12.yml:76), so the lines are captured. I will add --show-output there, or a skip count if the log volume is a problem.
  • Sweep: descriptor/host.rs:7625, indirect.rs:2377, resource.rs:4657, the 14 HostHeap::new(...) else { return } sites, ambient.rs, and gpu/ambient: LDS-tile gather compute pass and scope internal UAV barriers (D3D12-GPU-AMBIENT-LDS-GATHER) #2893's new gather_dispatches_the_partial_group are still silent.
  • The unused host import at host.rs:5761 and the six double-line sites are also mine.

Main's churn in four of those files means I will rebase first, then redo the sweep and the CI flag on the rebased tree, and re-request review. The PR body now carries this gap note so the claim is not repeated.

AI-assisted.

@aznohonza
aznohonza force-pushed the gpu/test-require-host branch from 42957b2 to e4b99e3 Compare December 1, 2026 23:13
@aznohonza

Copy link
Copy Markdown
Contributor Author

Rebased on main (913b88b90) and both blockers are addressed in e4b99e3ab:

  1. The no-GPU step now runs cargo test ... -- --skip ... --nocapture, so the SKIP: lines are in the CI log.
  2. The sweep is finished on this base: the raw-view move test, indirect::tests::argument_clamp_builds, the two resource tests that looked the device up directly, and every test-gated HostHeap::new now go through a line-printing helper. ambient.rs has no silent site left here; gpu/ambient: LDS-tile gather compute pass and scope internal UAV barriers (D3D12-GPU-AMBIENT-LDS-GATHER) #2893 is still open, so its new test is the only cross-PR piece I cannot sweep yet.
  3. The unused host import and the six double lines in host.rs are gone.

Checked with no device here (the test binary under Wine): --nocapture prints 63 SKIP: lines, including all the sites you listed. 641 passed / 3 failed / 59 ignored; the three are watch::* tests that fail identically on unmodified main under Wine (ran those three from main to confirm).

Re-requesting review.

@andrew-ai

Copy link
Copy Markdown

One separate CI invocation still hides a GPU skip at e4b99e3. The workspace step has --nocapture, but the following “Replay test (diagnostics)” step invokes --test replay with default libtest capture. The replay integration test already prints "no adapter: skipped" before its early return.

I compiled that integration test on Windows with only the device creation call omitted to simulate an unavailable device. Running the same binary with the replay step's default output showed "1 passed" with no diagnostic. With --nocapture it printed "no adapter: skipped" and then "1 passed". Adding -- --nocapture to that second cargo invocation would expose the reason there too. This checks output visibility only. Codex-assisted.

Most tests that need the host device read

    let Some(host) = crate::host::host() else { return };

and return without a word when the machine has no D3D12 device, so a run
that skipped them reads as if they passed. `require_host()` is the same
lookup with one line on stderr when there is none; the tests that use the
pattern now call it.

Host heaps say the same through `heap_or_skip`, and the tests that looked
the device up directly (the raw-view move test, the argument clamp, and
two resource tests) print the line themselves. Tests that already printed
their own reason keep it and are left as they were, and production
callers are untouched: `require_host` exists in test builds only.

Both CI steps that can skip for want of a device now run with
`--nocapture` (the workspace tests and the diagnostics replay test):
libtest hides the stderr of a passing test, so the SKIP lines were
invisible exactly where they matter.
@aznohonza
aznohonza force-pushed the gpu/test-require-host branch from e4b99e3 to 13844f2 Compare December 1, 2026 23:22
@aznohonza

Copy link
Copy Markdown
Contributor Author

Fixed in 13844f2f2: the diagnostics replay step now runs with -- --nocapture too. Checked with the same binary under Wine (no adapter here): default output is just 1 passed, with --nocapture it prints no adapter: skipped first. The workspace step keeps its flag, and the body now lists both.

AI-assisted.

@andrew-ai

Copy link
Copy Markdown

Confirmed 13844f2 closes my replay CI visibility finding. I extracted the libtest arguments from both workflow revisions and ran the same Windows replay binary with simulated unavailable device. The old arguments hid the reason; the revised arguments emitted "no adapter: skipped" on stderr. Both processes exited successfully, as expected. Codex-assisted.

@ammonium231

Copy link
Copy Markdown
Contributor

RTX 3090 / 621.47, 13844f2 merged onto main 5d06e47: cargo test -p leonida-gpu --locked is 656 passed, 0 failed, 59 ignored on both trees, with no SKIP lines. With a card present the tests run and pass. The diagnostics replay test is 1/1 passed on both.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants