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

Refactor and unify binding generators #37

Merged
merged 13 commits into from
Jan 16, 2024
Merged

Refactor and unify binding generators #37

merged 13 commits into from
Jan 16, 2024

Conversation

mofeing
Copy link
Collaborator

@mofeing mofeing commented Jan 15, 2024

As suggested by @vchuravy in #27 (comment), offline generation of default dialects is preferred.

The dialect and API must correspond to the same LLVM version. This PR:

  1. Moves the binding generation from online to offline
  2. Unifies both MLIR API and dialect binding generator scripts

TODO

@vchuravy
Copy link
Member

@mofeing

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /tmp/jl_3aV128/x86_64-linux-gnu-libgfortran4-cxx11-libstdcxx29-llvm_version+15-julia_version+1.10.0/destdir/bin/mlir-jl-tblgen --generator=jl-op-defs /tmp/jl_3aV128/x86_64-linux-gnu-libgfortran4-cxx11-libstdcxx29-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Dialect/DLTI/DLTI.td -I /tmp/jl_3aV128/x86_64-linux-gnu-libgfortran4-cxx11-libstdcxx29-llvm_version+15-julia_version+1.10.0/destdir/include -o /home/vchuravy/src/MLIR/bindings/../src/Dialects/15/DLTI.jl
#0 0x000000000053396f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x000000000053131c SignalHandler(int) Signals.cpp:0:0
#2 0x00007f6abbc37710 (/usr/lib/libc.so.6+0x3e710)
#3 0x000000000045ea9a getDialectName /workspace/srcdir/MLIR.jl/deps/tblgen/jl-generators.cc:121:50
#4 0x000000000045ea9a emitOpTableDefs(llvm::RecordKeeper const&, llvm::raw_ostream&) /workspace/srcdir/MLIR.jl/deps/tblgen/jl-generators.cc:183:39
#5 0x00000000004733ab llvm::TableGenMain(char const*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) (/tmp/jl_3aV128/x86_64-linux-gnu-libgfortran4-cxx11-libstdcxx29-llvm_version+15-julia_version+1.10.0/destdir/bin/mlir-jl-tblgen+0x4733ab)
#6 0x0000000000442cf9 main /workspace/srcdir/MLIR.jl/deps/tblgen/mlir-jl-tblgen.cc:48:104
#7 0x00007f6abbc20cd0 (/usr/lib/libc.so.6+0x27cd0)
#8 0x00007f6abbc20d8a __libc_start_main (/usr/lib/libc.so.6+0x27d8a)
#9 0x0000000000443fae _start /workspace/srcdir/glibc-2.17/csu/../sysdeps/x86_64/start.S:126:0
ERROR: LoadError: failed process: Process(`/tmp/jl_3aV128/x86_64-linux-gnu-libgfortran4-cxx11-libstdcxx29-llvm_version+15-julia_version+1.10.0/destdir/bin/mlir-jl-tblgen --generator=jl-op-defs /tmp/jl_3aV128/x86_64-linux-gnu-libgfortran4-cxx11-libstdcxx29-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Dialect/DLTI/DLTI.td -I /tmp/jl_3aV128/x86_64-linux-gnu-libgfortran4-cxx11-libstdcxx29-llvm_version+15-julia_version+1.10.0/destdir/include -o /home/vchuravy/src/MLIR/bindings/../src/Dialects/15/DLTI.jl`, ProcessSignaled(11)) [0]

platform["julia_version"] = string(julia_version)

dependencies = PkgSpec[
PkgSpec(; name="LLVM_full_jll", version=llvm_version),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@giordano I need to run this with 1.7 right?

On 1.10 I get:

vchuravy@odin ~/s/M/bindings (refactor-generation)> julia --project=. make.jl
Generating... julia version: 1.10.0, llvm version: 15.0.7
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
ERROR: LoadError: KeyError: key v"15.0.7" not found
Stacktrace:
  [1] getindex(h::Dict{K, V}, key::Any) where {K, V}
    @ Base ./dict.jl:498 [inlined]
  [2] resolve_versions!(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber, installed_only::Bool)
    @ Pkg.Operations ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:445
  [3] targeted_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
    @ Pkg.Operations ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1360
  [4] tiered_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber, try_all_installed::Bool)
    @ Pkg.Operations ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1332
  [5] _resolve(io::Base.TTY, env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
    @ Pkg.Operations ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1370
  [6] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
    @ Pkg.Operations ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1387
  [7] add
    @ ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1376 [inlined]
  [8] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::@Kwargs{io::Base.TTY})
    @ Pkg.API ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/API.jl:278
  [9] Pkg_add(::Pkg.Types.Context, ::Vararg{Any}; kwargs::@Kwargs{platform::Base.BinaryPlatforms.Platform, io::Base.TTY})
    @ BinaryBuilderBase ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:611
 [10] (::BinaryBuilderBase.var"#95#101"{Bool, Prefix, Vector{Pkg.Types.PackageSpec}, Base.BinaryPlatforms.Platform, Vector{String}, Vector{String}})()
    @ BinaryBuilderBase ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:679
 [11] activate(f::BinaryBuilderBase.var"#95#101"{Bool, Prefix, Vector{Pkg.Types.PackageSpec}, Base.BinaryPlatforms.Platform, Vector{String}, Vector{String}}, new_project::String)
    @ Pkg.API ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/Pkg/src/API.jl:1973
 [12] setup_dependencies(prefix::Prefix, dependencies::Vector{Pkg.Types.PackageSpec}, platform::Base.BinaryPlatforms.Platform; verbose::Bool)
    @ BinaryBuilderBase ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:670
 [13] setup_dependencies
    @ ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:640 [inlined]
 [14] (::var"#1#2"{VersionNumber, VersionNumber})(prefix::Prefix)
    @ Main ~/src/MLIR/bindings/make.jl:110
 [15] #66
    @ ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:46 [inlined]
 [16] mktempdir(fn::BinaryBuilderBase.var"#66#68"{var"#1#2"{VersionNumber, VersionNumber}}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:766
 [17] mktempdir
    @ Base.Filesystem ./file.jl:762 [inlined]
 [18] temp_prefix(func::var"#1#2"{VersionNumber, VersionNumber})
    @ BinaryBuilderBase ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:42
 [19] top-level scope
    @ ~/src/MLIR/bindings/make.jl:100
in expression starting at /home/vchuravy/src/MLIR/bindings/make.jl:97

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that requires Julia v1.7

@vchuravy
Copy link
Member

In particular DLTI seems to be the one to blame

@vchuravy vchuravy merged commit a989ea5 into JuliaLabs:main Jan 16, 2024
0 of 4 checks passed
@mofeing mofeing deleted the refactor-generation branch January 16, 2024 17:17
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

Successfully merging this pull request may close these issues.

3 participants