Test/shader random vs ms #3591

Open
Levichu51 wants to merge 4 commits from upstream-pr/3591 into main
Levichu51 commented 2026-11-27 19:36:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Levichu51 on 2026-11-27T19:36:03Z.


Builds on #1335. Until that lands, this branch also carries its three commits; only the last one, cc3cae5, is new here.

Why

The random-program test from #1335 generates compute and pixel programs only. Vertex and mesh programs go through their own I/O and export lowering (position, parameters, primitives, mesh limits), and the world is drawn with mesh programs. A panic in that code also ends the title.

What

The generator now makes four stages: compute 45%, pixel 25%, vertex 15%, mesh 15%. What each program reads and exports beyond the basics comes from a Shape drawn from the seed alone, and its container's signatures match it.

Stage Varies
vertex (wave32/64) attribute from v4 (v2, the primitive id, mostly overwritten first since the translation refuses it); param0 as f32, 16-bit, or two 16-bit rows per dword; pos0, and clip distances in pos1
mesh (1–4 waves of 32/64) user data from s8 (the generator's registers move with it); group id read from the first lane, then v5 freed; per-vertex and per-primitive (PSG1) parameters; exp prim with a valid triangle or random indices; pos0; vertex/primitive limits now and then past the host's; lines 1 in 20
pixel interpolation mostly as well-formed p1/p2 pairs over v0/v1, in f32 or completed with v_interp_p2_f16 into either half; a 16-bit input; depth and stencil (exp mrtz) after the colour

While measuring coverage I found and fixed two mistakes in the generator:

  • s_buffer_* used a root table's address as their descriptor, which mixed root parameters into it;
  • SGPR destinations landed on the loaded descriptors too often.

Compute programs translate a bit more often as a result.

Coverage

Of 16,384 programs, every stage and every Shape variant translates some:

compute mesh vertex pixel
translated ~13% ~6% ~4% ~2.5%

The test now fails if any stage translates under 1% of its programs. I checked this: with mesh made to draw lines only, it fails with Ms: 0 of 632 random programs translated.

Results

  • 2,100,000 programs pass in release with overflow checks; 600,000 of them also with debug assertions. No translator bug found.
  • Default run: 4,096 programs, about 2 s.
  • cargo test -p victory-shader: 174 passed
  • cargo clippy -p victory-shader --all-targets [--all-features] --target x86_64-pc-windows-msvc -- -D warnings: clean
  • rustfmt on the changed file: clean; cargo xtask policy: ok

As with #1335, I ran it on Linux only. The Windows target was checked with clippy, not run; the test uses no GPU and no dxil.dll.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5532135053 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3591). Originally posted by [Levichu51](https://github.com/Levichu51) on 2026-11-27T19:36:03Z. --- Builds on #1335. Until that lands, this branch also carries its three commits; only the last one, `cc3cae5`, is new here. ## Why The random-program test from #1335 generates compute and pixel programs only. Vertex and mesh programs go through their own I/O and export lowering (position, parameters, primitives, mesh limits), and the world is drawn with mesh programs. A panic in that code also ends the title. ## What The generator now makes four stages: compute 45%, pixel 25%, vertex 15%, mesh 15%. What each program reads and exports beyond the basics comes from a `Shape` drawn from the seed alone, and its container's signatures match it. | Stage | Varies | |---|---| | vertex (wave32/64) | attribute from v4 (v2, the primitive id, mostly overwritten first since the translation refuses it); `param0` as f32, 16-bit, or two 16-bit rows per dword; `pos0`, and clip distances in `pos1` | | mesh (1–4 waves of 32/64) | user data from s8 (the generator's registers move with it); group id read from the first lane, then v5 freed; per-vertex and per-primitive (`PSG1`) parameters; `exp prim` with a valid triangle or random indices; `pos0`; vertex/primitive limits now and then past the host's; lines 1 in 20 | | pixel | interpolation mostly as well-formed `p1`/`p2` pairs over v0/v1, in f32 or completed with `v_interp_p2_f16` into either half; a 16-bit input; depth and stencil (`exp mrtz`) after the colour | While measuring coverage I found and fixed two mistakes in the generator: - `s_buffer_*` used a root table's address as their descriptor, which mixed root parameters into it; - SGPR destinations landed on the loaded descriptors too often. Compute programs translate a bit more often as a result. ## Coverage Of 16,384 programs, every stage and every `Shape` variant translates some: | | compute | mesh | vertex | pixel | |---|---|---|---|---| | translated | ~13% | ~6% | ~4% | ~2.5% | The test now fails if any stage translates under 1% of its programs. I checked this: with mesh made to draw lines only, it fails with `Ms: 0 of 632 random programs translated`. ## Results - 2,100,000 programs pass in release with overflow checks; 600,000 of them also with debug assertions. No translator bug found. - Default run: 4,096 programs, about 2 s. - `cargo test -p victory-shader`: 174 passed - `cargo clippy -p victory-shader --all-targets [--all-features] --target x86_64-pc-windows-msvc -- -D warnings`: clean - rustfmt on the changed file: clean; `cargo xtask policy`: ok As with #1335, I ran it on Linux only. The Windows target was checked with clippy, not run; the test uses no GPU and no `dxil.dll`.
futurepro62 commented 2026-11-29 17:06:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-29T17:06:28Z.


Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head cc3cae5 (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: random_programs_translate_or_are_refused_the_same_way_every_time, random_programs_are_reproducible_from_their_seed.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7259427346 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3591#issuecomment-7259427346). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-29T17:06:28Z. --- Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `cc3cae5` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **868 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `random_programs_translate_or_are_refused_the_same_way_every_time`, `random_programs_are_reproducible_from_their_seed`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Levichu51 commented 2026-11-29 19:18:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Levichu51 on 2026-11-29T19:18:14Z.


Thanks for the full run. Two corrections to my description: the default run takes about 4.5-5 s in a debug build, not 2 s, and the per-stage translation rates come from 8,192 programs, not 16,384.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7261172306 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3591#issuecomment-7261172306). Originally posted by [Levichu51](https://github.com/Levichu51) on 2026-11-29T19:18:14Z. --- Thanks for the full run. Two corrections to my description: the default run takes about 4.5-5 s in a debug build, not 2 s, and the per-stage translation rates come from 8,192 programs, not 16,384.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3591:upstream-pr/3591'
git switch 'upstream-pr/3591'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3591'
git switch 'upstream-pr/3591'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3591'
git switch 'upstream-pr/3591'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3591'
git switch 'main'
git merge --squash 'upstream-pr/3591'
git switch 'main'
git merge --ff-only 'upstream-pr/3591'
git switch 'main'
git merge 'upstream-pr/3591'
git push origin 'main'
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
Marvisak/VIctory!3591
No description provided.