Tests: cover upper_lanes hazards, CFG jumps, VALU ops, and MIMG DMASK #1508

Open
amazedturnip wants to merge 1 commit from upstream-pr/1518 into main
amazedturnip commented 2026-11-24 17:11:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by amazedturnip on 2026-11-24T17:11:31Z.


Add an integration test suite (crates/xcl/tests/upper_lanes_contract.rs) covering previously untested public APIs (UpperLanes::hazards, UpperLanes::resolved, upper_lanes::slot) and analysis paths in crates/xcl/src/gpu/recomp/upper_lanes.rs. The 5 tests verify DS_PERMUTE_B32 vs DS_BPERMUTE_B32, indirect jumps vs fetch-shader S_SWAPPC_B64 and resolved far_target jumps, binary VALU ops with absorbing constants and VOP3 modifier bailouts, DPP16 partial ROW_MASK/BANK_MASK, S_MOVRELD_B32, SGPR-lane V_WRITELANE_B32, MIMG DMASK/D16/TFE truncation, and empty/unreachable code.

What is in it

  • crates/xcl/tests/upper_lanes_contract.rs: add 5 integration tests covering upper_lanes::slot, UpperLanes::hazards / UpperLanes::resolved and DS_PERMUTE_B32 vs DS_BPERMUTE_B32, indirect jumps vs fetch-shader S_SWAPPC_B64 and resolved far_target jumps, binary VALU ops / absorbing constants / VOP3 modifier bailout / DPP16 partial ROW_MASK and BANK_MASK, and S_MOVRELD_B32 / SGPR-lane V_WRITELANE_B32 / MIMG DMASK/D16/TFE truncation / empty and unreachable code.

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build
  • AMD (AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64), XCL_ADAPTER=radeon): cargo test --workspace -- --test-threads=2 — 775 passed, 0 failed, 41 ignored (SKIPPED GPU tests: none)
  • Verification / negative control: new test suite — verified 3x deterministic

Not tested

  • retail Xbox Series X|S title (not available on this host)
  • non-Windows hosts (Windows x64 crate only)
  • NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64)

AI use

  • Antigravity CLI (Gemini 4 Hydrogen (Medium)) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).
