diff --git a/src/compiler/execution.jl b/src/compiler/execution.jl index ad761bea..1b264a71 100644 --- a/src/compiler/execution.jl +++ b/src/compiler/execution.jl @@ -4,7 +4,7 @@ export @opencl, clfunction ## high-level @opencl interface const MACRO_KWARGS = [:launch] -const COMPILER_KWARGS = [:kernel, :name, :always_inline, :extensions] +const COMPILER_KWARGS = [:kernel, :name, :always_inline, :extensions, :backend] const LAUNCH_KWARGS = [:global_size, :local_size, :queue] macro opencl(ex...) diff --git a/test/Project.toml b/test/Project.toml index 1efff760..1125cf4d 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -3,6 +3,7 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" +GPUCompiler = "61eb1bfa-7361-4325-ad38-22787b887f55" IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89" InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" diff --git a/test/execution.jl b/test/execution.jl index db663c04..b0d4eb97 100644 --- a/test/execution.jl +++ b/test/execution.jl @@ -1,3 +1,5 @@ +using GPUCompiler: isavailable, SPIRV_LLVM_Translator_jll + @testset "execution" begin @testset "@opencl" begin @@ -133,4 +135,22 @@ end end end +@testset "backends" begin + llvm_backend_llvm = sprint() do io + OpenCL.code_llvm(io, () -> nothing, (); dump_module = true, backend = :llvm) + end + if Int === Int64 + @test occursin("target triple = \"spirv64-unknown-unknown-unknown\"", llvm_backend_llvm) + end + + if isavailable(SPIRV_LLVM_Translator_jll) + llvm_backend_khronos = sprint() do io + OpenCL.code_llvm(io, () -> nothing, (); dump_module = true, backend = :khronos) + end + if Int === Int64 + @test occursin("target triple = \"spir64-unknown-unknown\"", llvm_backend_khronos) + end + end +end + end