Skip to content

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

Open
amazedturnip wants to merge 1 commit into
xcl-dev:mainfrom
amazedturnip:xcl/tests-recomp-upper-lanes-hazards-cfg-and-dmask-c-165734
Open

amazedturnip wants to merge 1 commit into
xcl-dev:mainfrom
amazedturnip:xcl/tests-recomp-upper-lanes-hazards-cfg-and-dmask-c-165734

Conversation

@amazedturnip

Copy link
Copy Markdown
Contributor

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

Add integration tests for upper_lanes::analyze, UpperLanes::hazards, UpperLanes::resolved, and upper_lanes::slot covering constant/SGPR lane slots, hazard and resolution classification, DS_PERMUTE_B32 vs DS_BPERMUTE_B32, indirect vs fetch-shader S_SWAPPC_B64 and resolved far 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 invalidation, MIMG DMASK/D16/TFE register-count truncation, and empty/unreachable code.
@DavidM1911

Copy link
Copy Markdown
Contributor

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!

@ivall ivall added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 24, 2026
@Decodere

Copy link
Copy Markdown
Contributor

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

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown

merge-check

  • base: 078358a
  • head: 6e3795d
  • 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

@github-actions github-actions Bot added area:tests Unit, integration, e2e tests, or testtitle gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests Unit, integration, e2e tests, or testtitle gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) needs-1st-check Passes gates; needs first independent merge-check (#3041) off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants