Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Reactant.MLIR.IR.Type? #827

Open
glwagner opened this issue Mar 1, 2025 · 1 comment
Open

Bug in Reactant.MLIR.IR.Type? #827

glwagner opened this issue Mar 1, 2025 · 1 comment

Comments

@glwagner
Copy link
Collaborator

glwagner commented Mar 1, 2025

Encountered the error below. I can come up with a reproducer if need be.

ERROR: LoadError: MethodError: no method matching Reactant.MLIR.IR.Type(::Vector{Any}; context::Reactant.MLIR.IR.Context)

Closest candidates are:
  Reactant.MLIR.IR.Type(::Any) got unsupported keyword argument "context"
   @ Reactant ~/Projects/Reactant.jl/src/mlir/IR/Type.jl:4
  Reactant.MLIR.IR.Type(::Type{Float32}; context)
   @ Reactant ~/Projects/Reactant.jl/src/mlir/IR/Type.jl:185
  Reactant.MLIR.IR.Type(::Type{Bool}; context)
   @ Reactant ~/Projects/Reactant.jl/src/mlir/IR/Type.jl:76
  ...

Stacktrace:
  [1] Reactant.MLIR.IR.Type(T::Type{Tuple{UInt8, UInt8}}; context::Reactant.MLIR.IR.Context)
    @ Reactant.MLIR.IR ~/Projects/Reactant.jl/src/mlir/IR/Type.jl:635
  [2] Reactant.MLIR.IR.Type(T::Type{Tuple{UInt8, UInt8}})
    @ Reactant.MLIR.IR ~/Projects/Reactant.jl/src/mlir/IR/Type.jl:634
  [3] DenseElementsAttribute(values::Vector{Tuple{UInt8, UInt8}})
    @ Reactant.MLIR.IR ~/Projects/Reactant.jl/src/mlir/IR/Attribute.jl:612
  [4] constant(x::Vector{Tuple{UInt8, UInt8}}; location::Reactant.MLIR.IR.Location)
    @ Reactant.Ops ~/Projects/Reactant.jl/src/Ops.jl:74
  [5] constant(x::Vector{Tuple{UInt8, UInt8}})
    @ Reactant.Ops ~/Projects/Reactant.jl/src/Ops.jl:71
  [6] adapt_storage(ka::ReactantCUDAExt.ReactantKernelAdaptor, xs::Vector{Tuple{UInt8, UInt8}})
    @ ReactantCUDAExt ~/Projects/Reactant.jl/ext/ReactantCUDAExt.jl:258
  [7] adapt_structure(to::ReactantCUDAExt.ReactantKernelAdaptor, x::Vector{Tuple{UInt8, UInt8}})
    @ Adapt ~/.julia/packages/Adapt/YR1WS/src/Adapt.jl:57
  [8] adapt(to::ReactantCUDAExt.ReactantKernelAdaptor, x::Vector{Tuple{UInt8, UInt8}})
    @ Adapt ~/.julia/packages/Adapt/YR1WS/src/Adapt.jl:40
  [9] recudaconvert(arg::Vector{Tuple{UInt8, UInt8}})
    @ ReactantCUDAExt ~/Projects/Reactant.jl/ext/ReactantCUDAExt.jl:349
 [10] cudaconvert(arg::Vector{Tuple{UInt8, UInt8}})
    @ ReactantCUDAExt ~/Projects/Reactant.jl/ext/ReactantCUDAExt.jl:352
 [11] map (repeats 5 times)
    @ ./tuple.jl:294 [inlined]
 [12] macro expansion
    @ ~/.julia/packages/CUDA/1kIOw/src/compiler/execution.jl:110 [inlined]
 [13] ka_with_reactant
    @ ~/Projects/Reactant.jl/ext/ReactantCUDAExt.jl:293 [inlined]
 [14] ka_with_reactant(none::Nothing, none::Nothing, none::KernelAbstractions.Kernel{…}, none::Tuple{…})
    @ Reactant ./<missing>:0
 [15] ka_with_reactant
    @ ~/Projects/Reactant.jl/ext/ReactantCUDAExt.jl:287 [inlined]
 [16] call_with_reactant(::typeof(ReactantCUDAExt.ka_with_reactant), ::Nothing, ::Nothing, ::KernelAbstractions.Kernel{…}, ::Field{…}, ::Field{…}, ::ImmersedBoundaryGrid{…}, ::Vector{…}, ::Field{…}, ::Field{…}, ::Field{…})
    @ Reactant ~/Projects/Reactant.jl/src/utils.jl:0
 [17] (::KernelAbstractions.Kernel{…})(::Field{…}, ::Vararg{…}; ndrange::Nothing, workgroupsize::Nothing)
    @ ReactantCUDAExt ~/Projects/Reactant.jl/ext/ReactantCUDAExt.jl:333
 [18] #kwcall
    @ ~/Projects/Reactant.jl/ext/ReactantCUDAExt.jl:330 [inlined]
 [19] tokw
    @ ~/Projects/Reactant.jl/ext/ReactantKernelAbstractionsExt.jl:89 [inlined]
 [20] tokw(none::Nothing, none::Nothing, none::KernelAbstractions.Kernel{…}, none::Tuple{…})
    @ Reactant ./<missing>:0
 [21] tokw
    @ ~/Projects/Reactant.jl/ext/ReactantKernelAbstractionsExt.jl:89 [inlined]
 [22] call_with_reactant(::typeof(ReactantKernelAbstractionsExt.tokw), ::Nothing, ::Nothing, ::KernelAbstractions.Kernel{…}, ::Field{…}, ::Field{…}, ::ImmersedBoundaryGrid{…}, ::Vector{…}, ::Field{…}, ::Field{…}, ::Field{…})
    @ Reactant ~/Projects/Reactant.jl/src/utils.jl:0
 [23] make_mlir_fn(f::Function, 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)
    @ Reactant.TracedUtils ~/Projects/Reactant.jl/src/TracedUtils.jl:256
 [24] make_mlir_fn
    @ ~/Projects/Reactant.jl/src/TracedUtils.jl:153 [inlined]
 [25] compile_mlir!(mod::Reactant.MLIR.IR.Module, f::Function, args::Tuple{…}, callcache::Dict{…}, sdycache::IdDict{…}; optimize::Bool, no_nan::Bool, backend::String, fn_kwargs::@NamedTuple{}, raise::Bool)
    @ Reactant.Compiler ~/Projects/Reactant.jl/src/Compiler.jl:655
 [26] compile_mlir! (repeats 2 times)
    @ ~/Projects/Reactant.jl/src/Compiler.jl:613 [inlined]
 [27] compile_xla(f::Function, args::Tuple{…}; client::Nothing, kwargs::@Kwargs{…})
    @ Reactant.Compiler ~/Projects/Reactant.jl/src/Compiler.jl:1534
 [28] compile_xla
    @ ~/Projects/Reactant.jl/src/Compiler.jl:1516 [inlined]
 [29] compile(f::Function, args::Tuple{…}; sync::Bool, kwargs::@Kwargs{…})
    @ Reactant.Compiler ~/Projects/Reactant.jl/src/Compiler.jl:1579
 [30] macro expansion
    @ ~/Projects/Reactant.jl/src/Compiler.jl:1098 [inlined]
 [31] (::KernelAbstractions.Kernel{…})(::Field{…}, ::Vararg{…}; ndrange::Nothing, workgroupsize::Nothing)
    @ ReactantKernelAbstractionsExt ~/Projects/Reactant.jl/ext/ReactantKernelAbstractionsExt.jl:93
 [32] (::KernelAbstractions.Kernel{…})(::Field{…}, ::Vararg{…})
    @ ReactantKernelAbstractionsExt ~/Projects/Reactant.jl/ext/ReactantKernelAbstractionsExt.jl:92
 [33] #_launch!#12
    @ ~/Projects/Oceananigans.jl/src/Utils/kernel_launching.jl:298 [inlined]
 [34] _launch!
    @ ~/Projects/Oceananigans.jl/src/Utils/kernel_launching.jl:275 [inlined]
 [35] launch!
    @ ~/Projects/Oceananigans.jl/src/Utils/kernel_launching.jl:258 [inlined]
 [36] compute_barotropic_mode!
    @ ~/Projects/Oceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/SplitExplicitFreeSurfaces/barotropic_split_explicit_corrector.jl:41 [inlined]
 [37] #apply_regionally!#56
    @ ~/Projects/Oceananigans.jl/src/Utils/multi_region_transformation.jl:121 [inlined]
 [38] apply_regionally!
    @ ~/Projects/Oceananigans.jl/src/Utils/multi_region_transformation.jl:118 [inlined]
 [39] macro expansion
    @ ~/Projects/Oceananigans.jl/src/Utils/multi_region_transformation.jl:206 [inlined]
 [40] initialize_free_surface!(sefs::SplitExplicitFreeSurface{…}, grid::ImmersedBoundaryGrid{…}, velocities::@NamedTuple{…})
    @ Oceananigans.Models.HydrostaticFreeSurfaceModels.SplitExplicitFreeSurfaces ~/Projects/Oceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/SplitExplicitFreeSurfaces/initialize_split_explicit_substepping.jl:17
 [41] initialize!
    @ ~/Projects/Oceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl:246 [inlined]
 [42] #set!#25
    @ ~/Projects/Oceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/set_hydrostatic_free_surface_model.jl:63 [inlined]
 [43] macro expansion
    @ ~/.julia/juliaup/julia-1.10.8+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Profile/src/Profile.jl:44 [inlined]
 [44] top-level scope
    @ ~/Projects/GB-25/ocean-climate-simulation/data_free_ocean_climate_simulation.jl:20
 [45] include(fname::String)
    @ Base.MainInclude ./client.jl:494
 [46] top-level scope
    @ REPL[2]:1
in expression starting at /Users/gregorywagner/Projects/GB-25/ocean-climate-simulation/data_free_ocean_climate_simulation.jl:86
Some type information was truncated. Use `show(err)` to see complete types.
@avik-pal
Copy link
Collaborator

avik-pal commented Mar 1, 2025

constant(x::Vector{Tuple{UInt8, UInt8}}) this shouldn't happen. I am surprised we don't specialize the dispatch on ReactantPrimitive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants