diff --git a/src/macros.jl b/src/macros.jl index 1f2d7f9b..0514eef8 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -19,7 +19,6 @@ function __kernel(expr, generate_cpu=true, force_inbounds=false) @inbounds $(def[:body]) end def[:body] = body_qt - println(def[:body]) end find_return(expr) && error("Return statement not permitted in a kernel function $name") diff --git a/test/runtests.jl b/test/runtests.jl index 2572f2aa..fe2253d3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -21,6 +21,18 @@ kern_static(CPU(static=true), (1,))(A, ndrange=length(A)) end @test_throws ErrorException("This kernel is unavailable for backend CPU") my_no_cpu_kernel(CPU()) +# testing multiple configurations at the same time +@kernel cpu=false inbounds=false my_no_cpu_kernel2(a) +end +@test_throws ErrorException("This kernel is unavailable for backend CPU") my_no_cpu_kernel2(CPU()) + +# testing bounds errors +@kernel inbounds=false my_bounded_kernel(a) = a[1] +@test_throws BoundsError(Int64[],(1,)) my_bounded_kernel(CPU())(Int[], ndrange=1) + +@kernel inbounds=true my_inbounds_kernel(a) = a[1] +@test nothing == my_inbounds_kernel(CPU())(Int[], ndrange=1) + struct NewBackend <: KernelAbstractions.GPU end @testset "Default host implementation" begin backend = NewBackend()