Skip to content

TypeError: in <:, expected Type, got Vararg{Any} in should_rewrite_invoke #1716

@avik-pal

Description

@avik-pal

The repro is not super clean but running https://github.com/LuxDL/Lux.jl/tree/main/examples/ConvolutionalVAE produces this (seems to have started with one of the newer versions).

ERROR: TypeError: in <:, expected Type, got Vararg{Any}
Stacktrace:
   [1] should_rewrite_invoke
     @ /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:277 [inlined]
   [2] call_with_reactant_generator(world::UInt64, source::LineNumberNode, self::Any, redub_arguments::Any)
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:708
   [3] make_oc_ref
     @ /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:519 [inlined]
   [4] (::Nothing)(none::typeof(Reactant.call_with_reactant), none::Tuple{…})
     @ Reactant ./<missing>:0
   [5] call_with_reactant(::typeof(Reactant.call_with_reactant), ::typeof(ReactantCore.materialize_traced_array), ::Reactant.TracedRArray{…})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:519
   [6] #164
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Overlay.jl:27 [inlined]
   [7] (::Nothing)(none::Reactant.var"#164#166", none::Reactant.TracedRArray{Float32, 1})
     @ Reactant ./<missing>:0
   [8] call_with_reactant(::Reactant.var"#164#166", ::Reactant.TracedRArray{Float32, 1})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:519
   [9] ExcludeWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:126 [inlined]
  [10] CachedWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:177 [inlined]
  [11] (::Nothing)(none::Functors.CachedWalk{…}, none::Function, none::Reactant.TracedRArray{…}, none::Tuple{})
     @ Reactant ./<missing>:0
  [12] call_with_reactant(::Functors.CachedWalk{…}, ::Function, ::Reactant.TracedRArray{…})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:893
  [13] recurse
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:54 [inlined]
  [14] map
     @ ./tuple.jl:357 [inlined]
  [15] map
     @ ./namedtuple.jl:266 [inlined]
  [16] _map
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:3 [inlined]
  [17] DefaultWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:73 [inlined]
  [18] ExcludeWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:126 [inlined]
  [19] CachedWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:177 [inlined]
  [20] recurse
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:54 [inlined]
  [21] map
     @ ./tuple.jl:356 [inlined]
  [22] map
     @ ./namedtuple.jl:266 [inlined]
  [23] _map
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:3 [inlined]
  [24] DefaultWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:73 [inlined]
  [25] ExcludeWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:126 [inlined]
  [26] CachedWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:177 [inlined]
  [27] recurse
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:54 [inlined]
  [28] (::Nothing)(none::Functors.var"#recurse#27"{Functors.CachedWalk{}}, none::Tuple{@NamedTuple{…}})
     @ Reactant ./<missing>:0
  [29] recurse
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:54 [inlined]
  [30] call_with_reactant(::Functors.var"#recurse#27"{}, ::@NamedTuple{})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:0
  [31] map
     @ ./tuple.jl:358 [inlined]
  [32] map
     @ ./namedtuple.jl:266 [inlined]
  [33] (::Nothing)(none::typeof(map), none::Function, none::@NamedTuple{}, none::Tuple{})
     @ Reactant ./<missing>:0
  [34] call_with_reactant(::typeof(map), ::Function, ::@NamedTuple{})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:893
  [35] _map
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:3 [inlined]
  [36] DefaultWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:73 [inlined]
  [37] ExcludeWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:126 [inlined]
  [38] CachedWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:177 [inlined]
  [39] recurse
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:54 [inlined]
  [40] map
     @ ./tuple.jl:358 [inlined]
  [41] map
     @ ./namedtuple.jl:266 [inlined]
  [42] _map
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:3 [inlined]
  [43] DefaultWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:73 [inlined]
  [44] ExcludeWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:126 [inlined]
  [45] CachedWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:177 [inlined]
  [46] recurse
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:54 [inlined]
  [47] map
     @ ./tuple.jl:356 [inlined]
  [48] map
     @ ./namedtuple.jl:266 [inlined]
  [49] _map
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:3 [inlined]
  [50] DefaultWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:73 [inlined]
  [51] ExcludeWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:126 [inlined]
  [52] CachedWalk
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:177 [inlined]
  [53] execute
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:55 [inlined]
  [54] (::Nothing)(none::typeof(Functors.execute), none::Functors.CachedWalk{…}, none::@NamedTuple{}, none::Tuple{})
     @ Reactant ./<missing>:0
  [55] execute
     @ /mnt/.julia/packages/Functors/LbNAu/src/walks.jl:54 [inlined]
  [56] call_with_reactant(::typeof(Functors.execute), ::Functors.CachedWalk{…}, ::@NamedTuple{})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:0
  [57] #fmap#41
     @ /mnt/.julia/packages/Functors/LbNAu/src/maps.jl:11 [inlined]
  [58] (::Nothing)(none::Functors.var"##fmap#41", none::Function, none::Functors.DefaultWalk, none::IdDict{…}, none::Functors.NoKeyword, none::typeof(Functors.fmap), none::Function, none::@NamedTuple{}, none::Tuple{})
     @ Reactant ./<missing>:0
  [59] call_with_reactant(::Functors.var"##fmap#41", ::Function, ::Functors.DefaultWalk, ::IdDict{…}, ::Functors.NoKeyword, ::typeof(Functors.fmap), ::Function, ::@NamedTuple{})
     @ Reactant /mnt/.julia/packages/Functors/LbNAu/src/maps.jl:7
  [60] fmap
     @ /mnt/.julia/packages/Functors/LbNAu/src/maps.jl:3 [inlined]
  [61] (::Nothing)(none::typeof(Functors.fmap), none::Function, none::@NamedTuple{}, none::Tuple{})
     @ Reactant ./<missing>:0
  [62] GenericMemory
     @ boot.jl:516 [inlined]
  [63] IdDict
     @ iddict.jl:31 [inlined]
  [64] IdDict
     @ iddict.jl:49 [inlined]
  [65] call_with_reactant(::typeof(Functors.fmap), ::Function, ::@NamedTuple{encoder::@NamedTuple{}, decoder::@NamedTuple{}})
     @ Reactant /mnt/.julia/packages/Functors/LbNAu/src/maps.jl:3
  [66] #163
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Overlay.jl:26 [inlined]
  [67] map
     @ ./tuple.jl:355 [inlined]
  [68] #ignore_derivatives
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Overlay.jl:25 [inlined]
  [69] objective_function_wrapper
     @ /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:3 [inlined]
  [70] (::Nothing)(none::typeof(LuxReactantExt.objective_function_wrapper), none::typeof(loss_function), none::CVAE{…}, none::@NamedTuple{}, none::@NamedTuple{}, none::Reactant.TracedRArray{…})
     @ Reactant ./<missing>:0
  [71] objective_function_wrapper
     @ /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:2 [inlined]
  [72] call_with_reactant(::typeof(LuxReactantExt.objective_function_wrapper), ::typeof(loss_function), ::CVAE{…}, ::@NamedTuple{}, ::@NamedTuple{}, ::Reactant.TracedRArray{…})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:0
  [73] make_mlir_fn(f::typeof(LuxReactantExt.objective_function_wrapper), args::Tuple{…}, kwargs::Tuple{}, 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::Nothing, verify_arg_names::Nothing, argprefix::Symbol, resprefix::Symbol, resargprefix::Symbol, num_replicas::Int64, optimize_then_pad::Bool)
     @ Reactant.TracedUtils /mnt/.julia/packages/Reactant/wVtGC/src/TracedUtils.jl:348
  [74] make_mlir_fn
     @ /mnt/.julia/packages/Reactant/wVtGC/src/TracedUtils.jl:278 [inlined]
  [75] overload_autodiff(::ReverseMode{…}, ::Const{…}, ::Type{…}, ::Const{…}, ::Const{…}, ::Duplicated{…}, ::Const{…}, ::Const{…})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/Enzyme.jl:308
  [76] autodiff(::ReverseMode{…}, ::Const{…}, ::Type{…}, ::Const{…}, ::Const{…}, ::Duplicated{…}, ::Const{…}, ::Const{…})
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/Overlay.jl:21
  [77] macro expansion
     @ /mnt/.julia/packages/Enzyme/X4pFp/src/sugar.jl:286 [inlined]
  [78] gradient
     @ /mnt/.julia/packages/Enzyme/X4pFp/src/sugar.jl:273 [inlined]
  [79] compute_gradients_internal
     @ /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:7 [inlined]
  [80] compute_gradients_internal_and_step!
     @ /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:148 [inlined]
  [81] (::Nothing)(none::typeof(LuxReactantExt.compute_gradients_internal_and_step!), none::typeof(loss_function), none::CVAE{…}, none::Reactant.TracedRArray{…}, none::@NamedTuple{}, none::@NamedTuple{}, none::@NamedTuple{}, none::Static.False)
     @ Reactant ./<missing>:0
  [82] Const
     @ /mnt/.julia/packages/EnzymeCore/DU3Pm/src/EnzymeCore.jl:30 [inlined]
  [83] compute_gradients_internal
     @ /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:7 [inlined]
  [84] compute_gradients_internal_and_step!
     @ /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:148 [inlined]
  [85] call_with_reactant(::typeof(LuxReactantExt.compute_gradients_internal_and_step!), ::typeof(loss_function), ::CVAE{…}, ::Reactant.TracedRArray{…}, ::@NamedTuple{}, ::@NamedTuple{}, ::@NamedTuple{}, ::Static.False)
     @ Reactant /mnt/.julia/packages/Reactant/wVtGC/src/utils.jl:0
  [86] make_mlir_fn(f::typeof(LuxReactantExt.compute_gradients_internal_and_step!), 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 /mnt/.julia/packages/Reactant/wVtGC/src/TracedUtils.jl:348
  [87] 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 /mnt/.julia/packages/Reactant/wVtGC/src/Compiler.jl:1594
  [88] compile_mlir! (repeats 2 times)
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Compiler.jl:1561 [inlined]
  [89] compile_xla(f::Function, args::Tuple{…}; before_xla_optimizations::Bool, client::Nothing, serializable::Bool, kwargs::@Kwargs{})
     @ Reactant.Compiler /mnt/.julia/packages/Reactant/wVtGC/src/Compiler.jl:3483
  [90] compile_xla
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Compiler.jl:3456 [inlined]
  [91] compile(f::Function, args::Tuple{…}; kwargs::@Kwargs{})
     @ Reactant.Compiler /mnt/.julia/packages/Reactant/wVtGC/src/Compiler.jl:3555
  [92] macro expansion
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Compiler.jl:2633 [inlined]
  [93] (::LuxReactantExt.var"#15#17"{Lux.Training.ReactantBackend{}, typeof(loss_function), ConcretePJRTArray{}})()
     @ LuxReactantExt /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:86
  [94] with(f::LuxReactantExt.var"#15#17"{}, pair::Pair{…}, rest::Pair{…})
     @ Base.ScopedValues ./scopedvalues.jl:269
  [95] #with_config#14
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Configuration.jl:70 [inlined]
  [96] with_config
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Configuration.jl:39 [inlined]
  [97] with_default_precision_config(f::LuxReactantExt.var"#15#17"{}, ps::@NamedTuple{})
     @ LuxReactantExt /mnt/software/lux/Lux.jl/ext/LuxReactantExt/LuxReactantExt.jl:67
  [98] macro expansion
     @ /mnt/software/lux/Lux.jl/ext/LuxReactantExt/training.jl:85 [inlined]
  [99] (::LuxReactantExt.var"#14#16"{Lux.Training.ReactantBackend{}, typeof(loss_function), ConcretePJRTArray{}})()
     @ LuxReactantExt /mnt/.julia/packages/Reactant/wVtGC/src/Profiler.jl:105
 [100] annotate(f::LuxReactantExt.var"#14#16"{}, name::String, level::Int32)
     @ Reactant.Profiler /mnt/.julia/packages/Reactant/wVtGC/src/Profiler.jl:80
 [101] annotate
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Profiler.jl:76 [inlined]
 [102] single_train_step_impl!
     @ /mnt/.julia/packages/Reactant/wVtGC/src/Profiler.jl:105 [inlined]
 [103] #single_train_step!#6
     @ /mnt/software/lux/Lux.jl/src/helpers/training.jl:297 [inlined]
 [104] main(; batchsize::Int64, image_size::Tuple{…}, num_latent_dims::Int64, max_num_filters::Int64, seed::Int64, epochs::Int64, weight_decay::Float64, learning_rate::Float64, num_samples::Int64)
     @ Main /mnt/software/lux/Lux.jl/examples/ConvolutionalVAE/main.jl:292
 [105] main()
     @ Main /mnt/software/lux/Lux.jl/examples/ConvolutionalVAE/main.jl:244
Some type information was truncated. Use `show(err)` to see complete types.

Full stacktrace: https://pastebin.com/xC9Bg65r

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