Shader tests: snapshot of which ALU instructions lower (catches lowerings lost in a merge) #81

Open
github-bot wants to merge 3 commits from github-bot/gh-81 into main AGit
Owner

@⁠lcg007xd-c on GitHub · 2026-11-25 22:04 UTC · original
lcg007xd-c:test/lowering-coverage → main · +953 −0 · 3 files · 3 commits · open

What

A tripwire against losing lowerings. Issue #4 records lowerings that went missing in a merge (image_sample_b_o, the LDS bounds checks). Nothing noticed until a title broke.

The new test lowering_coverage_matches_the_snapshot (emit/coverage_tests.rs) works like this:

  • Each opcode on its own. Every VOP1, VOP2, VOP3, VOP3P, SOP1 and SOP2 opcode the decoder has a name for goes alone into a one-thread compute program and is lowered. Sources come from root constants, and the result is stored to a buffer. Scalar results go through s20, which stays clear of the buffer descriptor in s[8:11].
  • Compared with a list. Each opcode either lowers, is refused, or panics. That status is compared with the checked-in emit/lowering-coverage.txt (743 lines, 24 KB).
  • On a change, the test names each changed opcode, e.g. vop1 0x02a v_rcp_f32: lowers -> refused. By default it only prints that as a warning and passes, so no one else's PR goes red over it. With VICTORY_STRICT_TESTS=1 (the switch #43's skips already use) it fails.
  • A deliberate change (a new lowering) is recorded with VICTORY_BLESS=1 cargo test -p victory-shader coverage, and the updated list is committed with it.

The whole sweep takes about 0.6 s.

Today, 544 of the 743 named opcodes lower, 197 are refused, and 2 panic. The 2 are v_permlane16_b32 and v_permlanex16_b32, and #79 fixes them. Once #79 merges, they show up as a warning until the list is re-blessed.

Tests

  • The test passes on this branch.
  • I removed the v_rcp_f32 arm from lower.rs locally. The test then named both encodings (vop1 0x02a and vop3 0x1aa, lowers -> refused). In the sandbox, a stale list passes with a warning by default and fails with VICTORY_STRICT_TESTS=1.
  • The portable CI commands and Windows-target clippy (--target x86_64-pc-windows-msvc) pass locally. The asset-policy test accepts the new .txt.

Open lowering PRs (#56, #57, #71, #73) keep passing after this merges. Their new lowerings show up as warnings until someone re-blesses the list.

Not covered: instructions that need more than this template (VOPC, memory, images, branches). The test only shows that an opcode lowers or is refused, not that the result is numerically right.

🤖 Generated with Claude Code

**@⁠lcg007xd-c** on GitHub · 2026-11-25 22:04 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/81) `lcg007xd-c:test/lowering-coverage` → `main` · +953 −0 · 3 files · 3 commits · open ## What A tripwire against losing lowerings. Issue #4 records lowerings that went missing in a merge (`image_sample_b_o`, the LDS bounds checks). Nothing noticed until a title broke. The new test `lowering_coverage_matches_the_snapshot` (`emit/coverage_tests.rs`) works like this: - **Each opcode on its own.** Every VOP1, VOP2, VOP3, VOP3P, SOP1 and SOP2 opcode the decoder has a name for goes alone into a one-thread compute program and is lowered. Sources come from root constants, and the result is stored to a buffer. Scalar results go through `s20`, which stays clear of the buffer descriptor in `s[8:11]`. - **Compared with a list.** Each opcode either lowers, is refused, or panics. That status is compared with the checked-in `emit/lowering-coverage.txt` (743 lines, 24 KB). - **On a change**, the test names each changed opcode, e.g. `vop1 0x02a v_rcp_f32: lowers -> refused`. By default it only prints that as a warning and passes, so no one else's PR goes red over it. With `VICTORY_STRICT_TESTS=1` (the switch #43's skips already use) it fails. - **A deliberate change** (a new lowering) is recorded with `VICTORY_BLESS=1 cargo test -p victory-shader coverage`, and the updated list is committed with it. The whole sweep takes about 0.6 s. Today, 544 of the 743 named opcodes lower, 197 are refused, and 2 panic. The 2 are `v_permlane16_b32` and `v_permlanex16_b32`, and #79 fixes them. Once #79 merges, they show up as a warning until the list is re-blessed. ## Tests - The test passes on this branch. - I removed the `v_rcp_f32` arm from `lower.rs` locally. The test then named both encodings (`vop1 0x02a` and `vop3 0x1aa`, `lowers -> refused`). In the sandbox, a stale list passes with a warning by default and fails with `VICTORY_STRICT_TESTS=1`. - The portable CI commands and Windows-target clippy (`--target x86_64-pc-windows-msvc`) pass locally. The asset-policy test accepts the new `.txt`. Open lowering PRs (#56, #57, #71, #73) keep passing after this merges. Their new lowerings show up as warnings until someone re-blesses the list. Not covered: instructions that need more than this template (VOPC, memory, images, branches). The test only shows that an opcode lowers or is refused, not that the result is numerically right. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Every VOP1, VOP2, VOP3, VOP3P, SOP1 and SOP2 opcode the decoder names
goes alone into a one-thread compute program (sources from root
constants, result stored to a buffer; scalar results through s20, clear
of the descriptor) and is lowered. Whether each lowers, is refused or
panics is compared with emit/lowering-coverage.txt, so a merge or
refactor that drops a lowering fails a test, naming the opcode, instead
of turning up in a title. VICTORY_BLESS=1 rewrites the list for a
deliberate change.

Today: 544 of 743 named opcodes lower, 197 are refused, and the two
permlanes panic (a debug assertion; fixed separately).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A PR that adds or removes a lowering would otherwise fail until it
re-blesses the list. The test now prints the changed opcodes as a
warning and passes; with VICTORY_STRICT_TESTS=1 (the switch the test
skips already use) it fails as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:43:28 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/81/head:github-bot/gh-81'
git switch 'github-bot/gh-81'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-81'
git switch 'github-bot/gh-81'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-81'
git switch 'github-bot/gh-81'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-81'
git switch 'main'
git merge --squash 'github-bot/gh-81'
git switch 'main'
git merge --ff-only 'github-bot/gh-81'
git switch 'main'
git merge 'github-bot/gh-81'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.