<!-- greyfinch-sync:ivall/xcl:issue:5476850254 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1518). Originally posted by [amazedturnip](https://github.com/amazedturnip) on 2026-11-24T17:11:31Z. --- Add an integration test suite (`crates/xcl/tests/upper_lanes_contract.rs`) covering previously untested public APIs (`UpperLanes::hazards`, `UpperLanes::resolved`, `upper_lanes::slot`) and analysis paths in `crates/xcl/src/gpu/recomp/upper_lanes.rs`. The 5 tests verify `DS_PERMUTE_B32` vs `DS_BPERMUTE_B32`, indirect jumps vs fetch-shader `S_SWAPPC_B64` and resolved `far_target` jumps, binary VALU ops with absorbing constants and VOP3 modifier bailouts, DPP16 partial `ROW_MASK`/`BANK_MASK`, `S_MOVRELD_B32`, SGPR-lane `V_WRITELANE_B32`, MIMG `DMASK`/`D16`/`TFE` truncation, and empty/unreachable code. **What is in it** - `crates/xcl/tests/upper_lanes_contract.rs`: add 5 integration tests covering `upper_lanes::slot`, `UpperLanes::hazards` / `UpperLanes::resolved` and `DS_PERMUTE_B32` vs `DS_BPERMUTE_B32`, indirect jumps vs fetch-shader `S_SWAPPC_B64` and resolved `far_target` jumps, binary VALU ops / absorbing constants / VOP3 modifier bailout / DPP16 partial `ROW_MASK` and `BANK_MASK`, and `S_MOVRELD_B32` / SGPR-lane `V_WRITELANE_B32` / MIMG `DMASK`/`D16`/`TFE` truncation / empty and unreachable code. **Tested** - Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build - AMD (`AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64)`, `XCL_ADAPTER=radeon`): `cargo test --workspace -- --test-threads=2` — 775 passed, 0 failed, 41 ignored (SKIPPED GPU tests: none) - Verification / negative control: new test suite — verified 3x deterministic **Not tested** - retail Xbox Series X|S title (not available on this host) - non-Windows hosts (Windows x64 crate only) - NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64) **AI use** - Antigravity CLI (Gemini 4 Hydrogen (Medium)) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).
DavidM1911 commented 2026-11-24 19:07:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:57Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7141307217 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1518#issuecomment-7141307217). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:53:57Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Decodere commented 2026-11-27 11:58:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T11:58:27Z.


Independent desktop NVIDIA verification of PR #1518 at head 6e3795d7090b74de65a7992d2b8e5f00490c3295 (1 commit; exact parent & merge-base: 9e3831e1f570d3646e53ab753b19ec07eb8f1485, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted tests & build (6e3795d7)

Command Result
cargo test --release -p xcl --test upper_lanes_contract -- --nocapture (3 consecutive runs) 5 passed; 0 failed; 0 ignored; 0 filtered out × 3 (0.00s, 0.00s, 0.00s, 0 skipped; slot_extracts_constant_lanes_and_rejects_sgpr_or_other_insts, hazards_and_resolved_classify_all_read_kinds_and_ds_permute, cfg_indirect_jumps_vs_fetch_swappc_and_resolved_far_jump, binary_valu_ops_absorbing_constants_vop3_modifiers_and_dpp16_masks, movreld_sgpr_writelane_mimg_dmask_and_unreachable_code)
cargo build --release -p xcl Clean build (1.33s incremental --test compile + 0.06s incremental --release build, exit 0, 0 new warnings)

Paired quiet 60 s retail smoke (title: 29640639)

(Note: scripts/smoke.ps1 at 9e3831e1 predates 9683e7a6 and printed the local folder basename on title:; replaced below with the standard 9683e7a6 title hash 29640639, with all measured fields verbatim.)

Exact parent & merge-base (9e3831e1f570d3646e53ab753b19ec07eb8f1485):

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1549 (PresentX 1549)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14715 MB

PR #1518 (6e3795d7090b74de65a7992d2b8e5f00490c3295):

xcl-smoke v1
commit: 6e3795d7090b74de65a7992d2b8e5f00490c3295
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1568 (PresentX 1568)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14710 MB

Limits of coverage

  • This PR is test-only (crates/xcl/tests/upper_lanes_contract.rs, 0 production-code changes); all 5/5 CPU-side upper_lanes contract tests passed 3/3 (0 skipped).
  • The 60 s retail smoke confirms non-regression of the unchanged runtime binary at this commit (single-run frame/commit delta vs. parent reflects normal startup variance, not this PR).

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7217689020 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1518#issuecomment-7217689020). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T11:58:27Z. --- Independent desktop NVIDIA verification of **PR #1518** at head `6e3795d7090b74de65a7992d2b8e5f00490c3295` (`1` commit; exact parent & merge-base: `9e3831e1f570d3646e53ab753b19ec07eb8f1485`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted tests & build (`6e3795d7`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --test upper_lanes_contract -- --nocapture` (3 consecutive runs) | `5 passed; 0 failed; 0 ignored; 0 filtered out` × 3 (`0.00s`, `0.00s`, `0.00s`, `0` skipped; `slot_extracts_constant_lanes_and_rejects_sgpr_or_other_insts`, `hazards_and_resolved_classify_all_read_kinds_and_ds_permute`, `cfg_indirect_jumps_vs_fetch_swappc_and_resolved_far_jump`, `binary_valu_ops_absorbing_constants_vop3_modifiers_and_dpp16_masks`, `movreld_sgpr_writelane_mimg_dmask_and_unreachable_code`) | | `cargo build --release -p xcl` | Clean build (`1.33s` incremental `--test` compile + `0.06s` incremental `--release` build, exit `0`, `0` new warnings) | ### Paired quiet 60 s retail smoke (`title: 29640639`) *(Note: `scripts/smoke.ps1` at `9e3831e1` predates `9683e7a6` and printed the local folder basename on `title:`; replaced below with the standard `9683e7a6` title hash `29640639`, with all measured fields verbatim.)* Exact parent & merge-base (`9e3831e1f570d3646e53ab753b19ec07eb8f1485`): ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1549 (PresentX 1549) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14715 MB ``` PR #1518 (`6e3795d7090b74de65a7992d2b8e5f00490c3295`): ``` xcl-smoke v1 commit: 6e3795d7090b74de65a7992d2b8e5f00490c3295 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1568 (PresentX 1568) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14710 MB ``` ### Limits of coverage - This PR is test-only (`crates/xcl/tests/upper_lanes_contract.rs`, `0` production-code changes); all `5/5` CPU-side `upper_lanes` contract tests passed `3/3` (`0` skipped). - The 60 s retail smoke confirms non-regression of the unchanged runtime binary at this commit (single-run frame/commit delta vs. parent reflects normal startup variance, not this PR). *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
Foniass commented 2026-12-01 05:59:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:59:10Z.


Triage (#1607) – head 6e3795d

No open or merged PR adds the same tests. Several open PRs change upper_lanes.rs (e.g. #917, #927, #1022, #1616) and may change behaviour these assertions pin; main only changed two helpers to pub(super) since this PR's base, so the API it uses is unchanged.
The tests exercise only public items of gpu::recomp::upper_lanes; CONTRIBUTING puts unit tests in the module's own tests block, which is where this would usually go.
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:7302349713 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1518#issuecomment-7302349713). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:59:10Z. --- **Triage (#1607)** – head 6e3795d No open or merged PR adds the same tests. Several open PRs change upper_lanes.rs (e.g. #917, #927, #1022, #1616) and may change behaviour these assertions pin; main only changed two helpers to pub(super) since this PR's base, so the API it uses is unchanged. The tests exercise only public items of gpu::recomp::upper_lanes; CONTRIBUTING puts unit tests in the module's own tests block, which is where this would usually go. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
grathepic commented 2026-12-03 00:20:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grathepic on 2026-12-03T00:20:11Z.


merge-check

  • base: 078358a058
  • head: 6e3795d709
  • merge: clean (git diff --check exit 0)
  • build: cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace — exit 0 (36 pre-existing warnings in xcl lib)
  • tests: cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4 (with XCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin) — 3010 passed, 1 failed, 52 ignored across 45 harnesses; 27 SKIPPED (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps, 1 no dxil.dll, 1 cannot disable the driver cache (Windows Developer Mode required)). In tests\upper_lanes_contract.rs: 4 passed, 1 failed — movreld_sgpr_writelane_mimg_dmask_and_unreachable_code panicked at crates/xcl/tests/upper_lanes_contract.rs:351 (assertion left == right failed: left: Some(Shadow), right: None).
  • title run: not required (Tier 0 test-only PR; adds crates/xcl/tests/upper_lanes_contract.rs with zero production code or dependency changes)
  • review: Read full 369-line diff. The 5 CPU-only tests are well-structured, and the failure on current origin/main actually exposes a regression introduced after this PR's base 9e3831e1: commit 43c56dce added mimg_vgpr_uses in crates/xcl/src/gpu/rdna2.rs:613-684, which computes n_data from DMASK/D16 without adding ((f("TFE") | f("LWE")) & 1). As a result, IMAGE_LOAD with DMASK=0x1, TFE=1 (VDATA=24) returns w = [24] from rdna2::vgpr_uses, leaving v25's shadow intact even though upper_lanes::vgpr_writes (upper_lanes.rs:548) expects TFE/LWE to add one written VGPR. Because this test fails on current origin/main, #1518 cannot merge until mimg_vgpr_uses accounts for TFE/LWE. Non-blocking style note: per CONTRIBUTING, unit tests of upper_lanes would normally live in crates/xcl/src/gpu/recomp/upper_lanes.rs's #[cfg(test)] mod tests rather than a separate integration test binary.
  • performance: not applicable (test-only)
  • verdict: not yet: movreld_sgpr_writelane_mimg_dmask_and_unreachable_code fails on current origin/main (078358a0) because commit 43c56dce omitted TFE/LWE from rdna2::mimg_vgpr_uses; needs a fix on main (or stacking on one) before merging
  • hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), Rust 1.98.1-x86_64-pc-windows-msvc, DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon
<!-- greyfinch-sync:ivall/xcl:comment:7363072516 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1518#issuecomment-7363072516). Originally posted by [grathepic](https://github.com/grathepic) on 2026-12-03T00:20:11Z. --- merge-check - base: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a - head: 6e3795d7090b74de65a7992d2b8e5f00490c3295 - merge: clean (`git diff --check` exit 0) - build: `cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace` — exit 0 (36 pre-existing warnings in `xcl` lib) - tests: `cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4` (with `XCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin`) — 3010 passed, 1 failed, 52 ignored across 45 harnesses; 27 SKIPPED (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps, 1 no dxil.dll, 1 cannot disable the driver cache (Windows Developer Mode required)). In `tests\upper_lanes_contract.rs`: 4 passed, 1 failed — `movreld_sgpr_writelane_mimg_dmask_and_unreachable_code` panicked at `crates/xcl/tests/upper_lanes_contract.rs:351` (`assertion left == right failed: left: Some(Shadow), right: None`). - title run: not required (Tier 0 test-only PR; adds `crates/xcl/tests/upper_lanes_contract.rs` with zero production code or dependency changes) - review: Read full 369-line diff. The 5 CPU-only tests are well-structured, and the failure on current `origin/main` actually exposes a regression introduced after this PR's base `9e3831e1`: commit `43c56dce` added `mimg_vgpr_uses` in `crates/xcl/src/gpu/rdna2.rs:613-684`, which computes `n_data` from `DMASK`/`D16` without adding `((f("TFE") | f("LWE")) & 1)`. As a result, `IMAGE_LOAD` with `DMASK=0x1, TFE=1` (`VDATA=24`) returns `w = [24]` from `rdna2::vgpr_uses`, leaving `v25`'s shadow intact even though `upper_lanes::vgpr_writes` (`upper_lanes.rs:548`) expects `TFE`/`LWE` to add one written VGPR. Because this test fails on current `origin/main`, `#1518` cannot merge until `mimg_vgpr_uses` accounts for `TFE`/`LWE`. Non-blocking style note: per CONTRIBUTING, unit tests of `upper_lanes` would normally live in `crates/xcl/src/gpu/recomp/upper_lanes.rs`'s `#[cfg(test)] mod tests` rather than a separate integration test binary. - performance: not applicable (test-only) - verdict: not yet: `movreld_sgpr_writelane_mimg_dmask_and_unreachable_code` fails on current `origin/main` (`078358a0`) because commit `43c56dce` omitted `TFE`/`LWE` from `rdna2::mimg_vgpr_uses`; needs a fix on `main` (or stacking on one) before merging - hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), Rust 1.98.1-x86_64-pc-windows-msvc, DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon
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/1518:upstream-pr/1518'
git switch 'upstream-pr/1518'

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