Skip to content

Tests: check per-lane Direct DXIL wave, mask, and far-jump parity on GPU - #1843

Open
microwave805 wants to merge 1 commit into
xcl-dev:mainfrom
microwave805:tests-gpu-per-lane-parity
Open

microwave805 wants to merge 1 commit into
xcl-dev:mainfrom
microwave805:tests-gpu-per-lane-parity

Conversation

@microwave805

Copy link
Copy Markdown

Add GPU parity and API tests for the per-lane Direct DXIL backend (recomp::lower_dxil) covering features that previously had only CPU-interpreter or no direct tests (S_WQM, S_CSELECT, scalar carry/borrow chains, far jumps, compute_code, compute_split, and survey_compute_code).

What is in it

  • crates/xcl/tests/gpu_per_lane_parity.rs:
    • per_lane_wqm_and_cselect_match_hlsl_on_gpu: validates and runs S_WQM_B32 + S_CSELECT_B32 + V_CNDMASK_B32 (wave32 via lower_dxil::kernel) and S_WQM_B64 + S_CSELECT_B64 + V_CNDMASK_B32 across both 32-lane halves (split wave64 via lower_dxil::kernel_split), comparing every SGPR/VGPR against the HLSL+DXC path.
    • per_lane_scalar_carry_borrow_and_far_jump_match_hlsl_on_gpu: validates and runs chained S_ADD_U32/S_ADDC_U32 + S_SUB_U32/S_SUBB_U32 and a far jump (S_GETPC_B64 + S_ADD_U32 + S_ADDC_U32 + S_SETPC_B64) in both wave32 and split wave64 against HLSL+DXC.
    • per_lane_compute_code_split_and_survey: checks lower_dxil::survey_compute_code on valid and undecodable bytes, then validates and dispatches a compute shader with a far jump through lower_dxil::compute_code (wave32) and lower_dxil::compute_split (split wave64, cross-checked against HLSL+DXC).

Tested

  • NVIDIA GeForce RTX 3070 (driver 32.0.16.1742), AMD Ryzen 5 5600X, Windows 11 Pro (build 22631), DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), Rust 1.100.0 (stable-x86_64-pc-windows-msvc, debug)
  • On PR head af24810 (based on main c4d37be):
    • cargo test -p xcl --test gpu_per_lane_parity -- --nocapture: 3 passed, 0 failed, 0 ignored (0 skipped)
    • .\scripts\test.ps1 (cargo build --workspace && cargo test --workspace -- --test-threads=4): 962 passed, 0 failed, 43 ignored
    • SKIPPED GPU tests (23 pre-existing, 0 in gpu_per_lane_parity): 18× no wave64 (lower::tests, lower_dxil::tests, recomp::tests), 3× per-lane form: refused (lower_dxil::tests: f16 arithmetic, f16 packed, f32 conversions), 1× no heap windows (heap_window_out_of_memory_falls_back_to_the_switch_form), 1× cannot disable the driver cache (shaders::tests::pso_measurement_compiles_an_exact_synthetic_record)

Regression run

  • Not needed: test-only PR adding crates/xcl/tests/gpu_per_lane_parity.rs (no runtime or build-input files changed).

Not tested

  • Native wave64 AMD GPUs, Intel GPUs, Linux/Wine, and retail titles

AI use

  • Antigravity (Gemini 4 Neon): inspected crates/xcl/src/gpu/recomp/lower.rs and lower_dxil.rs, wrote crates/xcl/tests/gpu_per_lane_parity.rs and this PR description, and ran the verification commands above.

Add GPU parity and API tests for recomp::lower_dxil covering areas that previously had only CPU-interpreter or no direct tests: S_WQM_B32/B64 + S_CSELECT_B32/B64 + V_CNDMASK_B32, scalar carry/borrow chains (S_ADDC_U32 / S_SUBB_U32), far jumps (S_GETPC_B64 + S_SETPC_B64), compute_code, compute_split, and survey_compute_code.

