Skip to content

Commit 5354003

Browse files
committed
Test both versions of intrinsic
1 parent f4fb376 commit 5354003

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

test/device/intrinsics.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,20 @@ end
362362
return nothing
363363
end
364364
arr = rand(T, N)
365-
buffer = MtlArray(arr)
366-
Metal.@sync @metal threads = N nextafter_test(buffer, typemax(T))
367-
@test Array(buffer) == nextfloat.(arr)
368365

369-
Metal.@sync @metal threads = N nextafter_test(buffer, typemin(T))
370-
@test Array(buffer) == arr
366+
# test the intrinsic
367+
buffer1 = MtlArray(arr)
368+
Metal.@sync @metal threads = N nextafter_test(buffer1, typemax(T))
369+
@test Array(buffer1) == nextfloat.(arr)
370+
Metal.@sync @metal threads = N nextafter_test(buffer1, typemin(T))
371+
@test Array(buffer1) == arr
372+
373+
# test for metal < 3.1
374+
buffer2 = MtlArray(arr)
375+
Metal.@sync @metal threads = N metal = v"3.0" nextafter_test(buffer2, typemax(T))
376+
@test Array(buffer2) == nextfloat.(arr)
377+
Metal.@sync @metal threads = N metal = v"3.0" nextafter_test(buffer2, typemin(T))
378+
@test Array(buffer2) == arr
371379
end
372380
end
373381
end

0 commit comments

Comments
 (0)