EnzymeAD / EnzymeAD/Reactant.jl

missing `Colon` dispatch

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

Description

Hello, I come accross this quite a lot so I thought I would make an mwe here
```julia
function foo(x,i)
return x[1:i]
end
x = Reactant.to_rarray(ones(10));
i = Reactant.to_rarray(2;track_numbers=true);
@compile foo(x,i)
```

error :
```julia
ERROR: MethodError: no method matching (::Colon)(::Int64, ::Reactant.TracedRNumber{Int64})
The function `Colon()` exists, but no method is defined for this combination of argument types.

Closest candidates are:
(::Colon)(::T, ::Any, ::T) where T<:Real
@ Base range.jl:50
(::Colon)(::A, ::Any, ::C) where {A<:Real, C<:Real}
@ Base range.jl:10
(::Colon)(::T, ::Any, ::T) where T
@ Base range.jl:49
...

Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Reactant/bR5J7/src/utils.jl:0 [inlined]
[2] call_with_reactant(::Reactant.MustThrowError, ::Colon, ::Int64, ::Reactant.TracedRNumber{Int64})
@ Reactant ~/.julia/packages/Reactant/bR5J7/src/utils.jl:893
[3] foo
@ ./REPL[36]:2 [inlined]
[4] (::Nothing)(none::typeof(foo), none::Reactant.TracedRArray{Float64, 1}, none::Reactant.TracedRNumber{Int64})
@ Reactant ./:0
[5] foo
@ ./REPL[36]:2 [inlined]
[6] call_with_reactant(::typeof(foo), ::Reactant.TracedRArray{Float64, 1}, ::Reactant.TracedRNumber{Int64})
@ Reactant ~/.julia/packages/Reactant/bR5J7/src/utils.jl:0
[7] make_mlir_fn(f::typeof(foo), 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/packages/Reactant/bR5J7/src/TracedUtils.jl:348
[8] 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/packages/Reactant/bR5J7/src/Compiler.jl:1594
[9] compile_mlir! (repeats 2 times)
@ ~/.julia/packages/Reactant/bR5J7/src/Compiler.jl:1561 [inlined]
[10] compile_xla(f::Function, args::Tuple{…}; before_xla_optimizations::Bool, client::Nothing, serializable::Bool, kwargs::@Kwargs{…})
@ Reactant.Compiler ~/.julia/packages/Reactant/bR5J7/src/Compiler.jl:3483
[11] compile_xla
@ ~/.julia/packages/Reactant/bR5J7/src/Compiler.jl:3456 [inlined]
[12] compile(f::Function, args::Tuple{…}; kwargs::@Kwargs{…})
@ Reactant.Compiler ~/.julia/packages/Reactant/bR5J7/src/Compiler.jl:3555
[13] top-level scope
@ ~/.julia/packages/Reactant/bR5J7/src/Compiler.jl:2633
Some type information was truncated. Use `show(err)` to see complete types.
```

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.