From e3364bd3acabed533c3be96c20c0a80f94d897a9 Mon Sep 17 00:00:00 2001 From: Michel Schanen Date: Tue, 21 Jul 2026 10:57:58 -0500 Subject: [PATCH 1/3] 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 8def2246..bdca42aa 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 33ed52a4deaa65cc18796d597e5569ccf7fc19f1 Mon Sep 17 00:00:00 2001 From: Michel Schanen Date: Tue, 21 Jul 2026 10:57:58 -0500 Subject: [PATCH 2/3] 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 ############################################################################################ From a72d78f4a4d8f5310da3dbb41e1d76e901ed3c1c Mon Sep 17 00:00:00 2001 From: Michel Schanen Date: Mon, 27 Jul 2026 10:45:52 -0500 Subject: [PATCH 3/3] Test OpenCL branch --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index bdca42aa..643151d8 100644 --- a/Project.toml +++ b/Project.toml @@ -60,4 +60,4 @@ 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"} +SPIRVIntrinsics = {url = "https://github.com/michel2323/OpenCL.jl", rev = "atomic-float-ops", subdir = "lib/intrinsics"}