Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error for map! misuse #482

Open
maleadt opened this issue Jun 29, 2023 · 0 comments
Open

Better error for map! misuse #482

maleadt opened this issue Jun 29, 2023 · 0 comments

Comments

@maleadt
Copy link
Member

maleadt commented Jun 29, 2023

julia> map!(sqrt, rand(1))
ERROR: ArgumentError: map! requires at least one "source" argument
Stacktrace:
 [1] map!(::typeof(sqrt), ::Vector{Float64})
   @ Base ./abstractarray.jl:3353
 [2] top-level scope
   @ REPL[17]:1
 [3] top-level scope
   @ ~/Julia/pkg/Metal/src/initialization.jl:51

vs

julia> map!(sqrt, Metal.rand(1))
ERROR: InvalidIRError: compiling MethodInstance for (::GPUArrays.var"#map_kernel#27"{Int64})(::Metal.mtlKernelContext, ::MtlDeviceVector{Float32, 1}, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(sqrt), Tuple{}}, ::Int64) resulted in invalid LLVM IR
Reason: unsupported dynamic function invocation (call to sqrt)
Stacktrace:
 [1] _broadcast_getindex_evalf
   @ ./broadcast.jl:683
 [2] _broadcast_getindex
   @ ./broadcast.jl:656
 [3] getindex
   @ ./broadcast.jl:610
 [4] map_kernel
   @ ~/Julia/pkg/GPUArrays/src/host/broadcast.jl:118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant