diff --git a/.github/workflows/Check.yml b/.github/workflows/Check.yml new file mode 100644 index 000000000..e95e67d2d --- /dev/null +++ b/.github/workflows/Check.yml @@ -0,0 +1,22 @@ +name: Check +on: + push: + branches: + - 'master' + - 'release-' + tags: + - '*' + pull_request: +jobs: + runic: + name: Runic formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: "1" + - uses: julia-actions/cache@v2 + - uses: fredrikekre/runic-action@v1 + with: + version: "1" diff --git a/docs/make.jl b/docs/make.jl index 61c506556..e51966a70 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -44,6 +44,7 @@ function main() push_preview = true, ) end + return end isinteractive() || main() diff --git a/examples/histogram.jl b/examples/histogram.jl index 311cff761..958fa0e1d 100644 --- a/examples/histogram.jl +++ b/examples/histogram.jl @@ -63,12 +63,14 @@ function histogram!(histogram_output, input) # Need static block size kernel! = histogram_kernel!(backend, (256,)) kernel!(histogram_output, input, ndrange = size(input)) + return end function move(backend, input) # TODO replace with adapt(backend, input) out = KernelAbstractions.allocate(backend, eltype(input), size(input)) KernelAbstractions.copyto!(backend, out, input) + return out end @testset "histogram tests" begin diff --git a/examples/matmul.jl b/examples/matmul.jl index 4ade3f374..aec4fb2bf 100644 --- a/examples/matmul.jl +++ b/examples/matmul.jl @@ -23,6 +23,7 @@ function matmul!(output, a, b) backend = KernelAbstractions.get_backend(a) kernel! = matmul_kernel!(backend) kernel!(output, a, b, ndrange = size(output)) + return end a = rand!(allocate(backend, Float32, 256, 123)) diff --git a/examples/memcopy.jl b/examples/memcopy.jl index f826caecc..3159f3670 100644 --- a/examples/memcopy.jl +++ b/examples/memcopy.jl @@ -13,6 +13,7 @@ function mycopy!(A, B) kernel = copy_kernel!(backend) kernel(A, B, ndrange = length(A)) + return end A = KernelAbstractions.zeros(backend, Float64, 128, 128) diff --git a/examples/memcopy_static.jl b/examples/memcopy_static.jl index e32390816..9f088294e 100644 --- a/examples/memcopy_static.jl +++ b/examples/memcopy_static.jl @@ -13,6 +13,7 @@ function mycopy_static!(A, B) kernel = copy_kernel!(backend, 32, size(A)) # if size(A) varies this will cause recompilation kernel(A, B, ndrange = size(A)) + return end A = KernelAbstractions.zeros(backend, Float64, 128, 128) diff --git a/examples/mpi.jl b/examples/mpi.jl index 2f5e690d3..aad025367 100644 --- a/examples/mpi.jl +++ b/examples/mpi.jl @@ -9,6 +9,7 @@ function cooperative_test!(req) done, _ = MPI.Test(req, MPI.Status) yield() end + return end function cooperative_wait(task::Task) @@ -17,6 +18,7 @@ function cooperative_wait(task::Task) yield() end wait(task) + return end function exchange!(h_send_buf, d_recv_buf, h_recv_buf, src_rank, dst_rank, comm) @@ -68,6 +70,7 @@ function main(backend) cooperative_wait(send_task) @test all(d_recv_buf .== src_rank) + return end main(backend) diff --git a/examples/naive_transpose.jl b/examples/naive_transpose.jl index 20ea6a0c0..dc6908ae9 100644 --- a/examples/naive_transpose.jl +++ b/examples/naive_transpose.jl @@ -18,6 +18,7 @@ function naive_transpose!(a, b) groupsize = KernelAbstractions.isgpu(backend) ? 256 : 1024 kernel! = naive_transpose_kernel!(backend, groupsize) kernel!(a, b, ndrange = size(a)) + return end # resolution of grid will be res*res diff --git a/ext/EnzymeCore07Ext.jl b/ext/EnzymeCore07Ext.jl index 1998b020b..93159886c 100644 --- a/ext/EnzymeCore07Ext.jl +++ b/ext/EnzymeCore07Ext.jl @@ -22,7 +22,7 @@ function EnzymeRules.forward( f = kernel.f fwd_kernel = similar(kernel, cpu_fwd) - fwd_kernel(f, args...; ndrange, workgroupsize) + return fwd_kernel(f, args...; ndrange, workgroupsize) end function EnzymeRules.forward( @@ -36,7 +36,7 @@ function EnzymeRules.forward( f = kernel.f fwd_kernel = similar(kernel, gpu_fwd) - fwd_kernel(f, args...; ndrange, workgroupsize) + return fwd_kernel(f, args...; ndrange, workgroupsize) end _enzyme_mkcontext(kernel::Kernel{CPU}, ndrange, iterspace, dynamic) = diff --git a/ext/EnzymeCore08Ext.jl b/ext/EnzymeCore08Ext.jl index 8bdd8ee42..1fda85120 100644 --- a/ext/EnzymeCore08Ext.jl +++ b/ext/EnzymeCore08Ext.jl @@ -23,7 +23,7 @@ function EnzymeRules.forward( f = kernel.f fwd_kernel = similar(kernel, cpu_fwd) - fwd_kernel(config, f, args...; ndrange, workgroupsize) + return fwd_kernel(config, f, args...; ndrange, workgroupsize) end function EnzymeRules.forward( @@ -38,7 +38,7 @@ function EnzymeRules.forward( f = kernel.f fwd_kernel = similar(kernel, gpu_fwd) - fwd_kernel(config, f, args...; ndrange, workgroupsize) + return fwd_kernel(config, f, args...; ndrange, workgroupsize) end _enzyme_mkcontext(kernel::Kernel{CPU}, ndrange, iterspace, dynamic) = diff --git a/src/macros.jl b/src/macros.jl index 570e2bf45..02b93ed72 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -103,7 +103,7 @@ function transform_gpu!(def, constargs, force_inbounds) Expr(:block, let_constargs...), body, ) - return nothing + return end # The hard case, transform the function for CPU execution @@ -138,7 +138,7 @@ function transform_cpu!(def, constargs, force_inbounds) Expr(:block, let_constargs...), Expr(:block, new_stmts...), ) - return nothing + return end struct WorkgroupLoop diff --git a/test/compiler.jl b/test/compiler.jl index 7b0efd7ed..85312262e 100644 --- a/test/compiler.jl +++ b/test/compiler.jl @@ -39,7 +39,7 @@ end function compiler_testsuite(backend, ArrayT) kernel = index(CPU(), DynamicSize(), DynamicSize()) - iterspace = NDRange{1, StaticSize{(128,)}, StaticSize{(8,)}}(); + iterspace = NDRange{1, StaticSize{(128,)}, StaticSize{(8,)}}() ctx = KernelAbstractions.mkcontext(kernel, 1, nothing, iterspace, Val(KernelAbstractions.NoDynamicCheck())) @test ndims(ctx) == 1 @test KernelAbstractions.__index_Global_NTuple(ctx, CartesianIndex(1)) == (1,) @@ -75,4 +75,5 @@ function compiler_testsuite(backend, ArrayT) # test that there is no invoke of overdub @test !any(check_for_overdub, CI.code) end + return end diff --git a/test/convert.jl b/test/convert.jl index a87f48016..7b6c24029 100644 --- a/test/convert.jl +++ b/test/convert.jl @@ -63,4 +63,5 @@ function convert_testsuite(backend, ArrayT) @test d_B[:, i + 20] == round.(d_A) end end + return end diff --git a/test/copyto.jl b/test/copyto.jl index 9cdf8cfe1..53d698be2 100644 --- a/test/copyto.jl +++ b/test/copyto.jl @@ -17,4 +17,5 @@ function copyto_testsuite(Backend, ArrayT) @test isapprox(a, Array(A)) @test isapprox(a, Array(B)) + return end diff --git a/test/examples.jl b/test/examples.jl index a3cb04d12..02374db89 100644 --- a/test/examples.jl +++ b/test/examples.jl @@ -6,7 +6,7 @@ function find_sources(path::String, sources = String[]) elseif endswith(path, ".jl") push!(sources, path) end - sources + return sources end function examples_testsuite(backend_str) @@ -27,4 +27,5 @@ function examples_testsuite(backend_str) end end + return end diff --git a/test/extensions/enzyme.jl b/test/extensions/enzyme.jl index 014037762..5d1637f7c 100644 --- a/test/extensions/enzyme.jl +++ b/test/extensions/enzyme.jl @@ -11,6 +11,7 @@ function square_caller(A, backend) kernel = square!(backend) kernel(A, ndrange = size(A)) KernelAbstractions.synchronize(backend) + return end @@ -23,6 +24,7 @@ function mul_caller(A, B, backend) kernel = mul!(backend) kernel(A, B, ndrange = size(A)) KernelAbstractions.synchronize(backend) + return end function enzyme_testsuite(backend, ArrayT, supports_reverse = true) @@ -58,4 +60,5 @@ function enzyme_testsuite(backend, ArrayT, supports_reverse = true) @test all(dA .≈ 2:2:128) end + return end diff --git a/test/localmem.jl b/test/localmem.jl index b03bfa747..a31235d0f 100644 --- a/test/localmem.jl +++ b/test/localmem.jl @@ -8,7 +8,7 @@ using Test end I = @index(Global, Linear) i = @index(Local, Linear) - lmem = @localmem Int (N,) # Ok iff groupsize is static + lmem = @localmem Int (N,) # Ok iff groupsize is static @inbounds begin lmem[i] = i @synchronize @@ -23,7 +23,7 @@ end end I = @index(Global, Linear) i = @index(Local, Linear) - lmem = @localmem Int (N,) # Ok iff groupsize is static + lmem = @localmem Int (N,) # Ok iff groupsize is static @inbounds begin lmem[i] = i + 3 for j in 1:2 @@ -47,4 +47,5 @@ function localmem_testsuite(backend, ArrayT) @test all(B[49:64] .== 16:-1:1) end end + return end diff --git a/test/nditeration.jl b/test/nditeration.jl index 2258e8d4b..c0a8c08c9 100644 --- a/test/nditeration.jl +++ b/test/nditeration.jl @@ -30,7 +30,7 @@ function nditeration_testsuite() function check(idx, offset, offset_x, offset_y, Dim_x, Dim_y) N = Dim_x * Dim_y - all(p -> p[1] == p[2], zip(idx[(offset * N .+ 1):N], CartesianIndices(((offset_x * Dim_x .+ 1):Dim_x, (offset_y * Dim_y .+ 1):Dim_y)))) + return all(p -> p[1] == p[2], zip(idx[(offset * N .+ 1):N], CartesianIndices(((offset_x * Dim_x .+ 1):Dim_x, (offset_y * Dim_y .+ 1):Dim_y)))) end @testset "linear_iteration" begin @@ -93,4 +93,5 @@ function nditeration_testsuite() @test ndims(ndrange) == 2 end end + return end diff --git a/test/print_test.jl b/test/print_test.jl index 79b527300..956481502 100644 --- a/test/print_test.jl +++ b/test/print_test.jl @@ -23,4 +23,5 @@ function printing_testsuite(backend) end @test true end + return end diff --git a/test/private.jl b/test/private.jl index 02c25aea3..b98dd45a9 100644 --- a/test/private.jl +++ b/test/private.jl @@ -106,4 +106,5 @@ function private_testsuite(backend, ArrayT) end end end + return end diff --git a/test/reflection.jl b/test/reflection.jl index e5ae39cf5..6ce46b2b1 100644 --- a/test/reflection.jl +++ b/test/reflection.jl @@ -29,6 +29,7 @@ function test_typed_kernel_dynamic(backend, backend_str, ArrayT) @test isa(res, Pair{Core.CodeInfo, DataType}) end @test isa(res[1].code, Array{Any, 1}) + return end function test_typed_kernel_dynamic_no_info(backend, backend_str, ArrayT) @@ -43,6 +44,7 @@ function test_typed_kernel_dynamic_no_info(backend, backend_str, ArrayT) @test isa(res, Pair{Core.CodeInfo, DataType}) end @test isa(res[1].code, Array{Any, 1}) + return end function test_typed_kernel_static(backend, backend_str, ArrayT) @@ -59,6 +61,7 @@ function test_typed_kernel_static(backend, backend_str, ArrayT) @test isa(res, Pair{Core.CodeInfo, DataType}) end @test isa(res[1].code, Array{Any, 1}) + return end function test_typed_kernel_no_optimize(backend, backend_str, ArrayT) @@ -72,6 +75,7 @@ function test_typed_kernel_no_optimize(backend, backend_str, ArrayT) res_opt = @ka_code_typed kernel(A, ndrange = size(A)) # FIXME: Need a better test # @test size(res[1].code) < size(res_opt[1].code) + return end function test_expr_kernel(backend, backend_str, ArrayT) @@ -89,6 +93,7 @@ function test_expr_kernel(backend, backend_str, ArrayT) @test isa(res, Pair{Core.CodeInfo, DataType}) end @test isa(res[1].code, Array{Any, 1}) + return end function reflection_testsuite(backend, backend_str, ArrayT) @@ -97,4 +102,5 @@ function reflection_testsuite(backend, backend_str, ArrayT) test_typed_kernel_static(backend, backend_str, ArrayT) test_typed_kernel_no_optimize(backend, backend_str, ArrayT) test_expr_kernel(backend, backend_str, ArrayT) + return end diff --git a/test/specialfunctions.jl b/test/specialfunctions.jl index 261986460..b41d08763 100644 --- a/test/specialfunctions.jl +++ b/test/specialfunctions.jl @@ -53,4 +53,5 @@ function specialfunctions_testsuite(Backend) synchronize(backend) @test Array(cy) ≈ SpecialFunctions.erfc.(x) end + return end diff --git a/test/test.jl b/test/test.jl index 337af10d4..d86d9803b 100644 --- a/test/test.jl +++ b/test/test.jl @@ -154,7 +154,7 @@ function unittest_testsuite(Backend, backend_str, backend_mod, BackendArrayT; sk @conditional_testset "Const" skip_tests begin let kernel = constarg(Backend(), 8, (1024,)) # this is poking at internals - iterspace = NDRange{1, StaticSize{(128,)}, StaticSize{(8,)}}(); + iterspace = NDRange{1, StaticSize{(128,)}, StaticSize{(8,)}}() ctx = if Backend == CPU KernelAbstractions.mkcontext(kernel, 1, nothing, iterspace, Val(NoDynamicCheck())) else @@ -266,6 +266,7 @@ function unittest_testsuite(Backend, backend_str, backend_mod, BackendArrayT; sk function f(KernelAbstractions.@context, a) I = @index(Global, Linear) a[I] = 1 + return end @kernel cpu = false function context_kernel(a) f(KernelAbstractions.@context, a) @@ -324,4 +325,5 @@ function unittest_testsuite(Backend, backend_str, backend_mod, BackendArrayT; sk end end + return end diff --git a/test/testsuite.jl b/test/testsuite.jl index 3828e4ef2..29f780272 100644 --- a/test/testsuite.jl +++ b/test/testsuite.jl @@ -11,7 +11,7 @@ const Pkg = Base.require( ) macro conditional_testset(name, skip_tests, expr) - esc( + return esc( quote @testset $name begin if $name ∉ $skip_tests @@ -91,6 +91,8 @@ function testsuite(backend, backend_str, backend_mod, AT, DAT; skip_tests = Set{ @conditional_testset "Examples" skip_tests begin examples_testsuite(backend_str) end + + return end end diff --git a/test/unroll.jl b/test/unroll.jl index 7bbbab4df..c9a64466d 100644 --- a/test/unroll.jl +++ b/test/unroll.jl @@ -44,4 +44,5 @@ function unroll_testsuite(backend, ArrayT) kernel2! = kernel_unroll2!(backend(), 1, 1) kernel2!(a) synchronize(backend()) + return end