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

Wrapper generator doesn't generate complete wrappers. #16

Open
jumerckx opened this issue Aug 5, 2023 · 6 comments
Open

Wrapper generator doesn't generate complete wrappers. #16

jumerckx opened this issue Aug 5, 2023 · 6 comments

Comments

@jumerckx
Copy link
Collaborator

jumerckx commented Aug 5, 2023

Running res/wrap.jl does not generate the wrapper for me, the output only contains the prologue. The script does however find the headers.

# [...]
┌ Info: Generating...
│   llvm_version = v"15.0.6"
└   julia_version = v"1.10.0"
   Resolving package versions...
# [...]
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/AffineMap.h
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/AffineExpr.h
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/IR.h
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Support.h
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Conversion/Passes.capi.h.inc
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Pass.h
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Dialect/Async/Passes.capi.h.inc
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Dialect/GPU/Transforms/Passes.capi.h.inc
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Dialect/Linalg/Passes.capi.h.inc
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Dialect/SparseTensor/Transforms/Passes.capi.h.inc
[ Info: Found dependent header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir/Transforms/Transforms.capi.h.inc
[ Info: Parsing headers...
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/BuiltinAttributes.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/BuiltinTypes.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Conversion.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Debug.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Diagnostics.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/Async.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/ControlFlow.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/Func.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/GPU.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/LLVM.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/Linalg.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/PDL.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/Quant.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/SCF.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/Shape.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/SparseTensor.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Dialect/Tensor.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/ExecutionEngine.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/IntegerSet.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Interfaces.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/RegisterEverything.h
[ Info: Processing header: /tmp/jl_mZV0rh/x86_64-linux-gnu-libgfortran5-cxx11-libstdcxx30-llvm_version+15-julia_version+1.10.0/destdir/include/mlir-c/Transforms.h
[ Info: Building the DAG...
[ Info: Emit Julia expressions...
[ Info: Done!
[ Info: [ProloguePrinter]: print to /home/jumerckx/clang_experiment/MLIR.jl/res/../lib/15/libMLIR_h.jl
[ Info: [GeneralPrinter]: print to /home/jumerckx/clang_experiment/MLIR.jl/res/../lib/15/libMLIR_h.jl
[ Info: [EpiloguePrinter]: print to /home/jumerckx/clang_experiment/MLIR.jl/res/../lib/15/libMLIR_h.jl
[ Info: Done!

Did the script somehow become outdated or could I possible be invoking it in a wrong way?

Thanks,
Jules

@vchuravy
Copy link
Member

vchuravy commented Aug 5, 2023

Yeah one needs to be on JuliaInterop/Clang.jl#435

@jumerckx
Copy link
Collaborator Author

jumerckx commented Aug 5, 2023

Ok great, thanks!
Do I close this issue?

@mofeing
Copy link
Collaborator

mofeing commented Jan 10, 2024

@vchuravy with JuliaInterop/Clang.jl#435 fails because...

  1. on branch vc/cxx_parse2, detect_headers doesn't have a filter argument.
  2. If we omit the filter argument, then I'm getting the following error:
ERROR: LoadError: KeyError: key Clang.LibClang.UnknownMember not found
Stacktrace:
  [1] getindex
    @ ./dict.jl:498 [inlined]
  [2] Clang.CLCursor(c::Clang.LibClang.CXCursor)
    @ Clang ~/.julia/packages/Clang/QN3so/src/cltypes.jl:33
  [3] convert
    @ ~/.julia/packages/Clang/QN3so/src/cltypes.jl:34 [inlined]
  [4] getTranslationUnitCursor
    @ ~/.julia/packages/Clang/QN3so/src/trans_unit.jl:72 [inlined]
  [5] detect_headers(include_dir::String, args::Vector{String}, options::Dict{Any, Any})
    @ Clang.Generators ~/.julia/packages/Clang/QN3so/src/generator/context.jl:272
  [6] (::var"#3#4"{VersionNumber, VersionNumber})(prefix::Prefix)
    @ Main ~/Developer/MLIR.jl/res/wrap.jl:43
  [7] #66
    @ ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:46 [inlined]
  [8] mktempdir(fn::BinaryBuilderBase.var"#66#68"{var"#3#4"{VersionNumber, VersionNumber}}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:766
  [9] mktempdir
    @ Base.Filesystem ./file.jl:762 [inlined]
 [10] temp_prefix(func::var"#3#4"{VersionNumber, VersionNumber})
    @ BinaryBuilderBase ~/.julia/packages/BinaryBuilderBase/tGUXK/src/Prefix.jl:42
 [11] top-level scope
    @ ~/Developer/MLIR.jl/res/wrap.jl:24
in expression starting at /Users/mofeing/Developer/MLIR.jl/res/wrap.jl:21

@jumerckx
Copy link
Collaborator Author

@vchuravy with JuliaInterop/Clang.jl#435 fails because...

  1. on branch vc/cxx_parse2, detect_headers doesn't have a filter argument.
  2. If we omit the filter argument, then I'm getting the following error:

If I'm not mistaken there's another branch containing the definition with filter and combining the two branches did the trick. I can check tomorrow (CET) if I still find how I got it working.

@jumerckx
Copy link
Collaborator Author

jumerckx commented Jan 11, 2024

(@mofeing)
I think the clue of what I did was:
headers = detect_headers(libmlir_header_dir, args, Dict(), s->endswith(s, "Python/Interop.h"))
This is the whole script I ran but I used a separate MLIR build so I removed a lot of things I didn't need from the original script.

@vchuravy
Copy link
Member

in #37 I checked in a fully working Manifest.toml (caveat one need Julia 1.7)

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

3 participants