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

Open
github-bot wants to merge 2 commits from github-bot/gh-3267 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 15:06 UTC · original
andrewpozdnakov7-jpg:fix/3261-forced-warp-gather → main · +9 −3 · 2 files · 2 commits · open

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 15:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/3267) `andrewpozdnakov7-jpg:fix/3261-forced-warp-gather` → `main` · +9 −3 · 2 files · 2 commits · open 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:08:07 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 15:29 UTC · original · approved these changes

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).

**@⁠Dukestar69** on GitHub · 2026-11-26 15:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/3267#pullrequestreview-6076780263) · **approved these changes** 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).
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 16:21 UTC · original

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 <[email protected]> if folding it into another commit. AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 16:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/3267#issuecomment-7197535089) 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`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/b1ff8152fe631d6266cacb29a61e3660e038f035) 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 <[email protected]>` if folding it into another commit. AI-assisted with Codex.
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 16:39 UTC · original · edited 2026-11-26 16:53 UTC

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

  • VICTORY_WARP=1: PR passes 3/3; main fails 3/3 at lane 4 "against its gather" (left [66,67,35,34], right [65,66,34,33]). Confirms the fix.
  • Default adapter (DXGI adapter 0, the RTX 3070 here; the log does not print its name): fails 3/3 on both PR and main, identically, at lane 0 vs the CPU model (got [0,1,0,0], expected [0,0,0,0]), before the native-gather check is reached. So the PR does not change the NVIDIA result; this is the NVIDIA failure tracked in #1835 (Stride::Structured views read with rawBufferLoad), with runtime fixes proposed in #2178 and #2885.
    cargo xtask policy: 191 files ok. clippy -p victory-shader --all-targets --locked -D warnings: clean.

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

**@⁠upipibi** on GitHub · 2026-11-26 16:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/3267#issuecomment-7197934872) · edited 2026-11-26 16:53 UTC Verified Marvisak/VIctory #3267 at 010381cc9f5ff440c6ad4faec5810b2b6cf06e85, main 63bcca43 as control. RTX 3070 8 GB, driver 616.56, Windows 11. Synthetic tests only. gathers_at_a_level_match_the_hardware, 3 runs each: - VICTORY_WARP=1: PR passes 3/3; main fails 3/3 at lane 4 "against its gather" (left [66,67,35,34], right [65,66,34,33]). Confirms the fix. - Default adapter (DXGI adapter 0, the RTX 3070 here; the log does not print its name): fails 3/3 on both PR and main, identically, at lane 0 vs the CPU model (got [0,1,0,0], expected [0,0,0,0]), before the native-gather check is reached. So the PR does not change the NVIDIA result; this is the NVIDIA failure tracked in #1835 (`Stride::Structured` views read with `rawBufferLoad`), with runtime fixes proposed in #2178 and #2885. cargo xtask policy: 191 files ok. clippy -p victory-shader --all-targets --locked -D warnings: clean. AI-assisted (Claude Code, Claude Opus 5.5): ran the tests and wrote this.
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 16:47 UTC · original · edited 2026-11-26 17:19 UTC

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).

**@⁠upipibi** on GitHub · 2026-11-26 16:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/3267#issuecomment-7198106638) · edited 2026-11-26 17:19 UTC **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).
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:01 UTC · original

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 17:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3267#issuecomment-7198384134) Thanks @⁠upipibi for tracking down the descriptor mismatch and testing the raw view on the RTX 3070. [498a55d](https://github.com/Marvisak/VIctory/commit/498a55d92f2fe8989509601cf2663bdaef02ada9) 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](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3267) 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.
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 17:19 UTC · original

@⁠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). 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).

**@⁠upipibi** on GitHub · 2026-11-26 17:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/3267#issuecomment-7198822329) @⁠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: https://git.gtahub.st/github/Marvisak--VIctory/pulls/2885). 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).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3267/head:github-bot/gh-3267'
git switch 'github-bot/gh-3267'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3267'
git switch 'github-bot/gh-3267'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3267'
git switch 'github-bot/gh-3267'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3267'
git switch 'main'
git merge --squash 'github-bot/gh-3267'
git switch 'main'
git merge --ff-only 'github-bot/gh-3267'
git switch 'main'
git merge 'github-bot/gh-3267'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3267
No description provided.