Every emitted DXIL container is validated against DXC and run on the GPU in both wave32 (lower_dxil::kernel / compute_code) and split wave64 (lower_dxil::kernel_split / compute_split), compared register-for-register against the HLSL+DXC path.

Assisted-by: Antigravity (Gemini 4 Neon)
@DarkPanda69

Copy link
Copy Markdown

AMD run with native 64-lane waves, which this PR lists as not tested, plus an NVIDIA one.

Tested: pass, head af24810 applied on main 689f2db, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
cargo test -p xcl --test gpu_per_lane_parity -- --test-threads=4 with XCL_ADAPTER set to each GPU:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, waves 32..64: 3 passed, 0 failed, 0 SKIPPED.
  • NVIDIA RTX 3060, driver 32.0.16.1088, waves 32 only: 3 passed, 0 failed, 0 SKIPPED.

cargo test -p xcl --lib -- gpu::recomp --test-threads=4 with this PR applied: 261 passed, 0 failed, 18 ignored on both; the SKIPPED lines are the same as on main.

Not tested: Intel; Linux / Wine; the whole workspace suite.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

Tested

On PR #1843 head af2481013ed9d2a09ce778a71cf8200b2e887838 in a clean detached checkout on STOR-WINLAB. Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 Enterprise Evaluation 26200.9974, Rust and Cargo 1.100.0 (x86_64-pc-windows-msvc, unoptimized test profile), DXC and DXIL 1.9.2609.5.

Built with cargo test -p xcl --locked --test gpu_per_lane_parity --no-run. With XCL_ADAPTER=A770, ran the generated binary serially under the Arc lock:

gpu_per_lane_parity-c6643ecfeadd9932.exe per_lane_wqm_and_cselect_match_hlsl_on_gpu --exact --nocapture --test-threads=1
gpu_per_lane_parity-c6643ecfeadd9932.exe per_lane_scalar_carry_borrow_and_far_jump_match_hlsl_on_gpu --exact --nocapture --test-threads=1

2 passed, 0 failed, 0 ignored, 0 explicit GPU skips. Each test passed its Direct DXIL vs. HLSL+DXC register comparisons and expected-value assertions in both modes.

GPU mode WQM and CSELECT Scalar carry/borrow and far jump
Native wave32 Passed on 32 lanes Both kernels passed on 32 lanes
Split wave64 (two hardware wave32s) Passed across both halves Both kernels passed across both halves

Not tested

Native hardware wave64, other adapters, the compute/survey fixture (including undecodable input), parallel test execution, the full workspace suite, retail titles, and Linux/Wine.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in tests and wrote this report.

@throny throny added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 25, 2026
@github-actions

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Nov 28, 2026
@BBareth

BBareth commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check claim
head: af24810

@github-actions github-actions Bot added area:tests Unit, integration, e2e tests, or testtitle needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Nov 30, 2026
@BBareth

BBareth commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: ff0c364
head: af24810
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; 28 SKIPPED lines, as on the base; failing: none. The base alone, run earlier today on the same commit: 2888 passed, 1 failed, 51 ignored, 28 SKIPPED lines; its one failure, hle::d3d12x::pso_async::used_tests::emission_resolves_the_retained_recipe_after_title_address_reuse, passed here and in ten other merged runs today, so it is intermittent on the base. The three new tests ran on the GPU and passed: per_lane_wqm_and_cselect_match_hlsl_on_gpu, per_lane_scalar_carry_borrow_and_far_jump_match_hlsl_on_gpu, per_lane_compute_code_split_and_survey.
review: no blocking finding; test-only, one new integration test file, every line read. Each kernel is lowered by lower_dxil (wave32 and split wave64), validated, run on the GPU and compared register for register with the HLSL + DXC result, then against fixed expected values (WQM quads of lanes 5 and 37, a carry / borrow chain, a far jump over four overwritten moves, a compute program storing tid + 10). It skips with skip_test without wave32 or DXC. One note, not blocking: per_lane_compute_code_split_and_survey calls compute_code, compute_split and survey_compute_code before the GPU check, so those three run (and can fail) on a machine without a GPU too; they are pure translation, so that looks intended. No runtime code changes.
performance: none: tests only.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Nov 30, 2026
@saintwolf

