Tests: console-only instruction decode against AMD's manuals #823

Open
mastrr9 wants to merge 1 commit from upstream-pr/829 into main
mastrr9 commented 2026-11-24 06:23:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mastrr9 on 2026-11-24T06:23:09Z.


Adds a test-only suite (crates/xcl/tests/insn_reference.rs) checking xcl::insn against reference models written from AMD's Architecture Programmer's Manual (Volume 4 for EXTRQ/INSERTQ across every defined length and index, and Volume 3 §1.4 for ModRM/SIB operand lengths):

  • EXTRQ / INSERTQ bit-by-bit reference match for all defined (len, idx) pairs plus no-panic check past bit 63
  • CLWB (66 0F AE /6) instruction length across all memory ModRM/SIB forms with/without REX.B, plus rejection of register forms (TPAUSE) and truncated encodings
  • RDPID and SSE4a register decoding across all 16 REX prefixes and every ModRM byte
  • CLZERO loop decoding across all 16 end registers and near-miss fallbacks
  • Seeded 20,000-case random sweep verifying decode is total, never steps past its input, and is prefix-stable

Tested

  • Hardware/OS: NVIDIA RTX 5080 (driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC debug, DXC Windows SDK 10.0.26100.0, d3d12SDKLayers.dll installed
  • Commit tested: ce5f912529ba98d0b1981c6f214920b070151a01
  • cargo build --workspace: clean (only pre-existing fetch_update deprecation warning)
  • cargo test --workspace -- --test-threads=4: 721 passed, 0 failed, 41 ignored (insn_reference: 8 passed, 0 failed)
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

Not tested

  • Test-only diff (crates/xcl/tests/insn_reference.rs); no runtime code changed and no retail title run performed.

AI use

  • Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5).
