Skip to content

Make floating-point atomics work on the LLVM back-end path#595

Open
michel2323 wants to merge 3 commits into
mainfrom
fix-atomics-main
Open

Make floating-point atomics work on the LLVM back-end path#595
michel2323 wants to merge 3 commits into
mainfrom
fix-atomics-main

Conversation

@michel2323

Copy link
Copy Markdown
Member

On discrete GPUs (tested on an Arc A750, NEO 26.18), oneAPI.atomic_add!/atomic_sub! on Float32 fail with 4 errors in device/intrinsics: the atomic intrinsics fall back to an unsupported runtime call (unsupported call to an unknown function (call to gpu_malloc)). Two changes fix this:

  • pin SPIRVIntrinsics to the atomic-float-ops revision, whose atomic intrinsics lower properly (pinned by commit SHA so the resolution is reproducible);
  • declare SPV_EXT_shader_atomic_float_add (plus the relaxed-printf extension) for the LLVM SPIR-V back-end — extensions must be declared to permit the corresponding instructions during translation, and without the declaration the atomic float instructions fail with LLVM ERROR: The atomic float instruction requires the following SPIR-V extension: SPV_EXT_shader_atomic_float_add.

Also relaxes the onemkl version test to accept oneMKL 2025.2+, so the suite works against a locally built support library (and the Aurora LTS toolchain, where this originates).

With this, device/intrinsics passes 116/116 and onemkl 1048 + 48 broken on the A750. Extracted from the aurora-lts branch so it can land on main independently.

Two pieces, without which oneAPI.atomic_add!/atomic_sub! on Float32
fail on discrete GPUs (4 errors in device/intrinsics on an Arc A750):

- use the SPIRVIntrinsics atomic-float-ops revision, whose atomic
  intrinsics lower properly instead of falling back to an unsupported
  runtime call ("unsupported call to an unknown function gpu_malloc");

- declare SPV_EXT_shader_atomic_float_add (and the relaxed-printf
  extension) for the LLVM SPIR-V back-end: extensions must be declared
  to permit the corresponding instructions during translation, and
  without them the atomic float instructions fail to translate.
@github-actions

Copy link
Copy Markdown
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/test/onemkl.jl b/test/onemkl.jl
index 4a4c7fc..518c179 100644
--- a/test/onemkl.jl
+++ b/test/onemkl.jl
@@ -14,7 +14,7 @@ k = 13
 
 @testset "Version" begin
     version_onemkl = oneMKL.version()
-    @test version_onemkl ≥ v"2025.2.0"
+        @test version_onemkl ≥ v"2025.2.0"
 end
 
 ############################################################################################

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.06%. Comparing base (05292cb) to head (9ae172f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #595   +/-   ##
=======================================
  Coverage   79.06%   79.06%           
=======================================
  Files          50       50           
  Lines        3362     3362           
=======================================
  Hits         2658     2658           
  Misses        704      704           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant