Skip to content

add backend to COMPILER_KWARGS #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 20 additions & 0 deletions test/execution.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using GPUCompiler: isavailable, SPIRV_LLVM_Translator_jll

@testset "execution" begin

@testset "@opencl" begin
Expand Down Expand Up @@ -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
Loading