Test: the water's GenerateTiles tile split on a host of 32-lane waves (ignored, on the card) #1107

Manually merged
github merged 1 commit from github-bot/gh-1107 into main 2026-11-28 19:42:47 +00:00 AGit
Owner

@⁠grosterr on GitHub · 2026-11-28 13:21 UTC · original
grosterr:pr/water-tiles-test → main · +364 −0 · 2 files · 1 commits · merged 2026-11-28 19:39 UTC

A test that keeps the lowering of the water light's tile split honest on hosts of 32-lane waves, as asked in #739. It adds a test file and nothing else; the test is #[ignore] because it runs on the card.

water_shading:CS_TransmissionVolumetrics_GenerateTiles (1aa247ed3653b616) is wave64 with 8x8 threads, one lane per tile. Tiles without water leave at once. The others look for a light in a loop that each lane leaves on its own. Then an if/else appends the tile to one of two lists in one buffer, with the allocation idiom on 64 lanes: s_ff1/s_bcnt1 of EXEC, one buffer_atomic_add (counter at offset 0, or at 32 for the second list), v_readfirstlane, v_mbcnt lo/hi. The second list grows down from the end of the buffer through v_xad_u32. On two host waves of 32 this only holds if the count, the single atomic and the base cover both halves.

crates/victory-shader/src/emit/water_tiles_tests.rs builds a program of that shape with a small assembler. It goes through the production path (spill::build, structure, resource::track, io::raise, emit with a host wave of 32) and lands in the same form as the game's program. VICTORY_WAVE_WHY=1 gives the same three lines for both:

WAVE64-RETRY without early-outs: GFX10 code at ...: a lane mask exchanged where not every lane runs is not supported
WAVE-LOOPS 1 loop branches taken by each host wave together
WAVE64-RETRY without skips: wave Some(32)

The test runs 200 random cases on the card, with water in 100, 90, 50 and 10 % of the tiles and a random light and loop limit per lane. In each case it checks:

  • every tile with water is in exactly one list, the right one;
  • no index repeats;
  • the two counts add up to the tiles that ran.
cargo test --release -p victory-shader --lib water_tiles -- --ignored --nocapture

Checked on this branch (main 63b902f), RTX 3060 12 GB (driver 621.40), Windows 11:

  • the test passes, three times in a row (about 7 s each); with VICTORY_WAVE_WHY=1 it prints the three lines above;
  • cargo clippy -p victory-shader --all-targets: nothing new in the test file; cargo xtask policy: 295 files ok.
  • it also passes with VICTORY_LOOPS_WAVE=0. So the test does not catch NVIDIA's lanes that do not reconverge after the loop (one group only); it checks the split's lowering.

The dark tiles at the buoy in #739 turned out to be in _Tiled, not in this split; #888 fixes them on our build (details in #739).

AI-assisted (Claude Code): Claude wrote the test and this text; I ran it on my PC. No game files: the program is assembled in the test.

🤖 Generated with Claude Code

**@⁠grosterr** on GitHub · 2026-11-28 13:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1107) `grosterr:pr/water-tiles-test` → `main` · +364 −0 · 2 files · 1 commits · merged 2026-11-28 19:39 UTC A test that keeps the lowering of the water light's tile split honest on hosts of 32-lane waves, as asked in #739. It adds a test file and nothing else; the test is `#[ignore]` because it runs on the card. `water_shading:CS_TransmissionVolumetrics_GenerateTiles` (`1aa247ed3653b616`) is wave64 with 8x8 threads, one lane per tile. Tiles without water leave at once. The others look for a light in a loop that each lane leaves on its own. Then an if/else appends the tile to one of two lists in one buffer, with the allocation idiom on 64 lanes: `s_ff1`/`s_bcnt1` of EXEC, one `buffer_atomic_add` (counter at offset 0, or at 32 for the second list), `v_readfirstlane`, `v_mbcnt` lo/hi. The second list grows down from the end of the buffer through `v_xad_u32`. On two host waves of 32 this only holds if the count, the single atomic and the base cover both halves. `crates/victory-shader/src/emit/water_tiles_tests.rs` builds a program of that shape with a small assembler. It goes through the production path (`spill::build`, `structure`, `resource::track`, `io::raise`, `emit` with a host wave of 32) and lands in the same form as the game's program. `VICTORY_WAVE_WHY=1` gives the same three lines for both: ``` WAVE64-RETRY without early-outs: GFX10 code at ...: a lane mask exchanged where not every lane runs is not supported WAVE-LOOPS 1 loop branches taken by each host wave together WAVE64-RETRY without skips: wave Some(32) ``` The test runs 200 random cases on the card, with water in 100, 90, 50 and 10 % of the tiles and a random light and loop limit per lane. In each case it checks: - every tile with water is in exactly one list, the right one; - no index repeats; - the two counts add up to the tiles that ran. ``` cargo test --release -p victory-shader --lib water_tiles -- --ignored --nocapture ``` Checked on this branch (main `63b902f`), RTX 3060 12 GB (driver 621.40), Windows 11: - the test passes, three times in a row (about 7 s each); with `VICTORY_WAVE_WHY=1` it prints the three lines above; - `cargo clippy -p victory-shader --all-targets`: nothing new in the test file; `cargo xtask policy`: 295 files ok. - it also passes with `VICTORY_LOOPS_WAVE=0`. So the test does not catch NVIDIA's lanes that do not reconverge after the loop (one group only); it checks the split's lowering. The dark tiles at the buoy in #739 turned out to be in `_Tiled`, not in this split; #888 fixes them on our build (details in #739). AI-assisted (Claude Code): Claude wrote the test and this text; I ran it on my PC. No game files: the program is assembled in the test. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:33:27 +00:00
Author
Owner

@⁠Exopus-0x65f7ad0 on GitHub · 2026-11-28 13:39 UTC · original

Same result on a second architecture: RTX 5060 Ti 8 GB (Blackwell, 10de:2d04), Windows 11 26300, native D3D12. 63b902f + this PR.

  • cargo test --release -p victory-shader --lib water_tiles -- --ignored --nocapture → passed twice (6.35 s and 6.37 s).
  • With VICTORY_WAVE_WHY=1, the same three lines you listed:
    WAVE64-RETRY without early-outs: GFX10 code at 0xe0: a lane mask exchanged where not every lane runs is not supported
    WAVE-LOOPS 1 loop branches taken by each host wave together
    WAVE64-RETRY without skips: wave Some(32)
    
**@⁠Exopus-0x65f7ad0** on GitHub · 2026-11-28 13:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1107#issuecomment-7240096175) Same result on a second architecture: RTX 5060 Ti 8 GB (Blackwell, `10de:2d04`), Windows 11 26300, native D3D12. `63b902f` + this PR. - `cargo test --release -p victory-shader --lib water_tiles -- --ignored --nocapture` → **passed twice** (6.35 s and 6.37 s). - With `VICTORY_WAVE_WHY=1`, the same three lines you listed: ``` WAVE64-RETRY without early-outs: GFX10 code at 0xe0: a lane mask exchanged where not every lane runs is not supported WAVE-LOOPS 1 loop branches taken by each host wave together WAVE64-RETRY without skips: wave Some(32) ```
github-bot referenced this pull request from a commit 2026-11-28 19:41:56 +00:00
github manually merged commit e362226ea7 into main 2026-11-28 19:42:47 +00:00
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/trustno1-coder--VIctory-NVIDIA!1107
No description provided.