Skip to content

Tests: add split_wave64_spin_exchange_updates_block_tails regression test - #1928

Open
Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:fix-1889-split-wave64-tails
Open

Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:fix-1889-split-wave64-tails

Conversation

@Decodere

@Decodere Decodere commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What is in it

Part of #1889. Part of #1269.

Follow-up rebase of #1928 onto main: both self.tails[self.cur] = self.lw.cur(); sync lines in DxilIr::ballot and DxilIr::read_lane landed in #2203, so this PR now contains only the standalone split_wave64_spin_exchange_updates_block_tails regression test in crates/xcl/src/gpu/recomp/lower_dxil.rs (+81/-0, zero runtime changes):

  • Compiles and validates three [128, 1, 1] split-wave64 (Partner::Spin) compute shaders through lower_dxil::compute_split:
    1. Whole-wave ballot (s_bcnt1_i32_b64) in a uniform branch arm feeding a join PHI.
    2. Cross-half v_readlane_b32 (lane 37) in a uniform branch arm feeding a join PHI.
    3. v_readfirstlane_b32 (ballot + read_lane) inside a uniform loop feeding back-edge PHIs.
  • When a GPU is available, dispatches all three shaders and verifies exact output parity against run_compute_waves.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 4060 (8 GB, 32-lane waves, driver 621.14), Intel Core i5-11400F, 32 GB RAM, Windows 11 Home build 26200, Rust 1.100.0, DXC 1.9.2609.5 (01b62ad4), release build.
  • Targeted regression test (cargo test --release -p xcl --lib gpu::recomp::lower_dxil::tests::split_wave64_spin_exchange_updates_block_tails -- --nocapture): 1 passed, 0 failed, 0 ignored (0.35 s, full DXIL validation + RTX 4060 GPU dispatch parity against run_compute_waves).
  • Full lower_dxil module suite (cargo test --release -p xcl --lib gpu::recomp::lower_dxil::tests -- --test-threads=4 --nocapture): 21 passed, 0 failed, 0 ignored (1.40 s, 17 runtime SKIPPED lines on RTX 4060: 14 no wave64 + 3 wave32 per-lane refused).
  • cargo build --release -p xcl: passed.

Regression run

Baseline (origin/main 426a5a74):

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

PR head (19b8bd51):

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

Not tested

  • AMD and Intel GPUs, native wave64 hardware, and the 17 runtime-skipped lower_dxil subcases on this wave32-only RTX 4060 (the 3 new split-wave64 Partner::Spin cases themselves all ran on the RTX 4060).
  • Full workspace suite on 19b8bd51 (diff is test-only inside #[cfg(test)] mod tests of lower_dxil.rs with zero runtime code changes; targeted lower_dxil::tests 21/0 and paired 60 s smoke ran on 19b8bd51).

AI use

Rebased onto main, verified, and updated with Google Antigravity (Gemini 4 Neon). All targeted GPU tests and paired 60 s RTX 4060 smoke runs were executed locally.

@WebIdentity1

Copy link
Copy Markdown

Independent Ampere check of exact head 79a7e326cc1b1419603f9a14e22dc7331f6287fd: the new regression passes on RTX 3090, driver 591.74, Ryzen 7 7800X3D, Windows 10 19045, Rust 1.98.1 MSVC, DXC 1.8.2502.11, debug.

cargo test --locked -p xcl --lib split_wave64_spin_exchange_updates_block_tails -- --test-threads=1 --show-output, with XCL_ADAPTER=3090:

  • Head with only the two production changes reverted (same test retained): 0 passed / 1 failed / 0 ignored. ballot diamond fails DXIL validation with PHI node entries do not match predecessors!, before GPU dispatch.
  • Unmodified head: 1 passed / 0 failed / 0 ignored, zero skips. All three cases execute: ballot diamond, cross-half readlane diamond, and readfirstlane loop. Their 256 output words per case match the existing CPU model.

Both builds recompiled XCL. All 310 source hashes matched before/after each run; the pair differs only in those block-tail updates. This adds an older Ampere/driver check to the author's Ada result.

Not tested: full workspace suite for this head, retail smoke/gameplay, native wave64, or performance. No implementation change is proposed.

AI use: Codex with GPT-6 Astra inspected the fix and test, ran the comparison, and drafted this report.

@upipibi

upipibi commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

NVIDIA run: RTX 3070 8 GB (32-lane waves, split wave64), driver 616.56, Windows 11, debug, 79a7e32 merged onto main 20cf130 (clean).

AI-assisted (Claude Code). Synthetic tests only.

@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Re-checked 87adc4b on the RTX 3070 (driver 616.56, Windows 11, debug). split_wave64_spin_exchange_updates_block_tails passes, and the gpu_ tests with XCL_DIRECT_DXIL=1 give 111 passed, the same as main.

AI-assisted (Claude Code).

@raylitebull

Copy link
Copy Markdown
Member

Diff audit passed (lower_dxil.rs self.tails[self.cur] = self.lw.cur() after split-wave64 ballot and read_lane_uniform, plus the 3 regression cases), Build and test + PR description are green on 87adc4b, and NVIDIA (RTX 3090, RTX 3070) verified it.

Remaining before merge: one independent AMD GPU pass on 87adc4b.

@Decodere
Decodere force-pushed the fix-1889-split-wave64-tails branch from 87adc4b to 3990660 Compare November 25, 2026 02:03
@Decodere

Copy link
Copy Markdown
Contributor Author

Rebased cleanly onto main (3da2abb8) at 3990660a resolving only the crates/xcl/src/gpu/recomp/lower_dxil.rs end-of-file test conflict from #1865; the runtime fix in DxilIr::ballot / DxilIr::read_lane is unchanged.

Re-verified locally on RTX 4060 (release): gpu::recomp::lower_dxil (19 passed, 0 failed), full workspace (1,112 passed, 0 failed, 46 ignored), and paired 60 s scripts/smoke.ps1 (1,582 -> 1,526 frames, 0 crashes/removals). Ready for CI and the remaining independent AMD GPU check.

AI use: Google Antigravity (Gemini 4 Neon).

@gefydev gefydev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 87adc4b from the per-lane form's side (#1745). I read it against main 3da2abb; I did not run it.

The fix is right. Lw::ballot and Lw::read_lane_uniform go through spin_exchange when a group has more than one console wave (Partner::Spin), which ends the current block, and DxilIr was still wiring successor phis to the block before the exchange. foreign already resyncs tails[cur] after inst_guarded for the same reason; these two were missed when the split exchanges were routed through Lw.

I checked the other DxilIr paths that reach Lw in the split form: read_lane_half (wave_read_lane_at on l & 31), ballot_half (wave_ballot), the loads and stores, and compute_ids emit no blocks. So after this change, every place that can split a block resyncs its tail.

Two notes:

  1. Optional, more robust: br / br_if could set self.tails[self.cur] = self.lw.cur() before they terminate. The terminator is always in lw.cur(), so this one line would keep the tails right for any future Ir method that makes blocks, and it would replace the three separate syncs. Fine to leave as it is if you prefer the change minimal.
  2. The PR conflicts with main now, in lower_dxil.rs, probably the end of the test module after the recent per-lane merges (#2014, #1865). It needs a rebase.

Review written with Claude Code (Claude Opus 5.5); I checked each point against the code.

@Decodere

Copy link
Copy Markdown
Contributor Author

@gefydev Thank you for auditing every DxilIr path against the per-lane form (#1745)! Good news: head 3990660a is already rebased cleanly onto main (3da2abb8, resolving the lower_dxil.rs EOF test conflict from #1865), MERGEABLE, and green on CI. We'll keep the minimal explicit self.tails[self.cur] = self.lw.cur() syncs in ballot and read_lane (matching foreign) to keep the fix tight and focused.

@gefydev

gefydev commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@Decodere thank you: noted that 3990660a is rebased onto main (3da2abb8), mergeable and green on CI, and that you keep the explicit tail syncs in ballot and read_lane, matching foreign. That is fine with us; the br / br_if resync was only an optional suggestion. The merge is for the maintainer.

AI use: Claude Code (Claude Opus 5.5) wrote this reply for @gefydev.

@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

Independent Intel Arc A770 compatibility check for XCL PR #1928 at 3990660af24ecbd02d7ece38ee946a0626dee211. The PR was open at this commit before and after the run. The detached checkout was clean both times.

  • DXIL validation: 3/3 passed. The checked-in debug test validates each shader with DXC before the GPU capability check. The run loaded DXC and DXIL 1.9.2609.5 from the explicit toolchain directory and reported zero validation skips.
  • GPU parity: 3/3 passed on the A770 using split wave64 on hardware wave32. The whole-wave ballot diamond, cross-half lane-37 readlane diamond, and readfirstlane loop each dispatched two 128-thread groups and matched the CPU reference on all 256 output words per case. The test also checked three CPU reference spot values per case.
  • Libtest: 1 passed, 0 failed, 0 ignored, 0 skipped, 1,088 filtered out. Libtest finished in 0.34 s. The wrapper acquired and released the shared A770 lock and exited 0. PowerShell formatted the DXC version line from stderr as NativeCommandError in the captured log.

Windows 11 Enterprise Evaluation 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), Cargo 1.100.0, DXC/DXIL 1.9.2609.5 (01b62ad4), unoptimized test profile with debug assertions on and debuginfo off.

Process environment for the build and run

XCL_ADAPTER=A770
XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64
CARGO_BUILD_JOBS=2
CARGO_INCREMENTAL=0
CARGO_PROFILE_DEV_DEBUG=0
CARGO_PROFILE_TEST_DEBUG=0
CARGO_TARGET_DIR=L:/XclTooling/pr1947-1831ec4-t3-97236edf/target
TEMP=L:/XclTooling/pr1928
TMP=L:/XclTooling/pr1928

Prebuild outside the Arc lock and graphics execution inside it

& "$env:USERPROFILE/.cargo/bin/cargo.exe" test --locked -p xcl --lib --no-run -j 2 --message-format=json-render-diagnostics > L:/XclTooling/pr1928/build-3990660.log

$pr1928Command = @'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    $pr1928Exe = Join-Path $env:CARGO_TARGET_DIR 'debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe'
    if ((Get-FileHash -LiteralPath $pr1928Exe).Hash -ne 'E321749EF65B804C74EE37850BB786D14E1B169E5D431EC6CAD74F4D3945BB6C') { throw 'Test binary changed since the prebuild' }
    & $pr1928Exe 'gpu::recomp::lower_dxil::tests::split_wave64_spin_exchange_updates_block_tails' --exact --test-threads=1 --nocapture
}
'@
& powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command $pr1928Command 2>&1 | Tee-Object -FilePath L:/XclTooling/pr1928/gpu-3990660.log

The temporary RemoteSigned policy applied only to the child PowerShell process running the local lock wrapper.

Not tested

Full workspace suite, comparison against main or the pre-fix revision, retail-title smoke or gameplay, native wave64, other adapters, release profile, and performance.

AI use

T3 Code / Codex (gpt-6.2-sol) verified the exact PR head, ran the checked-in test, and prepared this report.

@luckyteagirl

Copy link
Copy Markdown
Contributor

RX 6800M Direct DXIL GPU verification for PR #1928 at 3990660af24ecbd02d7ece38ee946a0626dee211

Setup: Windows 11 build 26200, AMD Radeon RX 6800M (driver 30.0.13002.13003), Ryzen 9 5980HX, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5. Clean exact-head checkout; XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=1, XCL_DIRECT_DXIL=1.

Tested

  • cargo test --locked -p xcl --lib -j 2 split_wave64_spin_exchange_updates_block_tails -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored, no SKIPPED. The test compiles three [128, 1, 1] split-wave64 cases, dispatches each on the GPU, and compares all output words with the CPU model.
  • Same command filtered to gpu::recomp::lower_dxil: 19 passed, 0 failed, 0 ignored. Six per-lane f16/conversion subcases printed SKIPPED for unsupported #1426 opcodes; those are not GPU coverage.
  • cargo build --locked --workspace -j 2: passed.

Not tested: Full workspace suite, paired retail-title smoke, other GPUs, or a title's live Direct DXIL per-lane path. This is focused AMD validation of the regression, not a claim that the full PR is ready to merge. No game data was used.

AI assistance: OpenAI Codex (GPT-6) ran the commands, extracted counts and skips from the logs, and drafted this report.

@raylitebull

Copy link
Copy Markdown
Member

Note after recent merges on main: both self.tails[self.cur] = self.lw.cur(); sync lines in DxilIr::ballot and DxilIr::read_lane (crates/xcl/src/gpu/recomp/lower_dxil.rs) landed as part of #2203.

If you'd still like to land split_wave64_spin_exchange_updates_block_tails as a standalone regression test, rebasing #1928 onto main to keep only the test will make it merge-ready cleanly (or it can be closed if not needed separately).

…test

Both `self.tails[self.cur] = self.lw.cur()` sync lines in `DxilIr::ballot`
and `DxilIr::read_lane` landed on `main` via xcl-dev#2203. Rebase xcl-dev#1928 onto `main`
to keep only the standalone `[128, 1, 1]` split-wave64 (`Partner::Spin`)
regression test covering:
- whole-wave ballot (`s_bcnt1_i32_b64`) in a uniform branch arm feeding a join PHI,
- cross-half `v_readlane_b32` (lane 37) in a uniform branch arm feeding a join PHI,
- `v_readfirstlane_b32` (ballot + read_lane) in a uniform loop feeding back-edge PHIs.

Each case compiles and validates through `lower_dxil::compute_split` and, when
a GPU is available, checks dispatch parity against `run_compute_waves`.

Part of xcl-dev#1889
Assisted-by: Google Antigravity (Gemini 4 Neon)
@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@Decodere
Decodere force-pushed the fix-1889-split-wave64-tails branch from 3990660 to 19b8bd5 Compare November 25, 2026 11:45
@Decodere Decodere changed the title Recompiler: update per-lane DXIL block tail after split exchanges Tests: add split_wave64_spin_exchange_updates_block_tails regression test Nov 25, 2026
@Decodere

Copy link
Copy Markdown
Contributor Author

@raylitebull Thanks for the heads-up — rebased #1928 onto main (19b8bd51), dropping the two runtime sync lines that landed via #2203 and keeping only the standalone split_wave64_spin_exchange_updates_block_tails regression test (+81/-0, zero runtime diff). Re-verified on RTX 4060 (1/0, lower_dxil::tests 21/0, paired 60 s smoke 1548 -> 1521, 0 removals/crashes).

AI use: rebased, tested, and drafted with Google Antigravity (Gemini 4 Neon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants