Skip to content

Commit 1080de5

Browse files
authored
Extend non-isbits argument error text. (#638)
1 parent d370e19 commit 1080de5

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/validation.jl

+7-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,13 @@ function check_invocation(@nospecialize(job::CompilerJob))
8989
end
9090

9191
if !isbitstype(dt)
92-
throw(KernelError(job, "passing and using non-bitstype argument",
93-
"""Argument $arg_i to your kernel function is of type $dt, which is not isbits:
94-
$(explain_nonisbits(dt))"""))
92+
throw(KernelError(job, "passing non-bitstype argument",
93+
"""Argument $arg_i to your kernel function is of type $dt, which is not a bitstype:
94+
$(explain_nonisbits(dt))
95+
96+
Only bitstypes, which are "plain data" types that are immutable
97+
and contain no references to other values, can be used in GPU kernels.
98+
For more information, see the `Base.isbitstype` function."""))
9599
end
96100
end
97101

test/native_tests.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,14 @@ Base.unsafe_trunc(::Type{Int}, x::CleverType) = unsafe_trunc(Int, x.x)
374374

375375
@test_throws_message(KernelError,
376376
Native.code_execution(foobar, Tuple{BigInt})) do msg
377-
occursin("passing and using non-bitstype argument", msg) &&
377+
occursin("passing non-bitstype argument", msg) &&
378378
occursin("BigInt", msg)
379379
end
380380

381381
# test that we get information about fields and reason why something is not isbits
382382
@test_throws_message(KernelError,
383383
Native.code_execution(foobar, Tuple{CleverType{BigInt}})) do msg
384-
occursin("passing and using non-bitstype argument", msg) &&
384+
occursin("passing non-bitstype argument", msg) &&
385385
occursin("CleverType", msg) &&
386386
occursin("BigInt", msg)
387387
end

0 commit comments

Comments
 (0)