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

[CIR][OpenMP] Implementation of taskwait, taskyield and barrier #509

Closed
wants to merge 4 commits into from

Conversation

eZWALT
Copy link
Contributor

@eZWALT eZWALT commented Mar 14, 2024

This solves #499. I think this might be unnecessary, but I wasn't able to correctly compile the ClangIR project without the definitions I've added to openmp cmake as described in llvm/llvm-project#73249. Feedback is greatly appreciated!

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 9a9729e3ddb7ac6580954cc332ac032c0256b538 45e88e7323cf7ab702ed2140fa1afa4fbe17d01b -- clang/test/CIR/CodeGen/barrier.cpp clang/test/CIR/CodeGen/taskwait.cpp clang/test/CIR/CodeGen/taskyield.cpp clang/lib/CIR/CodeGen/CIRGenFunction.h clang/lib/CIR/CodeGen/CIRGenStmt.cpp clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
View the diff from clang-format here.
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index a12cd2f636..c21416daa6 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -992,9 +992,10 @@ public:
   // OpenMP gen functions:
   mlir::LogicalResult buildOMPParallelDirective(const OMPParallelDirective &S);
   mlir::LogicalResult buildOMPTaskwaitDirective(const OMPTaskwaitDirective &S);
-  mlir::LogicalResult buildOMPTaskyieldDirective(const OMPTaskyieldDirective &S);
+  mlir::LogicalResult
+  buildOMPTaskyieldDirective(const OMPTaskyieldDirective &S);
   mlir::LogicalResult buildOMPBarrierDirective(const OMPBarrierDirective &S);
-  
+
   LValue buildOpaqueValueLValue(const OpaqueValueExpr *e);
 
   /// Emit code to compute a designator that specifies the location
diff --git a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
index 7fd01b2b9f..582a782ceb 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
@@ -180,8 +180,8 @@ mlir::LogicalResult CIRGenFunction::buildStmt(const Stmt *S,
     return buildOMPTaskwaitDirective(cast<OMPTaskwaitDirective>(*S));
   case Stmt::OMPTaskyieldDirectiveClass:
     return buildOMPTaskyieldDirective(cast<OMPTaskyieldDirective>(*S));
-  case Stmt::OMPBarrierDirectiveClass: 
-    return buildOMPBarrierDirective(cast<OMPBarrierDirective>(*S)); 
+  case Stmt::OMPBarrierDirectiveClass:
+    return buildOMPBarrierDirective(cast<OMPBarrierDirective>(*S));
   // Unsupported AST nodes:
   case Stmt::CapturedStmtClass:
   case Stmt::ObjCAtTryStmtClass:
diff --git a/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp b/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
index b7044bd580..5239ae7a24 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
@@ -44,7 +44,7 @@ CIRGenFunction::buildOMPParallelDirective(const OMPParallelDirective &S) {
   return res;
 }
 
-mlir::LogicalResult 
+mlir::LogicalResult
 CIRGenFunction::buildOMPTaskwaitDirective(const OMPTaskwaitDirective &S) {
   mlir::LogicalResult res = mlir::success();
   // Getting the source location information of AST node S scope
@@ -53,10 +53,9 @@ CIRGenFunction::buildOMPTaskwaitDirective(const OMPTaskwaitDirective &S) {
   auto taskwaitOp = builder.create<mlir::omp::TaskwaitOp>(scopeLoc);
 
   return res;
-
 }
-mlir::LogicalResult 
-CIRGenFunction::buildOMPTaskyieldDirective(const OMPTaskyieldDirective &S){
+mlir::LogicalResult
+CIRGenFunction::buildOMPTaskyieldDirective(const OMPTaskyieldDirective &S) {
   mlir::LogicalResult res = mlir::success();
   // Getting the source location information of AST node S scope
   auto scopeLoc = getLoc(S.getSourceRange());
@@ -67,7 +66,7 @@ CIRGenFunction::buildOMPTaskyieldDirective(const OMPTaskyieldDirective &S){
 }
 
 mlir::LogicalResult
-CIRGenFunction::buildOMPBarrierDirective(const OMPBarrierDirective &S){
+CIRGenFunction::buildOMPBarrierDirective(const OMPBarrierDirective &S) {
   mlir::LogicalResult res = mlir::success();
   // Getting the source location information of AST node S scope
   auto scopeLoc = getLoc(S.getSourceRange());

@eZWALT eZWALT changed the title Implementation of taskwait, taskyield and barrier [CIR][OpenMP] Implementation of taskwait, taskyield and barrier Mar 14, 2024
@eZWALT eZWALT closed this Mar 14, 2024
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.

1 participant