EnzymeAD / EnzymeAD/Reactant.jl
TypeError in traced_type_inner
- Dominant language
- Julia
- Stars
- 370
- Forks
- 74
- Avg merge
- 18h 47m
- Merged PRs (30d)
- 30
Description
Hello, I have some code that I think should work, and it does work in with variants that are slightly different than this:
```julia
using Reactant
struct Data{T, V <: AbstractArray{T, 3}, MA}
data::V
alg::MA
function Data(data::V, alg::MA) where {T, V <: AbstractArray{T, 3}, MA}
new{T, V, MA}(data, alg)
end
end
struct AStruct end
bd = Data(Reactant.to_rarray(ones(Float32, 2, 2, 3)), AStruct())
x = Reactant.to_rarray(ones(Float32, 2, 2, 3))
function xpp(bd, x)
bd.data .= x
bd
end
@jit xpp(bd, x)
```
When I run the code above, however, I get the error:
```julia
ERROR: TypeError: in Data, in V, expected V<:AbstractArray{Float32, 3}, got Type{Reactant.TracedRArray{Float32, 3}}
Stacktrace:
[1] traced_type_inner(T::Type, seen::Dict{…}, mode::Reactant.TraceMode, track_numbers::Type, sharding::Any, runtime::Any)
@ Reactant ~/.julia/dev/Reactant/src/Tracing.jl:734
[2] traced_type(T::Type, ::Val{…}, track_numbers::Type, sharding::Reactant.Sharding.NoSharding, runtime::Val{…})
@ Reactant ~/.julia/dev/Reactant/src/Tracing.jl:870
[3] make_tracer_unknown(seen::Reactant.OrderedIdDict{…}, prev::Any, path::Any, mode::Reactant.TraceMode; track_numbers::Type, sharding::Any, runtime::Any, kwargs::@Kwargs{…})
@ Reactant ~/.julia/dev/Reactant/src/Tracing.jl:1032
[4] make_tracer_unknown
@ ~/.julia/dev/Reactant/src/Tracing.jl:1009 [inlined]
[5] #make_tracer#134
@ ~/.julia/dev/Reactant/src/Tracing.jl:1146 [inlined]
[6] make_tracer
@ ~/.julia/dev/Reactant/src/Tracing.jl:1136 [inlined]
[7] prepare_mlir_fn_args(args::Tuple{…}, name::String, concretein::Bool, toscalar::Bool, argprefix::Symbol, runtime::Val{…}, optimize_then_pad::Bool, do_transpose::Bool, input_shardings::Nothing, verify_arg_names::Nothing)
@ Reactant.TracedUtils ~/.julia/dev/Reactant/src/TracedUtils.jl:448
[8] make_mlir_fn(f::typeof(xpp), args::Tuple{…}, kwargs::@NamedTuple{}, name::String, concretein::Bool; toscalar::Bool, return_dialect::Symbol, args_in_result::Symbol, construct_function_without_args::Bool, do_transpose::Bool, input_shardings::Nothing, output_shardings::Nothing, runtime::Val{…}, verify_arg_names::Nothing, argprefix::Symbol, resprefix::Symbol, resargprefix::Symbol, num_replicas::Int64, optimize_then_pad::Bool)
@ Reactant.TracedUtils ~/.julia/dev/Reactant/src/TracedUtils.jl:320
[9] compile_mlir!(mod::Reactant.MLIR.IR.Module, f::Function, args::Tuple{…}, compile_options::CompileOptions, callcache::Dict{…}, sdycache::Dict{…}; fn_kwargs::@NamedTuple{}, backend::String, runtime::Val{…}, legalize_stablehlo_to_mhlo::Bool, kwargs::@Kwargs{})
@ Reactant.Compiler ~/.julia/dev/Reactant/src/Compiler.jl:1570
[10] compile_mlir! (repeats 2 times)
@ ~/.julia/dev/Reactant/src/Compiler.jl:1537 [inlined]
[11] compile_xla(f::Function, args::Tuple{…}; before_xla_optimizations::Bool, client::Nothing, serializable::Bool, kwargs::@Kwargs{…})
@ Reactant.Compiler ~/.julia/dev/Reactant/src/Compiler.jl:3448
[12] compile_xla
@ ~/.julia/dev/Reactant/src/Compiler.jl:3421 [inlined]
[13] compile(f::Function, args::Tuple{…}; kwargs::@Kwargs{…})
@ Reactant.Compiler ~/.julia/dev/Reactant/src/Compiler.jl:3520
[14] top-level scope
@ ~/.julia/dev/Reactant/src/Compiler.jl:2601
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.