Shader tests: no opcode of the ISA may crash the translator (port of Marvisak#2378) #673

Manually merged
github merged 1 commit from github-bot/gh-673 into main 2026-11-29 08:22:22 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 03:20 UTC · original
kibagami-nc:test/isa-census-never-panics → main · +209 −20 · 4 files · 1 commits · merged 2026-11-29 08:16 UTC

What

A census over the whole ISA. Every opcode of every decode table is encoded into a minimal pixel program and driven through decode → ir → structure → resource → io → emit. The tables are SOP2, SOPK, SOP1, SOPC, SOPP, SMEM, VOP1, VOP2, VOPC, VOP3, VOP3P, VINTRP, DS, MUBUF, MTBUF, MIMG, FLAT, GLOBAL and SCRATCH.

  • The names: the decoder must read back the name each table promises, which catches encoders and decoders drifting apart.
  • The translation: it must be Ok, or a refusal that names what it lacks.
  • Panics: catch_unwind turns any panic into a test failure. A title can reach any of these encodings, so none may take the translator down.
  • Visibility: the decode tables are pub(crate) now, so the census walks the decoder's own tables and follows new opcodes as they are added.

On this tree the census gives 540 translated, 692 refused by name or reason, 0 panics, in 0.2 s. With --nocapture it lists each opcode's outcome, so the coverage of each family can be read.

This is a port of borosf's test (Marvisak/VIctory#2378). The only conflict was the module list in emit/mod.rs.

Tests

  • cargo test -p victory-shader --locked --lib census -- --nocapture: passes, with the counts above.
  • cargo clippy -p victory-shader --all-targets -- -D warnings, with and without --all-features: nothing in the new or changed lines. The one finding is main's own in emit/mod.rs, fixed by #665.

No game files, dumps or extracted data are included.

**@⁠kibagami-nc** on GitHub · 2026-11-28 03:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/673) `kibagami-nc:test/isa-census-never-panics` → `main` · +209 −20 · 4 files · 1 commits · merged 2026-11-29 08:16 UTC ## What A census over the whole ISA. Every opcode of every decode table is encoded into a minimal pixel program and driven through decode → ir → structure → resource → io → emit. The tables are SOP2, SOPK, SOP1, SOPC, SOPP, SMEM, VOP1, VOP2, VOPC, VOP3, VOP3P, VINTRP, DS, MUBUF, MTBUF, MIMG, FLAT, GLOBAL and SCRATCH. - **The names:** the decoder must read back the name each table promises, which catches encoders and decoders drifting apart. - **The translation:** it must be `Ok`, or a refusal that names what it lacks. - **Panics:** `catch_unwind` turns any panic into a test failure. A title can reach any of these encodings, so none may take the translator down. - **Visibility:** the decode tables are `pub(crate)` now, so the census walks the decoder's own tables and follows new opcodes as they are added. On this tree the census gives **540 translated, 692 refused by name or reason, 0 panics**, in 0.2 s. With `--nocapture` it lists each opcode's outcome, so the coverage of each family can be read. This is a port of borosf's test ([Marvisak/VIctory#2378](https://github.com/Marvisak/VIctory/pull/2378)). The only conflict was the module list in `emit/mod.rs`. ## Tests - `cargo test -p victory-shader --locked --lib census -- --nocapture`: passes, with the counts above. - `cargo clippy -p victory-shader --all-targets -- -D warnings`, with and without `--all-features`: nothing in the new or changed lines. The one finding is `main`'s own in `emit/mod.rs`, fixed by #665. No game files, dumps or extracted data are included.
A census over the whole ISA: every opcode of every decode table (SOP2,
SOPK, SOP1, SOPC, SOPP, SMEM, VOP1, VOP2, VOPC, VOP3, VOP3P, VINTRP, DS,
MUBUF, MTBUF, MIMG, FLAT, GLOBAL, SCRATCH) is encoded into a minimal pixel
program and driven through decode, ir, structure, resource, io and emit.
The decoder must read back the name its table promises, the translation
must be Ok or a refusal that names what it lacks, and catch_unwind turns
a panic into a failure: a title can reach any of these encodings, so none
may take the translator down. The tables are pub(crate) so the census
walks the decoder's own and follows new opcodes.

On this tree: 540 translated, 692 refused, 0 panics, in 0.2 s.

Port of borosf's test (Marvisak/VIctory#2378).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 03:25:20 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 05:36 UTC · original · approved these changes

LGTM — verified on Windows:

  • cargo test -p victory-shader --lib census_tests:: passed (every_opcode_translate_or_refuse_never_panic)
  • cargo clippy -p victory-shader --lib -- -D warnings passed with 0 warnings
  • cargo xtask policy passed (295 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 05:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/673#pullrequestreview-6096076230) · **approved these changes** LGTM — verified on Windows: - `cargo test -p victory-shader --lib census_tests::` passed (`every_opcode_translate_or_refuse_never_panic`) - `cargo clippy -p victory-shader --lib -- -D warnings` passed with 0 warnings - `cargo xtask policy` passed (`295 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github manually merged commit 7467dd4d63 into main 2026-11-29 08:22:22 +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!673
No description provided.