Copy link
Copy Markdown
Contributor

merge-check claim
head: af24810

@saintwolf

Copy link
Copy Markdown
Contributor

merge-check
base: ff0c364
head: af24810
merge: clean (trial merge 6f627873aecbdd69f7606e38860eb32371b3c9a2; git diff --check clean; +258/-0, one new file crates/xcl/tests/gpu_per_lane_parity.rs)
build: cargo build --workspace -> ok (39 lib warnings, all pre-existing; none from the new file)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored (base ff0c364 is 2889 + 3 new tests). SKIPPED: 27, the standard set for this card. The three new tests ran on the GPU here (wave32 + split wave64, with the DXC cross-checks) and all passed, matching BBareth's run.
review: no blocking finding; test-only, one new integration test file, every line read. Each test assembles a console program with the existing rdna2 encode/decode scaffolding, lowers it through the direct per-lane backend (lower_dxil::kernel / kernel_split / compute_code / compute_split / survey_compute_code), validates the DXIL, runs it on the GPU, and compares register-for-register against the HLSL+DXC translation of the same program, plus pinned expected values that I re-derived against the codebase's own conventions: s128+n is the literal constant n (lower.rs code32: 128..=192 => c(code-128)), so s133/s135/s138 are 5/7/10 and s128/s129 are 0/1 - the carry/borrow pin (s1,s2,s5)=(0,1,-1), (s3,s4,s6)=(-1,3,4) and the WQM pin (s2,s3)=(5,7) fall out exactly; V_LSHLREV is value << amount (lower_valu.rs:765, matching emit.rs); the compute test's v0 = tid in group (the translate_compute doc) and GLOBAL addresses are byte offsets, so mem[tid] = tid + 10 - the same stride pattern robustness_tests.rs:196 pins as tid*4 bytes. The VOP3 mask operand codes used (0/1/4 = s0/s1/s4 register masks, 125 = NULL, 149 = inline 0x15) match the conventions of the existing lower_dxil tests. The far-jump test pins the jump landing (s2, s3) = (40, 0) with v1 = 7 for every lane, i.e. the four overwritten moves are skipped. Correct skip convention (skip_test without wave32 or DXC); one note, not blocking, as BBareth made: per_lane_compute_code_split_and_survey runs compute_code / compute_split / survey_compute_code before the GPU gate, so those pure-translation steps run (and can fail) on a machine without a GPU - consistent with the sibling parity PRs. The survey negative case (four 0xFF bytes must produce a refusal) is a real check, not a formality. Thread: DarkPanda69 ran the author's "not tested" case (AMD native 64-lane waves) plus NVIDIA, passed; DavidM1911 lib all-pass; JJAutoCompare full suite on Intel Arc; BBareth's safe check (2892/0/51; his base-alone run noted the intermittent pso_async emission flake, which did not appear in my merged run).
performance: none: tests only, no runtime code changes.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Nov 30, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head af24810

No open or merged PR adds these per-lane (recomp::lower_dxil) parity tests: the open parity suites (#2091, #2089, #1778) drive gpu::dxil::kernel, the per-instruction backend, not the per-lane kernel / kernel_split / compute_code / compute_split / survey_compute_code entry points used here. The test file only uses public APIs that exist on main, and GPU paths skip through runner::skip_test. No problems found in the diff.
Recommendation: keep open.

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

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 off-goal Does not bear on the current goal (world loading); waits until it is reached ready-to-merge Has 2 independent safe merge-checks on current head (#3041) stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants