From fe9e95c240fcf5041343e11f8ba1c3c2f9179d2f Mon Sep 17 00:00:00 2001 From: Michel Schanen Date: Tue, 21 Jul 2026 10:57:58 -0500 Subject: [PATCH 1/2] Make floating-point atomics work on the LLVM back-end path 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. --- Project.toml | 5 +++++ src/compiler/compilation.jl | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 29523d7f..04d16b7b 100644 --- a/Project.toml +++ b/Project.toml @@ -56,3 +56,8 @@ oneAPI_Support_jll = "0.9.2" [extras] libigc_jll = "94295238-5935-5bd7-bb0f-b00942e9bdd5" + +[sources] +# Pin to a commit SHA, not the mutable `atomic-float-ops` branch head, so builds are +# reproducible and a force-push upstream cannot silently change what users resolve. +SPIRVIntrinsics = {url = "https://github.com/michel2323/OpenCL.jl", rev = "4257d4075162276d9985168923788490e4071e9e", subdir = "lib/intrinsics"} diff --git a/src/compiler/compilation.jl b/src/compiler/compilation.jl index 5a398a65..928c1de9 100644 --- a/src/compiler/compilation.jl +++ b/src/compiler/compilation.jl @@ -328,7 +328,14 @@ end # advertise the extension). We lower bfloat→i16 in finish_ir! when needed. supports_bfloat16 = _device_supports_bfloat16(dev) - extensions = String[] + # SPIR-V extensions the LLVM back-end may emit. Declaring them permits the + # corresponding instructions during translation: without + # SPV_EXT_shader_atomic_float_add, floating-point atomic operations fail to + # translate ("The atomic float instruction requires ... SPV_EXT_shader_atomic_float_add"). + extensions = String[ + "SPV_EXT_relaxed_printf_string_address_space", + "SPV_EXT_shader_atomic_float_add", + ] # Only add the SPIR-V extension if the runtime actually supports it if _driver_supports_bfloat16_spirv(dev) push!(extensions, "SPV_KHR_bfloat16") From a38644f1f46e29595f2941c72da86e6d877f7b75 Mon Sep 17 00:00:00 2001 From: Michel Schanen Date: Tue, 21 Jul 2026 10:57:58 -0500 Subject: [PATCH 2/2] onemkl tests: accept oneMKL 2025.2+ --- test/onemkl.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/onemkl.jl b/test/onemkl.jl index 98774404..4a4c7fcd 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"2026.0.0" + @test version_onemkl ≥ v"2025.2.0" end ############################################################################################