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

Merged
grosterr merged 1 commit from upstream-pr/1107 into main 2026-11-28 19:39:38 +00:00
grosterr commented 2026-11-28 13:21:44 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by grosterr on 2026-11-28T13:21:44Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5540548105 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1107). Originally posted by [grosterr](https://github.com/grosterr) on 2026-11-28T13:21:44Z. --- 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)
Exopus-0x65f7ad0 commented 2026-11-28 13:39:50 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Exopus-0x65f7ad0 on 2026-11-28T13:39:50Z.


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)
    
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7240096175 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1107#issuecomment-7240096175). Originally posted by [Exopus-0x65f7ad0](https://github.com/Exopus-0x65f7ad0) on 2026-11-28T13:39:50Z. --- 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) ```
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!1107
No description provided.