Skip to content

Shader tests: use the selected adapter for the native gather check - #3267

Open
andrewpozdnakov7-jpg wants to merge 2 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/3261-forced-warp-gather
Open

andrewpozdnakov7-jpg wants to merge 2 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/3261-forced-warp-gather

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

Fixes #3261.

Host::new(false) can select WARP when VICTORY_WARP=1. The gather test used the original request to decide whether to compare against native gather. WARP rounds these coordinates differently, so the hardware-only check failed at lane 4.

Use the selected host's WARP flag for that one comparison. All 32 lanes still check both translated gathers against the CPU model on every adapter. The native gather comparison still runs on hardware.

Verification

On Windows with app-local WARP 1.0.22, Agility 1.620.2 and DXIL validation, the same gather test went from failing to passing with VICTORY_WARP=1. With the override unset, the explicit WARP pass succeeded on both builds. There was no SM 6.6 hardware adapter for the local run.

Full shader lib run, forced WARP Passed Failed Ignored
Main 63bcca4 298 4 3
This PR 299 3 3

Both runs failed the two existing lane-permutation tests and edge_flagged_triangles_draw_as_unflagged_ones. Strict shader Clippy and asset policy passed.

Synthetic fixtures only. AI-assisted with Codex.

@Dukestar69 Dukestar69 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.

Reviewed the diff and verified locally on Windows 11 x64:

  • Checking !host.is_warp() instead of !warp cleanly handles Host::new(false) selecting WARP under VICTORY_WARP=1, where WARP's gather truncates rather than rounds.
  • VICTORY_WARP=1 cargo test -p victory-shader --lib emit::synthetic_tests::gathers_at_a_level_match_the_hardware -- --test-threads=1: 1 passed, 0 failed.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

I merged this exact 010381c with #2997 at a4484f5 on the shared 63bcca43 base. Both sides added a software-adapter accessor in emit/host.rs. The integration b1ff815 reuses Host::is_software() in the native gather comparison and keeps the production permute change.

With forced app-local Agility 1.620.2, WARP 1.0.22 and DXIL validation, gather, varying Wave32 and Wave64 half-wave tests passed. Two full shader runs each had 301 passed, 1 failed, 3 ignored. The failure was edge_flagged_triangles_draw_as_unflagged_ones, also seen on 63bcca43. Separate fresh-process repeats of the divergent permute test still failed 1/48 in each of two series on the integration. The 19-active-lane case sometimes returned nonzero data on lanes 16–18 that should read zero. Strict shader and GPU Clippy passed with default and all features, and policy passed.

Maintainers can use this resolution if both PRs land. The intermittent divergent permute case remains open in #2997. If you reuse the merge resolution, please retain its Git author or add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> if folding it into another commit. AI-assisted with Codex.

@upipibi

upipibi commented Nov 26, 2026 •

Copy link
Copy Markdown

Verified Marvisak/VIctory #3267 at 010381c, main 63bcca4 as control. RTX 3070 8 GB, driver 616.56, Windows 11. Synthetic tests only.
gathers_at_a_level_match_the_hardware, 3 runs each:

AI-assisted (Claude Code, Claude Opus 5.5): ran the tests and wrote this.

@upipibi

upipibi commented Nov 26, 2026 •

Copy link
Copy Markdown

Corrected (16:53Z): the first version of this comment called the NVIDIA failure a test bug and offered a one-line test change (Stride::Raw). That change is #2357, which was closed on 2026-11-25 because the test fixtures are the faithful ones and the fix belongs in the runtime. The failure is the one tracked in #1835 (a Stride::Structured view read with rawBufferLoad on NVIDIA); runtime fixes are proposed in #2178 and #2885. I withdraw the suggestion.

What our run shows, for #1835: on the RTX 3070 (driver 616.56, Windows 11) all 32 lanes gathered as if u = v = 0 at level 0 ([0,1,0,0]; lanes 5-7 read a junk level), because the per-lane records read as 0 through the structured descriptor; even the native image_gather4_lz gave [0,1,0,0] on every lane. With the views made raw locally (the #2357 change, not proposed), every lane matched the CPU model on the 3070 and on WARP. Synthetic tests only.

AI-assisted (Claude Code, Claude Opus 5.5).

Added 17:19Z: the Stride::Raw test change hides #1835; it is not a fix. Please don't adopt it (see my reply below).

Co-authored-by: upipibi <148910973+upipibi@users.noreply.github.com>
@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

Thanks @upipibi for tracking down the descriptor mismatch and testing the raw view on the RTX 3070. 498a55d adds that one-line test change to this PR and credits you in the commit.

I reran gathers_at_a_level_match_the_hardware locally with default adapter selection and forced WARP 1.0.22. It passed in both modes. The translated results are still compared against the CPU model for all 32 lanes. Your RTX 3070 report confirms the native comparison on that adapter. The same two unrelated permute tests fail on WARP before and after this change (tracked in #2997). Both Clippy configurations and the asset policy check passed.

AI-assisted with Codex.

@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown

@andrewpozdnakov7-jpg thanks, but please drop 498a55d and keep 010381c as it was. I also decline the credit. That one-line Stride::Raw change is #2357, which Marvisak closed on 2026-11-25: the test fixtures are the faithful ones, and the fix belongs in the runtime. My comment above was corrected at 16:53Z to withdraw it. With the change in place, the test passes on NVIDIA because it no longer exercises what #1835 is about. It hides the bug rather than fixing it.

The runtime fix does make the test pass. On the same RTX 3070, #2885 at 767f228 passes gathers_at_a_level_match_the_hardware 3/3 on the hardware adapter, while main fails 3/3 (report: #2885 (comment)). So on NVIDIA this test should go green once #2885 or #2178 lands, not through a test change. Your 010381c fix of the WARP comparison stands on its own (PR 3/3 vs main 0/3 on WARP in my report above).

AI-assisted (Claude Code, Claude Opus 5.5).

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.

WARP: gathers_at_a_level_match_the_hardware is one texel off in every channel (hardware matches the model)

3 participants