Skip to content

Commit 9ca11cc

Browse files
committed
add backend to COMPILER_KWARGS
1 parent 7a7b8e9 commit 9ca11cc

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/compiler/execution.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export @opencl, clfunction
44
## high-level @opencl interface
55

66
const MACRO_KWARGS = [:launch]
7-
const COMPILER_KWARGS = [:kernel, :name, :always_inline, :extensions]
7+
const COMPILER_KWARGS = [:kernel, :name, :always_inline, :extensions, :backend]
88
const LAUNCH_KWARGS = [:global_size, :local_size, :queue]
99

1010
macro opencl(ex...)

test/execution.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using GPUCompiler: isavailable, SPIRV_LLVM_Translator_jll
2+
13
@testset "execution" begin
24

35
@testset "@opencl" begin
@@ -133,4 +135,22 @@ end
133135
end
134136
end
135137

138+
@testset "backends" begin
139+
llvm_backend_llvm = sprint() do io
140+
OpenCL.code_llvm(io, () -> nothing, (); dump_module = true, backend = :llvm)
141+
end
142+
if Int === Int64
143+
@test occursin("target triple = \"spirv64-unknown-unknown-unknown\"", llvm_backend_llvm)
144+
end
145+
146+
if isavailable(SPIRV_LLVM_Translator_jll)
147+
llvm_backend_khronos = sprint() do io
148+
OpenCL.code_llvm(io, () -> nothing, (); dump_module = true, backend = :khronos)
149+
end
150+
if Int === Int64
151+
@test occursin("target triple = \"spir64-unknown-unknown\"", llvm_backend_khronos)
152+
end
153+
end
154+
end
155+
136156
end

0 commit comments

Comments
 (0)