Skip to content

GPU workflow in docs fails with Metal on MacOS because it doesn't support Float64 #637

@bjarthur

Description

@bjarthur

i took care to use Float32 for everything i passed in, so somewhere in Interpolations.jl a Float64 is used.

julia> using Interpolations, Metal, Adapt

julia> itp = Interpolations.interpolate([1, 2, 3.0f0], BSpline(Linear()))
3-element interpolate(::Vector{Float32}, BSpline(Linear())) with element type Float32:
 1.0
 2.0
 3.0

julia> mtlitp = adapt(MtlArray{Float32}, itp);

julia> mtlitp.(1f0)
1.0f0

julia> mtlitp.(1f0:3f0)
ERROR: InvalidIRError: compiling MethodInstance for (::Metal.var"#broadcast_linear#_copyto!##1")(::MtlDeviceVector{…}, ::Base.Broadcast.Broadcasted{…}) resulted in invalid LLVM IR
Reason: unsupported use of double value
Reason: unsupported use of double value
Reason: unsupported use of double value
Stacktrace:
  [1] Float64
    @ ./float.jl:245
  [2] convert
    @ ./number.jl:7
  [3] _promote
    @ ./promotion.jl:379
  [4] promote
    @ ./promotion.jl:404
  [5] *
    @ ./promotion.jl:434
  [6] unsafe_getindex
    @ ./range.jl:970
  [7] _getindex
    @ ./range.jl:936
  [8] getindex
    @ ./array.jl:3134
  [9] _broadcast_getindex
    @ ./broadcast.jl:665
 [10] _getindex
    @ ./broadcast.jl:696
 [11] _broadcast_getindex
    @ ./broadcast.jl:671
 [12] _getindex
    @ ./broadcast.jl:620
 [13] getindex
    @ ./broadcast.jl:616
 [14] broadcast_linear
    @ ~/.julia/packages/Metal/av3If/src/broadcast.jl:97

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions