Tests: GPU tests of 64-bit atomics skip where those atomics write nothing #977
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/983"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by vakaobr on 2026-11-24T09:52:28Z.
On Apple's D3DMetal 3.0 (macOS, CrossOver 26.3), a compute program that contains a 64-bit atomic writes nothing at all: not the atomic, not its other stores, not even stores issued before it. The only exception is non-returning unsigned
InterlockedMin64/InterlockedMax64on device memory. The adapter still reportsInt64ShaderOps,AtomicInt64OnTypedResourceSupported,AtomicInt64OnGroupSharedSupportedandAtomicInt64OnDescriptorHeapResourceSupportedas 1, so a one-thread kernel checks it instead: a returningInterlockedAdd64must carry into the high dword and give back the old value. Part of #258.What is in it
crates/xcl/src/gpu/recomp/tests.rs:no_int64_atomics(), the one-time probe (OnceLock), nowpub(super). It skips withno 64-bit atomicsonly when the probe kernel ran and its results are wrong.gpu_atomic_fcmpswap_x2,gpu_atomic_fmin_fmax_x2andgpu_float_cas_uses_ieee_equalityreturn through it. So dogpu_linked_memory_accessors(link_tests.rs) andgpu_heap_windows_64bit_atomics_match_switch_form(heap_window_tests.rs).GLOBAL_ATOMIC_{ADD,INC,DEC}_X2instructions and their asserts move unchanged fromgpu_more_atomics_sub_dword_scratch_valuinto a newgpu_global_atomic_add_inc_dec_x2, gated the same way, so the rest of the old test runs on such a host.Tested
x86_64-pc-windows-gnu, debug, DXC 1.9.2609; head518398aonmain9dfbe3e. Each test in its own process (<lib test exe> --exact <test> --test-threads=1 --nocapture).[ffffffff, 1, 0, 0]: the buffer as it was before, so the kernel wrote nothing, its plain store included.mainthat use 64-bit atomics, plusgpu_global_atomics_and_sub_dword_access:main9dfbe3e: 2 passed, 6 failed. The failures aregpu_atomic_fcmpswap_x2,gpu_atomic_fmin_fmax_x2,gpu_more_atomics_sub_dword_scratch_valu("global_atomic_inc wraps at 10"),gpu_float_cas_uses_ieee_equality("ds_cmpst_rtn_f32"),gpu_linked_memory_accessors("s_load from window 1") andgpu_heap_windows_64bit_atomics_match_switch_form("64-bit add carry in w1").SKIPPED …: no 64-bit atomics: the five gated ones andgpu_global_atomic_add_inc_dec_x2.gpu_more_atomics_sub_dword_scratch_valupasses.gpu_linked_memory_accessorspasses andgpu_float_cas_uses_ieee_equalitygets past every 32-bit check.ab7ce43onmain9aec53d: the local probes of each 64-bit atomic, and @mikebuckets171's independent run on a second M5 Pro (https://github.com/ivall/xcl/pull/983#issuecomment-7129605266). Those results are unchanged from the previous version of this description.Regression run
Test-only change: no runtime file changed, no
xcl-smokeblocks.Not tested
cargo test --workspaceas a whole.gpu_float_cas_uses_ieee_equalityandgpu_linked_memory_accessorsno longer run on a Mac. I can split them likegpu_more_atomics_sub_dword_scratch_valuif you prefer.XCL_REQUIRE_GPU=wave64/meshturns this skip into a failure, becauserunner::skip_testis unchanged.gpu_atomic_fcmpswap_x2andgpu_atomic_fmin_fmax_x2onno_doubles(), so the two PRs touch the sameiflines. Those two tests use no doubles (see https://github.com/ivall/xcl/pull/787#issuecomment-7127510124).AI use
Imported from ivall/xcl. Originally posted by mikebuckets171 on 2026-11-24T11:03:48Z.
Verified on a second Apple silicon host, on the
gnullvmtarget: all three of the failures you name reproduce on the base, and at this head the two dedicated tests skip and the mixed one runs.Host: MacBook Pro M5 Pro (48 GB), macOS 27.2.1, CrossOver 26 with D3DMetal (adapter reports "AMD Compatibility Mode"), Rosetta 2, Rust 1.100.0,
x86_64-pc-windows-gnullvmwith LLVM-MinGW 20261117 (clang 23.1.6),--release --locked, test binaries run under Wine, one test per process (--exact <full test path> --nocapture --test-threads=1). Base is9aec53d, headab7ce43; the lib test binary reports 704 tests on the base and 705 at the head.9aec53dab7ce43gpu::recomp::tests::gpu_atomic_fcmpswap_x2tests.rs:4737:assertion left == right failed: lane 0: buffer cell,left: 4609434218613702656SKIPPED …gpu_atomic_fcmpswap_x2: no 64-bit atomics->ok. 1 passed; 0 failedgpu::recomp::tests::gpu_atomic_fmin_fmax_x2tests.rs:4868:assertion left == right failed: buffer: max of the lanes,left: -infSKIPPED …gpu_atomic_fmin_fmax_x2: no 64-bit atomics->ok. 1 passed; 0 failedgpu::recomp::tests::gpu_more_atomics_sub_dword_scratch_valutests.rs:4632:assertion left == right failed: global_atomic_inc wraps at 10,left: 0ok. 1 passed; 0 failedin 0.62 sThe third row is the part worth having in the record: on this host the mixed test's own failure was the 64-bit atomic (
global_atomic_inccame back 0), and after your change the test runs and passes - so taking the three 64-bit atomics out of it really does keep the rest of it working on a Mac host rather than trading one failure for a skip.The
left: 4609434218613702656on the first row is what the cell holds when the atomic never writes: it is the value the test put there first, unchanged, which fits your "any 64-bit atomic writes nothing at all, other stores included" measurement.left: -infon the second is the reduction over lanes that never got updated.Not tested here: Windows (no Windows machine on this bench), and this PR's CI has not run on GitHub - every head of mine on this repo shows only the
PR checksdescription job, which is main's ownpull_request_targetworkflow, so theCIjob still needs a maintainer's approval to start for a fork contribution.Host: macOS 27.2.1 (Apple silicon, M5 Pro), CrossOver 26, D3DMetal; local inference unloaded and the bottle's wineserver stopped for each run. AI use: GPT-6 Luna built both trees, ran the tests and drafted this comment; the codes, line numbers and assertion values are from those runs.
Imported from ivall/xcl. Originally posted by shortside on 2026-11-24T11:56:52Z.
Test report from a second Mac, head
ab7ce43against its merge base9aec53d.Tested
x86_64-pc-windows-msvcwith clang-cl / lld-link 23.1.6 and an xwin SDK 10.0.26100, Rust 1.100.0, debug. The lib test binary run under Wine, one test per process (--exact --nocapture, 60 s cap).atomicin its name (12 on base, 13 on head): base 9 passed, 3 failed (gpu_atomic_fcmpswap_x2,gpu_atomic_fmin_fmax_x2,gpu_more_atomics_sub_dword_scratch_valu); head 10 passed, 3 passed withSKIPPED … no 64-bit atomics(gpu_atomic_fcmpswap_x2,gpu_atomic_fmin_fmax_x2, and the newgpu_global_atomic_add_inc_dec_x2), 0 failed.gpu_more_atomics_sub_dword_scratch_valugoes from failed to passed (it runs, it does not skip).Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:34:07Z.
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.
cargo test -p xcl --lib atomic: 13 passed, 0 failed — the 64-bit atomic GPU tests still run and pass on this adapter (which does support them, so the newskip_test("no 64-bit atomics")guard is correctly not taken). The skip is gated on an actual probe, not assumed.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by jesuarchive on 2026-11-24T12:36:47Z.
Native Windows + NVIDIA check that the new skip does not fire where 64-bit atomics work. Head
ab7ce43, merged locally ontomain47efa2e(clean merge, nothing pushed).Tested
stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17 from the Windows SDK; debug.cargo test -p xcl --lib atomic -- --test-threads=1 --nocapture: 13 passed, 0 failed, 0 ignored. TheInterlockedAdd64probe did not report a failure and no test printedskippingorSKIPPED:gpu_atomic_fcmpswap_x2,gpu_atomic_fmin_fmax_x2,gpu_atomic_fmin_fmax_negative_zero,gpu_more_atomics_sub_dword_scratch_valu,gpu_global_atomics_and_sub_dword_accessand the newgpu_global_atomic_add_inc_dec_x2all ran on the GPU and passed. Same filter onmain47efa2e: 12 passed (without the new test).cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored (main: 741 / 0 / 41).main:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).Not tested
9aec53d; release build.AI use
Imported from ivall/xcl. Originally posted by bjarngard on 2026-11-24T13:05:17Z.
Test report for head
ab7ce43(AMD, native wave64, and RTX 5080)Tested
XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 725 passed, 0 failed, 41 ignored, no SKIPPEDXCL_REQUIRE_GPU=wave64:gpu_global_atomic_add_inc_dec_x2,gpu_more_atomics_sub_dword_scratch_valupassedgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwaregpu_global_atomic_add_inc_dec_x2andgpu_more_atomics_sub_dword_scratch_valuran and passed on both adapters; the newno 64-bit atomicsskip did not fire on eitherNot tested: Intel.
AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T13:32:57Z.
A run on Linux with vkd3d-proton, NVIDIA: the probe fires here too, but for a different fault than D3DMetal's. And it skips two tests that pass on
mainon this stack.Tested
x86_64-pc-windows-gnu.ab7ce43as it is (merge base9aec53d) andmain47efa2e, no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact, 90 s cap).ab7ce43, every lib test withatomicin its name: 13 passed, 0 failed. 3 of them SKIPPEDno 64-bit atomics:gpu_atomic_fcmpswap_x2,gpu_atomic_fmin_fmax_x2,gpu_global_atomic_add_inc_dec_x2.InterlockedAdd64 probe: [0, 3, 0, 0]. So the add itself lands, carry included ([0, 3]), but the old valueInterlockedAdd64returns comes back as 0 ([0, 0]where[0xffffffff, 1]is expected). D3DMetal writes nothing at all.main47efa2e:maingpu_atomic_fcmpswap_x2gpu_atomic_fmin_fmax_x2gpu_atomic_fmin_fmax_negative_zerogpu_more_atomics_sub_dword_scratch_valukernel dispatch: GPU fence still pending after 10000 msgpu_global_atomic_add_inc_dec_x2mainmainhas had here ingpu_more_atomics_sub_dword_scratch_valu(the inc / dec x2 CAS loop never sees the old value), but I have not checked which instruction hangs.fcmpswap_x2andfmin_fmax_x2work onmainhere and are skipped with this PR, so on vkd3d-proton the skip also covers 64-bit atomics that work.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:32:11Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:42:09Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by vakaobr on 2026-11-30T13:22:02Z.
Please keep this open:
mainhas since reorganised the atomics test this PR splits. I'll check whether the skip is still needed on currentmainand rework it.Imported from ivall/xcl. Originally posted by vakaobr on 2026-11-30T14:44:11Z.
Rebased on current
main(518398a); the skip is still needed on D3DMetal and now also covers three tests added since. Description updated with the test runs.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:35:42Z.
Triage (#1607) – head
518398aNo open or merged PR adds this skip:
no_int64_atomicsis not on main, and main'sgpu_more_atomics_sub_dword_scratch_valustill contains the three*_X2global atomics. Related but different: #1501 fixes the same D3DMetal behaviour in the runtime (it splits non-returning 64-bit atomics into 32-bit ones after a start-up proberunner::probe_int64_atomics). If both land, the twoInterlockedAdd64probes could be shared.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.
Imported from ivall/xcl. Originally posted by grathepic on 2026-12-03T00:37:51Z.
merge-check
078358a058518398a0e7git diff --checkexit 0)cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace— exit 0 (36 pre-existing warnings inxcllib)XCL_REQUIRE_GPU=mesh(cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked -p xcl --lib -- gpu_global_atomic_add_inc_dec_x2 gpu_more_atomics_sub_dword_scratch_valu gpu_atomic_fcmpswap_x2 gpu_atomic_fmin_fmax_x2 gpu_float_cas_uses_ieee_equality gpu_linked_memory_accessors gpu_heap_windows_64bit_atomics_match_switch_form --nocapture, withXCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin): 7 passed, 0 failed, 0 ignored (0.43s, 0 skips). Confirmsno_int64_atomics()passes on Windows 11 + NVIDIA GeForce RTX 3080 and skips nothing.cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4, withXCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin): 3006 passed, 1 failed, 52 ignored across 44 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); 0no 64-bit atomicsskips). The single failure was the unrelated pre-existing late-release flake intests\gpu_two_pass_cache_e2e.rs:584(releasing the title PSOs releases their two-pass state,left: 1, right: 0), an external integration test binary that does not compile any of the three#[cfg(test)]modules modified by this PR.#[cfg(test)]modulesgpu/recomp/{tests,link_tests,heap_window_tests}.rs, zero production code or dependency changes)+61/-20, 3 files). Confirmed all 3 modified files are#[cfg(test)]modules incrates/xcl/src/gpu/recomp/mod.rs:70-75.no_int64_atomics()runs once viaOnceLock, probes returningInterlockedAdd64carry (0x0000_0001_FFFF_FFFF + 0x0000_0001_0000_0001 -> 0x0000_0003_0000_0000with old value[0xFFFF_FFFF, 1]), returnsfalseon compile/run error so missing GPU/DXC is not misreported, and callsrunner::skip_test("no 64-bit atomics")only on a mismatched result. Moving the threeGLOBAL_ATOMIC_{ADD,INC,DEC}_X2checks intogpu_global_atomic_add_inc_dec_x2preserves all setup and assertions verbatim. No duplicates in #1607 (complements #1501).OnceLockruns one 1-thread probe kernel once per test binary)View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.