Giter Site home page Giter Site logo

Comments (3)

Lancern avatar Lancern commented on September 23, 2024 2

The second line of the CIR error output gives the position of the error:

// For OpenMP emit declare reduction functions, if required.
if (astCtx->getLangOpts().OpenMP) {
llvm_unreachable("NYI");
}

Basically this code checks whether we have -fopenmp flag in the command line. If the flag is present, then we crash with llvm_unreachable. So if you are implementing OpenMP stuff, you will need to replace this llvm_unreachable with your implementation code.

Note that this code only gets executed when we meet a TagDecl (which represents a struct / class / enum / union) on the clang AST. The inclusing of omp.h introduces a bunch of TagDecls so you get the error once you include omp.h.

If you are not sure what to do at here, a good reference is always the original clang CodeGen module. The corresponding part in the clang CodeGen is:

if (Ctx->getLangOpts().OpenMP) {
for (Decl *Member : D->decls()) {
if (auto *DRD = dyn_cast<OMPDeclareReductionDecl>(Member)) {
if (Ctx->DeclMustBeEmitted(DRD))
Builder->EmitGlobal(DRD);
} else if (auto *DMD = dyn_cast<OMPDeclareMapperDecl>(Member)) {
if (Ctx->DeclMustBeEmitted(DMD))
Builder->EmitGlobal(DMD);
}
}
}

You can start by understanding what the original clang CodeGen is doing and port it to CIRGen accordingly.

from clangir.

bcardosolopes avatar bcardosolopes commented on September 23, 2024

Thanks for the detailed explanation @Lancern.

@eZWALT another possibility is to mock the relevant constructs out of #include <omp.h> and use them directly into your testcase, so you don't need to handle all the things not yet supported from that header. It's also possible that under clang/test/OpenMP you will find those mocked versions to copy from.

from clangir.

eZWALT avatar eZWALT commented on September 23, 2024

Great explanation @Lancern , thanks for all the time invested, after implementing the task construct I will be checking this out!

from clangir.

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.