Skip to content

Commit

Permalink
Merge pull request #827 from JuliaGPU/tb/test_device_only
Browse files Browse the repository at this point in the history
Test validation of GPU-only function.
  • Loading branch information
maleadt authored Apr 12, 2021
2 parents ef2a610 + 3e2f10f commit c8deec5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ version = "6.2.2"

[[GPUCompiler]]
deps = ["DataStructures", "ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "Scratch", "Serialization", "TimerOutputs", "UUIDs"]
git-tree-sha1 = "a5a239b8c688f59872eb689edd75395e97cc6641"
git-tree-sha1 = "7f13030524614d90c876332c980fd1edef2331e8"
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
version = "0.11.2"
version = "0.11.3"

[[InteractiveUtils]]
deps = ["Markdown"]
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CEnum = "0.2, 0.3, 0.4"
DataStructures = "0.17, 0.18"
ExprTools = "0.1"
GPUArrays = "6.1.0"
GPUCompiler = "0.11.1"
GPUCompiler = "0.11.3"
LLVM = "3"
MacroTools = "0.5"
Memoize = "0.4"
Expand Down
15 changes: 15 additions & 0 deletions test/device/intrinsics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ end
@test testf(a->op.(a, T(2)), T[-1])
end
end

@testset "rsqrt" begin
# GPUCompiler.jl#173: a CUDA-only device function fails to validate
function kernel(a)
a[] = CUDA.rsqrt(a[])
return
end

# make sure this test uses an actual device function
@test_throws ErrorException kernel(ones(1))

a = CuArray{Float32}([4])
@cuda kernel(a)
@test Array(a) == [0.5]
end
end


Expand Down

0 comments on commit c8deec5

Please sign in to comment.