Skip to content

Commit

Permalink
Try #253:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored May 14, 2021
2 parents 1496f4e + 78cd9e7 commit 644f717
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions test/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,28 @@ end
A[1] = Base.Checked.checked_add(a, b)
end

function compiler_testsuite()
function compiler_testsuite(backend, ArrayT)
kernel = index(CPU(), DynamicSize(), DynamicSize())
iterspace = NDRange{1, StaticSize{(128,)}, StaticSize{(8,)}}();
ctx = KernelAbstractions.mkcontext(kernel, 1, nothing, iterspace, Val(KernelAbstractions.NoDynamicCheck()))
CTX = KernelAbstractions.cassette(kernel)
@test KernelAbstractions.Cassette.overdub(CTX, KernelAbstractions.__index_Global_NTuple, ctx, CartesianIndex(1)) == (1,)

let (CI, rt) = @ka_code_typed literal_pow(CPU())(zeros(Int,1), ndrange=1)
A = ArrayT{Int}(undef, 1)
let (CI, rt) = @ka_code_typed literal_pow(backend)(A, ndrange=1)
# test that there is no invoke of overdub
@test !any(stmt->(stmt isa Expr) && stmt.head == :invoke, CI.code)
end

let (CI, rt) = @ka_code_typed square(CPU())(zeros(1), zeros(1), ndrange=1)
A = ArrayT{Float64}(undef, 1)
let (CI, rt) = @ka_code_typed square(backend)(A, A, ndrange=1)
# test that there is no invoke of overdub
@test !any(stmt->(stmt isa Expr) && stmt.head == :invoke, CI.code)
end

if VERSION >= v"1.5"
let (CI, rt) = @ka_code_typed checked(CPU())(zeros(Int,1), 1, 2, ndrange=1)
A = ArrayT{Int}(undef, 1)
let (CI, rt) = @ka_code_typed checked(backend)(A, 1, 2, ndrange=1)
# test that there is no invoke of overdub
@test !any(stmt->(stmt isa Expr) && stmt.head == :invoke, CI.code)
end
Expand Down
4 changes: 2 additions & 2 deletions test/testsuite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ function testsuite(backend, backend_str, backend_mod, AT, DAT)
end
end

if backend == CPU
if backend_str != "ROCM"
@testset "Compiler" begin
compiler_testsuite()
compiler_testsuite(backend, AT)
end
end

Expand Down

0 comments on commit 644f717

Please sign in to comment.