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

Merged
kibagami-nc merged 1 commit from upstream-pr/673 into main 2026-11-29 08:16:59 +00:00
kibagami-nc commented 2026-11-28 03:20:24 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T03:20:24Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5536174715 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/673). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T03:20:24Z. --- ## 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.
Dukestar69 commented 2026-11-28 05:36:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T05:36:49Z.

Review: APPROVED


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6096076230 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/673#pullrequestreview-6096076230). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-28T05:36:49Z. **Review:** APPROVED --- 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).
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!673
No description provided.