Coder Social home page Coder Social logo

compiling OpenMP programs about polygeist HOT 12 OPEN

llvm avatar llvm commented on June 30, 2024
compiling OpenMP programs

from polygeist.

Comments (12)

wsmoses avatar wsmoses commented on June 30, 2024

Hi, can you paste the code that triggered the error?

from polygeist.

tipparajuv avatar tipparajuv commented on June 30, 2024

here you go:

https://github.com/simehaa/IPU/blob/89f8a3a298a09ab011157366a9cfe05a042e2988/HeatEquation3D/cpu/main.c

Thank you,
Vinod.

from polygeist.

tipparajuv avatar tipparajuv commented on June 30, 2024

I was trying to compile the program first without OpenMP. When I try to compile it with, here is the error:

vinodt@m2000host0:/localdata/vinod/Polygeist/Heat3DOpenMP$ mlir-clang -fopenmp -I../build/projects/openmp/runtime/src -I../llvm-project/clang/lib/Headers main.c
mlir-clang: ../llvm-project/llvm/include/llvm/Support/Casting.h:269: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = clang::CastExpr; Y = clang::Expr; typename llvm::cast_retty<X, Y*>::ret_type = clang::CastExpr*]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: mlir-clang -fopenmp -I ../build/projects/openmp/runtime/src -I ../llvm-project/clang/lib/Headers main.c

  1. parser at end of file
    #0 0x000055e199e8600a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /localdata/vinod/Polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:0
    #1 0x000055e199e860c1 PrintStackTraceSignalHandler(void*) /localdata/vinod/Polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:0
    #2 0x000055e199e83d75 llvm::sys::RunSignalHandlers() /localdata/vinod/Polygeist/llvm-project/llvm/lib/Support/Signals.cpp:97:0
    #3 0x000055e199e8598b SignalHandler(int) /localdata/vinod/Polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:0
    #4 0x00007fd96e3d0980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
    #5 0x00007fd96d081fb7 raise /build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
    #6 0x00007fd96d083921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
    #7 0x00007fd96d07348a __assert_fail_base /build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
    #8 0x00007fd96d073502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
    #9 0x000055e1983407f3 llvm::cast_retty<clang::CastExpr, clang::Expr*>::ret_type llvm::cast<clang::CastExpr, clang::Expr>(clang::Expr*) /localdata/vinod/Polygeist/build/../llvm-project/llvm/include/llvm/Support/Casting.h:269:0
    #10 0x000055e198389716 MLIRScanner::VisitOMPParallelForDirective(clang::OMPParallelForDirective*) /localdata/vinod/Polygeist/tools/mlir-clang/Lib/CGStmt.cc:295:0
    #11 0x000055e198317413 clang::StmtVisitorBase<std::add_pointer, MLIRScanner, ValueCategory>::Visit(clang::Stmt*) /localdata/vinod/Polygeist/build/tools/clang/include/clang/AST/StmtNodes.inc:271:0
    #12 0x000055e19838c946 MLIRScanner::VisitCompoundStmt(clang::CompoundStmt*) /localdata/vinod/Polygeist/tools/mlir-clang/Lib/CGStmt.cc:707:0
    #13 0x000055e19831712b clang::StmtVisitorBase<std::add_pointer, MLIRScanner, ValueCategory>::Visit(clang::Stmt*) /localdata/vinod/Polygeist/build/tools/clang/include/clang/AST/StmtNodes.inc:73:0
    #14 0x000055e1982ce677 MLIRScanner::MLIRScanner(MLIRASTConsumer&, mlir::FuncOp, clang::FunctionDecl const*, mlir::OwningOpRefmlir::ModuleOp&, LowerToInfo&) /localdata/vinod/Polygeist/tools/mlir-clang/Lib/clang-mlir.cc:307:0
    #15 0x000055e1982f366b MLIRASTConsumer::run() /localdata/vinod/Polygeist/tools/mlir-clang/Lib/clang-mlir.cc:5080:0
    #16 0x000055e1982f44b5 MLIRASTConsumer::HandleTopLevelDecl(clang::DeclGroupRef) /localdata/vinod/Polygeist/tools/mlir-clang/Lib/clang-mlir.cc:5232:0
    #17 0x000055e19ea49126 clang::ParseAST(clang::Sema&, bool, bool) /localdata/vinod/Polygeist/llvm-project/clang/lib/Parse/ParseAST.cpp:162:0
    #18 0x000055e19ba1c76d clang::ASTFrontendAction::ExecuteAction() /localdata/vinod/Polygeist/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1074:0
    #19 0x000055e19ba1c036 clang::FrontendAction::Execute() /localdata/vinod/Polygeist/llvm-project/clang/lib/Frontend/FrontendAction.cpp:971:0
    #20 0x000055e1982f9353 parseMLIR(char const*, std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, mlir::OwningOpRefmlir::ModuleOp&, llvm::Triple&, llvm::DataLayout&) /localdata/vinod/Polygeist/tools/mlir-clang/Lib/clang-mlir.cc:5900:0
    #21 0x000055e1982fa351 main /localdata/vinod/Polygeist/tools/mlir-clang/mlir-clang.cc:404:0
    #22 0x00007fd96d064bf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
    #23 0x000055e1982cbb4a _start (/localdata/vinod/Polygeist/build/bin/mlir-clang+0x858b4a)
    Aborted (core dumped)

from polygeist.

wsmoses avatar wsmoses commented on June 30, 2024

Without openmp this should build on main. With OpenMP does indeed still trigger issues, will look into.

from polygeist.

tipparajuv avatar tipparajuv commented on June 30, 2024

Thanks. Could you please share how you are building it without OpenMP?

It will be very useful if it were building with OpenMP :-)

from polygeist.

wsmoses avatar wsmoses commented on June 30, 2024

Oh a large suite of fixes just landed to main, one of which fixed the issue you saw. But as for command line:

./bin/mlir-clang -resource-dir /home/wmoses/git/Polygeist/mlir-build/lib/clang/14.0.0 -o a.exe heat.c -O3

from polygeist.

tipparajuv avatar tipparajuv commented on June 30, 2024

Thanks. Should the OpenMP version be building error-free with the fixes that landed?

from polygeist.

wsmoses avatar wsmoses commented on June 30, 2024

Not yet, but I've added support for the requisite OMP single and related in a current PR which should enable that code to run.

from polygeist.

tipparajuv avatar tipparajuv commented on June 30, 2024

thanks. I look forward to your PR being merged and trying it out.

from polygeist.

wsmoses avatar wsmoses commented on June 30, 2024

Try now on the latest main.

from polygeist.

tipparajuv avatar tipparajuv commented on June 30, 2024

It works, thank you.

Is polymer not being used anymore?

from polygeist.

wsmoses avatar wsmoses commented on June 30, 2024

Polymer is/can still be used, but it'll be a bit before it can be used on this as the polymer codebase will need to update to the latest llvm & Polygeist commits.

We also need to add scf.parallel raising to affine.parallel for it to work in this case (and probably polymer should take in affine.parallel).

cc @kumasento @ftynse

from polygeist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.