|
12 | 12 | A[1] = 2^11
|
13 | 13 | end
|
14 | 14 |
|
| 15 | +@kernel function checked(A, a, b) |
| 16 | + A[1] = Base.Checked.checked_add(a, b) |
| 17 | +end |
| 18 | + |
15 | 19 | function compiler_testsuite()
|
16 | 20 | kernel = index(CPU(), DynamicSize(), DynamicSize())
|
17 | 21 | iterspace = NDRange{1, StaticSize{(128,)}, StaticSize{(8,)}}();
|
18 | 22 | ctx = KernelAbstractions.mkcontext(kernel, 1, nothing, iterspace, Val(KernelAbstractions.NoDynamicCheck()))
|
19 | 23 |
|
20 | 24 | @test KernelAbstractions.Cassette.overdub(ctx, KernelAbstractions.__index_Global_NTuple, CartesianIndex(1)) == (1,)
|
21 | 25 |
|
22 |
| - CI, rt = @ka_code_typed literal_pow(CPU())(zeros(Int,1), ndrange=1) |
23 |
| - # test that there is no invoke of overdub |
24 |
| - @test !any(stmt->(stmt isa Expr) && stmt.head == :invoke, CI.code) |
25 |
| -end |
| 26 | + let (CI, rt) = @ka_code_typed literal_pow(CPU())(zeros(Int,1), ndrange=1) |
| 27 | + # test that there is no invoke of overdub |
| 28 | + @test !any(stmt->(stmt isa Expr) && stmt.head == :invoke, CI.code) |
| 29 | + end |
26 | 30 |
|
| 31 | + if VERSION >= v"1.5" |
| 32 | + let (CI, rt) = @ka_code_typed checked(CPU())(zeros(Int,1), 1, 2, ndrange=1) |
| 33 | + # test that there is no invoke of overdub |
| 34 | + @test !any(stmt->(stmt isa Expr) && stmt.head == :invoke, CI.code) |
| 35 | + end |
| 36 | + end |
| 37 | +end |
0 commit comments