Skip to content

Commit e39dd95

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

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-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/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
33
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
44
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
55
GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
6+
GPUCompiler = "61eb1bfa-7361-4325-ad38-22787b887f55"
67
IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
78
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
89
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"

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)