<!-- greyfinch-sync:ivall/xcl:issue:5467225085 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/829). Originally posted by [mastrr9](https://github.com/mastrr9) on 2026-11-24T06:23:09Z. --- Adds a test-only suite (`crates/xcl/tests/insn_reference.rs`) checking `xcl::insn` against reference models written from AMD's Architecture Programmer's Manual (Volume 4 for `EXTRQ`/`INSERTQ` across every defined length and index, and Volume 3 §1.4 for ModRM/SIB operand lengths): - `EXTRQ` / `INSERTQ` bit-by-bit reference match for all defined `(len, idx)` pairs plus no-panic check past bit 63 - `CLWB` (`66 0F AE /6`) instruction length across all memory ModRM/SIB forms with/without `REX.B`, plus rejection of register forms (`TPAUSE`) and truncated encodings - `RDPID` and `SSE4a` register decoding across all 16 REX prefixes and every ModRM byte - `CLZERO` loop decoding across all 16 end registers and near-miss fallbacks - Seeded 20,000-case random sweep verifying `decode` is total, never steps past its input, and is prefix-stable **Tested** - Hardware/OS: NVIDIA RTX 5080 (driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC debug, DXC Windows SDK `10.0.26100.0`, `d3d12SDKLayers.dll` installed - Commit tested: `ce5f912529ba98d0b1981c6f214920b070151a01` - `cargo build --workspace`: clean (only pre-existing `fetch_update` deprecation warning) - `cargo test --workspace -- --test-threads=4`: **721 passed, 0 failed, 41 ignored** (`insn_reference`: 8 passed, 0 failed) - `SKIPPED` GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` **Not tested** - Test-only diff (`crates/xcl/tests/insn_reference.rs`); no runtime code changed and no retail title run performed. **AI use** - Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5).
dcastell1 commented 2026-11-24 07:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T06:39:56Z.


Verified on Windows 11 10.0.26300 with an NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100 stable (MSVC 14.44.35207), main at beaa245 + this PR's test file dropped in unchanged:

cargo build --workspace          # exit 0, before this
cargo test -p xcl --test insn_reference
test result: ok. 8 passed; 0 failed; 0 ignored

Nothing else of the tree was touched, and the suite passes natively on Windows (no Wine, no prefix). AI-assisted (opencode): copied the file, built and ran the target.

<!-- greyfinch-sync:ivall/xcl:comment:7124166049 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/829#issuecomment-7124166049). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T06:39:56Z. --- Verified on Windows 11 10.0.26300 with an NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100 stable (MSVC 14.44.35207), `main` at `beaa245` + this PR's test file dropped in unchanged: ``` cargo build --workspace # exit 0, before this cargo test -p xcl --test insn_reference test result: ok. 8 passed; 0 failed; 0 ignored ``` Nothing else of the tree was touched, and the suite passes natively on Windows (no Wine, no prefix). AI-assisted (opencode): copied the file, built and ran the target.
milas6669 commented 2026-11-24 07:06:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T07:02:28Z.


Test report on ce5f912 (PR head; its base is main beaa245, which is still main; no merge conflict).

Tested

  • NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0 x86_64-pc-windows-msvc, debug

  • cargo test --workspace --no-fail-fast -- --test-threads=4; the same command on main beaa245 (this PR's base): 713 passed, 0 failed, 41 ignored

  • on this head: 721 passed, 0 failed, 41 ignored (+8 over main: the eight new tests in insn_reference.rs, e.g. clwb_steps_over_every_memory_operand_form, rdpid_takes_its_register_from_rm_and_rex_b, decode_is_total_and_prefix_stable_on_random_bytes)

  • SKIPPED (no wave64) on this GPU: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware

Not tested

  • whether the expected values agree with AMD's manuals (I did not check them against the manuals), AMD / wave64 hardware, scripts/smoke.ps1 (test-only diff)

AI use

  • Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report. I did not review the diff beyond reading it.
<!-- greyfinch-sync:ivall/xcl:comment:7124550645 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/829#issuecomment-7124550645). Originally posted by [milas6669](https://github.com/milas6669) on 2026-11-24T07:02:28Z. --- Test report on `ce5f912` (PR head; its base is `main` beaa245, which is still `main`; no merge conflict). **Tested** - NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0 `x86_64-pc-windows-msvc`, debug - `cargo test --workspace --no-fail-fast -- --test-threads=4`; the same command on `main` beaa245 (this PR's base): **713 passed, 0 failed, 41 ignored** - on this head: **721 passed, 0 failed, 41 ignored (+8 over main: the eight new tests in `insn_reference.rs`, e.g. `clwb_steps_over_every_memory_operand_form`, `rdpid_takes_its_register_from_rm_and_rex_b`, `decode_is_total_and_prefix_stable_on_random_bytes`)** - SKIPPED (no wave64) on this GPU: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` **Not tested** - whether the expected values agree with AMD's manuals (I did not check them against the manuals), AMD / wave64 hardware, `scripts/smoke.ps1` (test-only diff) **AI use** - Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report. I did not review the diff beyond reading it.
SlopTart commented 2026-11-24 08:03:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T07:17:44Z.


Linux / AMD RDNA3 datapoint.

Merged state: head ce5f912 onto main beaa245, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 714 passed, 7 failed, 41 ignored. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. All new decode tests pass here (sse4a_fields_match_the_manual_for_every_defined_length_and_index, sse4a_registers_for_every_rex_and_modrm, sse4a_fields_past_bit_63_do_not_panic, rdpid_takes_its_register_from_rm_and_rex_b, clwb_steps_over_every_memory_operand_form, decode_is_total_and_prefix_stable_on_random_bytes, the clzero loop-end sweep). Workspace total rises to 714 passed. Note these run as decode-only checks on Zen 5 (no SSE4a execution path here) - pure x86-64 host, so the manual cross-checks are the interesting part and they are clean.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7124832704 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/829#issuecomment-7124832704). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T07:17:44Z. --- Linux / AMD RDNA3 datapoint. **Merged state:** head `ce5f912` onto main `beaa245`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **714 passed, 7 failed, 41 ignored**. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. All new decode tests pass here (`sse4a_fields_match_the_manual_for_every_defined_length_and_index`, `sse4a_registers_for_every_rex_and_modrm`, `sse4a_fields_past_bit_63_do_not_panic`, `rdpid_takes_its_register_from_rm_and_rex_b`, `clwb_steps_over_every_memory_operand_form`, `decode_is_total_and_prefix_stable_on_random_bytes`, the clzero loop-end sweep). Workspace total rises to 714 passed. Note these run as decode-only checks on Zen 5 (no SSE4a execution path here) - pure x86-64 host, so the manual cross-checks are the interesting part and they are clean. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
xpatfussy69x commented 2026-11-25 10:10:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T09:38:20Z.


Test report for head a64ae11 as pushed (not merged onto current main) – Windows, NVIDIA wave32, AMD Zen 4 CPU.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 721 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests on this adapter: 2 (no wave64)
  • this PR's tests/insn_reference.rs ran and passed, including sse4a_fields_match_the_manual_for_every_defined_length_and_index, clwb_steps_over_every_memory_operand_form, rdpid_takes_its_register_from_rm_and_rex_b, clzero_loop_end_register_for_every_register and decode_is_total_and_prefix_stable_on_random_bytes
  • no XCL_SAMPLE_* data set (game-data tests not run)

Not tested

  • AMD GPUs / native wave64; release build; the head merged onto current main

AI use

  • Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
<!-- greyfinch-sync:ivall/xcl:comment:7158601163 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/829#issuecomment-7158601163). Originally posted by [xpatfussy69x](https://github.com/xpatfussy69x) on 2026-11-25T09:38:20Z. --- Test report for head `a64ae11` as pushed (not merged onto current `main`) – Windows, NVIDIA wave32, AMD Zen 4 CPU. **Tested** - NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5 - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 721 passed, 0 failed, 41 ignored - SKIPPED GPU tests on this adapter: 2 (no wave64) - this PR's `tests/insn_reference.rs` ran and passed, including `sse4a_fields_match_the_manual_for_every_defined_length_and_index`, `clwb_steps_over_every_memory_operand_form`, `rdpid_takes_its_register_from_rm_and_rex_b`, `clzero_loop_end_register_for_every_register` and `decode_is_total_and_prefix_stable_on_random_bytes` - no `XCL_SAMPLE_*` data set (game-data tests not run) **Not tested** - AMD GPUs / native wave64; release build; the head merged onto current `main` **AI use** - Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
DavidM1911 commented 2026-11-25 11:09:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T10:38:35Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7159975317 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/829#issuecomment-7159975317). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T10:38:35Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
github-actions[bot] commented 2026-11-29 20:41:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:41:02Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7262275268 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/829#issuecomment-7262275268). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:41:02Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:14:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:14:51Z.


Triage (#1607) – head a64ae11

No open or merged PR adds these tests. Main's insn.rs has only two unit tests.
I checked the expectations by hand against main's decode / modrm_len / extrq / insertq (CLWB lengths with SIB base 5, RDPID REX.B, SSE4a forms, CLZERO loop variants) and they match. The failing CI job fails in an existing lib test (mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares) on the old base, before this test binary runs.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300531558 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/829#issuecomment-7300531558). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:14:51Z. --- **Triage (#1607)** – head a64ae11 No open or merged PR adds these tests. Main's `insn.rs` has only two unit tests. I checked the expectations by hand against main's `decode` / `modrm_len` / `extrq` / `insertq` (CLWB lengths with SIB base 5, RDPID REX.B, SSE4a forms, CLZERO loop variants) and they match. The failing CI job fails in an existing lib test (`mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares`) on the old base, before this test binary runs. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/829:upstream-pr/829'
git switch 'upstream-pr/829'

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/829'
git switch 'upstream-pr/829'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/829'
git switch 'upstream-pr/829'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/829'
git switch 'main'
git merge --squash 'upstream-pr/829'
git switch 'main'
git merge --ff-only 'upstream-pr/829'
git switch 'main'
git merge 'upstream-pr/829'
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
xcl-dev/xcl!823
No description provided.