Skip to content

ConcreteArrays of non-primitive isbits types #1778

@albertomercurio

Description

@albertomercurio

If I run the following code it fails

a = Iterators.product(1:3, 1:3) |> collect
Reactant.ConcreteRArray(a)
ERROR: MethodError: no method matching primitive_type(::Type{Tuple{Int64, Int64}})
The function `primitive_type` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  primitive_type(::Type{UInt16})
   @ Reactant ~/.julia/packages/Reactant/IgTfV/src/xla/Utils.jl:44
  primitive_type(::Type{UInt8})
   @ Reactant ~/.julia/packages/Reactant/IgTfV/src/xla/Utils.jl:44
  primitive_type(::Type{Reactant.F8E5M2FNUZ})
   @ Reactant ~/.julia/packages/Reactant/IgTfV/src/xla/Utils.jl:44
  ...

Stacktrace:
 [1] Reactant.XLA.PJRT.Buffer(client::Reactant.XLA.PJRT.Client, array::Matrix{Tuple{…}}, device::Reactant.XLA.PJRT.Device)
   @ Reactant.XLA.PJRT ~/.julia/packages/Reactant/IgTfV/src/xla/PJRT/Buffer.jl:12
 [2] Reactant.XLA.PJRT.AsyncBuffer(::Reactant.XLA.PJRT.Client, ::Vararg{Any}; kwargs::@Kwargs{})
   @ Reactant.XLA.PJRT ~/.julia/packages/Reactant/IgTfV/src/xla/PJRT/AsyncBuffer.jl:8
 [3] (::Reactant.Sharding.NoSharding)(client::Reactant.XLA.PJRT.Client, device::Reactant.XLA.PJRT.Device, x::Matrix{…})
   @ Reactant.Sharding ~/.julia/packages/Reactant/IgTfV/src/Sharding.jl:193
 [4] ConcretePJRTArray(data::Matrix{…}; client::Nothing, idx::Nothing, device::Nothing, sharding::Reactant.Sharding.NoSharding)
   @ Reactant ~/.julia/packages/Reactant/IgTfV/src/Types.jl:230
 [5] ConcretePJRTArray(data::Matrix{Tuple{Int64, Int64}})
   @ Reactant ~/.julia/packages/Reactant/IgTfV/src/Types.jl:222
 [6] top-level scope
   @ ~/GitHub/gcs_misc/notebooks/loop_spin_expval.jl:633
Some type information was truncated. Use `show(err)` to see complete types.

While it works if I convert it to a CuArray instead

julia> CuArray(a)
3×3 CuArray{Tuple{Int64, Int64}, 2, CUDA.DeviceMemory}:
 (1, 1)  (1, 2)  (1, 3)
 (2, 1)  (2, 2)  (2, 3)
 (3, 1)  (3, 2)  (3, 3)

Also, using to_rarray doesn't do anything

julia> Reactant.to_rarray(a)
3×3 Matrix{Tuple{Int64, Int64}}:
 (1, 1)  (1, 2)  (1, 3)
 (2, 1)  (2, 2)  (2, 3)
 (3, 1)  (3, 2)  (3, 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions