Skip to content

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

Merged
trustno1-coder merged 1 commit into
trustno1-coder:mainfrom
grosterr:pr/water-tiles-test
Nov 28, 2026
Merged

trustno1-coder merged 1 commit into
trustno1-coder:mainfrom
grosterr:pr/water-tiles-test

Conversation

@grosterr

Copy link
Copy Markdown
Contributor

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

… (ignored, on the card)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Exopus-0x65f7ad0

Copy link
Copy Markdown

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

3 participants