Skip to content

Commit

Permalink
[tests] Always skip CUDA tests on non-CUDA machines
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Jan 25, 2025
1 parent 2118ee2 commit 998d755
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions test/integration/cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ function square!(x, y)
return nothing
end

# GPUCompiler throws "Not implemented" errors on aarch64 before
# <https://github.com/JuliaLang/julia/pull/57077> for some tests.
const skip_tests =
Base.BinaryPlatforms.arch(Base.BinaryPlatforms.HostPlatform()) == "aarch64" &&
VERSION <= v"1.11.3"
# https://github.com/EnzymeAD/Reactant.jl/issues/614
const skip_non_cuda_tests = true

@static if !Sys.isapple()
@testset "Square Kernel" begin
Expand All @@ -32,7 +29,9 @@ const skip_tests =
@test all(Array(A) .≈ (oA .* oA .* 100))
@test all(Array(B) .≈ (oA .* 100))
else
@static if !skip_tests
@static if skip_non_cuda_tests
@test false broken = true
else
@code_hlo optimize = :before_kernel square!(A, B)
end
end
Expand Down Expand Up @@ -61,7 +60,9 @@ end
@test all(Array(A) .≈ oA .* sin.(oA .* 100))
@test all(Array(B) .≈ (oA .* 100))
else
@static if !skip_tests
@static if skip_non_cuda_tests
@test false broken = true
else
@code_hlo optimize = :before_kernel sin!(A, B)
end
end
Expand Down Expand Up @@ -89,7 +90,9 @@ end
@jit smul!(A)
@test all(Array(A) .≈ oA .* 15)
else
@static if !skip_tests
@static if skip_non_cuda_tests
@test false broken = true
else
@code_hlo optimize = :before_kernel smul!(A)
end
end
Expand All @@ -116,7 +119,9 @@ tuplef2(a) = @cuda threads = 1 tuplef2!((5, a))
@jit tuplef(A)
@test all(Array(A) .≈ 3)
else
@static if !skip_tests
@static if skip_non_cuda_tests
@test false broken = true
else
@code_hlo optimize = :before_kernel tuplef(A)
end
end
Expand All @@ -126,7 +131,9 @@ tuplef2(a) = @cuda threads = 1 tuplef2!((5, a))
@jit tuplef2(A)
@test all(Array(A) .≈ 5)
else
@static if !skip_tests
@static if skip_non_cuda_tests
@test false broken = true
else
@code_hlo optimize = :before_kernel tuplef2(A)
end
end
Expand All @@ -136,7 +143,9 @@ tuplef2(a) = @cuda threads = 1 tuplef2!((5, a))
@jit tuplef2(A)
@test all(Array(A) .≈ 5)
else
@static if !skip_tests
@static if skip_non_cuda_tests
@test false broken = true
else
@code_hlo optimize = :before_kernel tuplef2(A)
end
end
Expand Down Expand Up @@ -164,7 +173,9 @@ end
@jit aliased(a)
@test all(Array(a) .== 9)
else
@static if !skip_tests
@static if skip_non_cuda_tests
@test false broken = true
else
@code_hlo optimize = :before_kernel aliased(a)
end
end
Expand Down

0 comments on commit 998d755

Please sign in to comment.