EnzymeAD / EnzymeAD/Reactant.jl

ConcreteArrays of non-primitive isbits types

Open
#1,778 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
370
Forks
74
Avg merge
18h 47m
Merged PRs (30d)
30

Description

If I run the following code it fails

```julia
a = Iterators.product(1:3, 1:3) |> collect
Reactant.ConcreteRArray(a)
```

```julia
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-repl
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-repl
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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.