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..a44cae6b 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -14,6 +14,7 @@ REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SPIRVIntrinsics = "71d1d633-e7e8-4a92-83a1-de8814b09ba8" SPIRV_LLVM_Backend_jll = "4376b9bf-cff8-51b6-bb48-39421dff0d0c" +SPIRV_LLVM_Translator_jll = "4a5d46fc-d8cf-5151-a261-86b458210efb" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" diff --git a/test/execution.jl b/test/execution.jl index db663c04..e15a4349 100644 --- a/test/execution.jl +++ b/test/execution.jl @@ -1,3 +1,5 @@ +using SPIRV_LLVM_Translator_jll + @testset "execution" begin @testset "@opencl" begin @@ -133,4 +135,20 @@ 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 + + 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