Skip to content

listed_raw_twin: return where the host makes no raw twins - #2911

Open
fiestorra wants to merge 1 commit into
ProjectLeonida:mainfrom
fiestorra:raw-twin-skips
Open

fiestorra wants to merge 1 commit into
ProjectLeonida:mainfrom
fiestorra:raw-twin-skips

Conversation

@fiestorra

Copy link
Copy Markdown
Contributor

The test says in its own ignore why it exists — "offscreen descriptor probe requiring a host with raw view twins" — and then, on a host without them, compares 0 with 0:

assertion `left != right` failed: the host must allocate raw twins
  left: 0
  right: 0

assert_ne!(0, 0, "the host must allocate raw twins") cannot tell "this host makes no twins" from "the twins this host makes are wrong", and its message chooses the second.

A host that does not make raw view twins is the case the probe does not apply to, and it is exactly what the ignore attribute says. So it now returns with a line saying so:

this host makes no raw view twins: the probe does not apply here

which is what the other card probes in this crate already do — the_table_of_static_samplers returns when there is no card, and the upcheck tests name the variable they need instead of asserting into a wall.

Nothing else changes: a host that does make raw twins runs the same probe, the same reads and the same comparisons as before.

Measured on an RTX 4090 with 621.24, where HostHeap::new(false, 4) makes none:

cargo test -p leonida-gpu --features diagnostics --lib listed_raw_tests -- --ignored --nocapture --test-threads=1
  ok. 2 passed; 0 failed
  prints "this host makes no raw view twins: the probe does not apply here"

AI-assisted: yes — DeepSeek v4.1 (flash), which ran the whole card suite to find this one.

Written with an AI assistant.

The test says in its own `ignore` why it exists - "offscreen descriptor probe
requiring a host with raw view twins" - and then, on a host without them,
compares 0 with 0:

  assertion `left != right` failed: the host must allocate raw twins
  left: 0
  right: 0

which reads as a host that is broken rather than as a probe that does not apply
to it. `assert_ne!(0, 0, ...)` cannot tell the two apart and its message does
not try.

Now it returns with a line saying so, which is what the other card probes in
this crate do (`the_table_of_static_samplers` returns when there is no card,
and the upcheck tests name the variable they need). Nothing else changes: a
host that does make raw twins runs the same probe as before.

Measured on an RTX 4090 with 621.24, where HostHeap::new(false, 4) makes none:

  cargo test -p leonida-gpu --features diagnostics --lib listed_raw_tests
      -- --ignored --nocapture --test-threads=1
    ok, 2 passed; prints "this host makes no raw view twins: the probe does not apply here"

Written with an AI assistant.
@merzleckeier

Copy link
Copy Markdown
Contributor

Independent raw-twin probe matrix at acd5e00c0 + 27613ab6b, Win64 under Wine 11.22 and VKD3D-Proton 3.1.0. I ran the exact ignored listed_off_alignment_raw_twin_readback test with LEONIDA_RAW_VIEWS=0 and =1 on both AMD Radeon (RADV 26.3.1) and the GeForce RTX 4070 SUPER (620.73.4 as reported by Wine).

Main fails at the raw-twin availability assertion in all four cases. With this PR, all four runs print this host makes no raw view twins: the probe does not apply here and exit successfully. On these two Wine adapters, enabling the setting still reaches that early return. The evidence covers the unsupported-host path before readback.

MEASURED with the offscreen test. AI-assisted (Codex).

@Kal0s-design

Copy link
Copy Markdown
Contributor

Verified on Windows 11 on a second card, a different NVIDIA generation from the one in the description, with the native D3D12 driver.

Head acd5e00c0, which already contains main d2a564b66.

cargo test -p leonida-gpu --features diagnostics --lib listed_raw_tests -- --ignored --nocapture --test-threads=1:

  • with this PR: 2 passed. listed_off_alignment_raw_twin_readback prints this host makes no raw view twins: the probe does not apply here, and dump_buffer_view_descriptor_bytes still runs.
  • with main's version of the file put back: fails at listed_raw_tests.rs:33 with the host must allocate raw twins (left: 0, right: 0).

So HostHeap::new(false, 4) makes no raw twins on this host either, and the old assert reported that as a broken host. The return is only taken when heap.raw == 0, so a host that does make twins runs the same probe as before. I could not exercise that path here.

GPUs tested: one NVIDIA card, native driver, model not given.

AI-assisted: yes (Claude Code).

@KelboLive KelboLive left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returning here is safe for the only caller: the ignored test is #[cfg(test)]-only, and the guard precedes cpu, the buffers and the first SetDescriptorHeaps at :101, so no binding or cleanup is skipped, and heap drops normally. The mutation confirms the guard is the right one — flipping it to != 0 fails at :193 with 0x80000004 vs 0x84000004.

But it is not the only option, and it costs coverage on exactly the hosts that hit it. On this RTX 4070 Ti SUPER (heap.raw == 0), the sibling's synthetic heap.raw = 64 + 32 twins fallback (sub_dword..., :305-311) makes the full probe pass 1/1 — I swapped the return for that fallback and got all three biases. So this turns the probe into a no-op on NVIDIA rather than preserving the check. If you keep the return, I would at least prefer the fallback, since the machinery already exists two tests above.

Two caveats if it stays:

  • heap.raw == 0 also covers LEONIDA_RAW_VIEWS=0 and a regression in probe_view_limit's 4M-descriptor fit — so a real regression now passes silently. Wording the skip as "raw twins are off" and checking twin_bias() (as the sibling does at :299) would narrow that.
  • The probe still calls host().expect(...) at :30, so a machine with no device panics before reaching the guard; #2908's require_host() does not touch this test.

Non-blocking: shader suite 414/5/0, both ignored tests pass here, and merge-tree with main is clean. Note #2834 rewrites this same test into a listed_readback(bool) helper — whichever lands second must reapply the guard (or the fallback) there.

@merzleckeier

Copy link
Copy Markdown
Contributor

Positive raw-twin readback check for the new early return at acd5e00c on main 60f7dcd9, using the exact ignored listed_off_alignment_raw_twin_readback case under Wine 11.22 / VKD3D-Proton 3.1.0 on RTX 4070 SUPER (620.73.4) and Radeon (RADV 26.3.1).

With stock heap limits and raw views enabled, main hit the raw-twin assertion on both adapters. The PR printed its early-return message on both. I then reduced the heap limits in a local test build so these adapters could create the raw twins. On that same build, explicit raw views off still printed the early-return message, and raw views on reached DX12 readback and passed on both adapters. The readback verified listed-twin and public transfers at all three source/target bias pairs (4/12, 8/8, 12/4).

MEASURED with synthetic buffers and a local smaller-heap positive control. AI-assisted (Codex).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants