Skip to content

[OpenMP] OpenMP 5.1 "assume" directive parsing support #92731

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

Merged
merged 8 commits into from
Aug 5, 2024

Conversation

jtb20
Copy link
Contributor

@jtb20 jtb20 commented May 20, 2024

This is a minimal patch to support parsing for "omp assume" directives. These are meant to be hints to a compiler's optimisers: as such, it is legitimate (if not very useful) to ignore them. The patch builds on top of the existing support for "omp assumes" directives (note spelling!).

Unlike the "omp [begin/end] assumes" directives, "omp assume" is associated with a compound statement, i.e. it can appear within a function. The "holds" assumption could (theoretically) be mapped onto the existing builtin "__builtin_assume", though the latter applies to a single point in the program, and the former to a range (i.e. the whole of the associated compound statement).

This patch fixes sollve's OpenMP 5.1 "omp assume"-based tests.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" flang:openmp clang:openmp OpenMP related changes to Clang labels May 20, 2024
@llvmbot
Copy link
Member

llvmbot commented May 20, 2024

@llvm/pr-subscribers-clang-modules
@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-clang

Author: None (jtb20)

Changes

This is a minimal patch to support parsing for "omp assume" directives. These are meant to be hints to a compiler's optimisers: as such, it is legitimate (if not very useful) to ignore them. The patch builds on top of the existing support for "omp assumes" directives (note spelling!).

Unlike the "omp [begin/end] assumes" directives, "omp assume" is associated with a compound statement, i.e. it can appear within a function. The "holds" assumption could (theoretically) be mapped onto the existing builtin "__builtin_assume", though the latter applies to a single point in the program, and the former to a range (i.e. the whole of the associated compound statement).

This patch fixes sollve's OpenMP 5.1 "omp assume"-based tests.


Full diff: https://github.com/llvm/llvm-project/pull/92731.diff

7 Files Affected:

  • (modified) clang/lib/Parse/ParseOpenMP.cpp (+22)
  • (modified) clang/lib/Sema/SemaOpenMP.cpp (+2-1)
  • (added) clang/test/OpenMP/assume_lambda.cpp (+31)
  • (added) clang/test/OpenMP/assume_messages.c (+23)
  • (added) clang/test/OpenMP/assume_messages_attr.c (+23)
  • (added) clang/test/OpenMP/assume_template.cpp (+42)
  • (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+3)
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index e959dd6378f46..5c1bb58227fde 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2450,6 +2450,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
   case OMPD_target_teams_loop:
   case OMPD_parallel_loop:
   case OMPD_target_parallel_loop:
+  case OMPD_assume:
     Diag(Tok, diag::err_omp_unexpected_directive)
         << 1 << getOpenMPDirectiveName(DKind);
     break;
@@ -3035,6 +3036,27 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
         << 1 << getOpenMPDirectiveName(DKind);
     SkipUntil(tok::annot_pragma_openmp_end);
     break;
+  case OMPD_assume: {
+    ParseScope OMPDirectiveScope(this, Scope::FnScope | Scope::DeclScope |
+                                 Scope::CompoundStmtScope);
+    ParseOpenMPAssumesDirective(DKind, ConsumeToken());
+
+    SkipUntil(tok::annot_pragma_openmp_end);
+
+    ParsingOpenMPDirectiveRAII NormalScope(*this);
+    StmtResult AssociatedStmt;
+    {
+      Sema::CompoundScopeRAII Scope(Actions);
+      AssociatedStmt = ParseStatement();
+      EndLoc = Tok.getLocation();
+      Directive = Actions.ActOnCompoundStmt(Loc, EndLoc,
+                                            AssociatedStmt.get(),
+                                            /*isStmtExpr=*/false);
+    }
+    ParseOpenMPEndAssumesDirective(Loc);
+    OMPDirectiveScope.Exit();
+    break;
+  }
   case OMPD_unknown:
   default:
     Diag(Tok, diag::err_omp_unknown_directive);
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 6110e5229b076..9ec2bd9c3b802 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -3511,7 +3511,8 @@ void SemaOpenMP::ActOnOpenMPAssumesDirective(SourceLocation Loc,
 
   auto *AA =
       OMPAssumeAttr::Create(getASTContext(), llvm::join(Assumptions, ","), Loc);
-  if (DKind == llvm::omp::Directive::OMPD_begin_assumes) {
+  if (DKind == llvm::omp::Directive::OMPD_begin_assumes ||
+      DKind == llvm::omp::Directive::OMPD_assume) {
     OMPAssumeScoped.push_back(AA);
     return;
   }
diff --git a/clang/test/OpenMP/assume_lambda.cpp b/clang/test/OpenMP/assume_lambda.cpp
new file mode 100644
index 0000000000000..a38380ed4482a
--- /dev/null
+++ b/clang/test/OpenMP/assume_lambda.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -ast-print %s | FileCheck %s
+// expected-no-diagnostics
+
+extern int bar(int);
+
+int foo(int arg)
+{
+  #pragma omp assume no_openmp_routines
+  {
+    auto fn = [](int x) { return bar(x); };
+// CHECK: auto fn = [](int x) {
+    return fn(5);
+  }
+}
+
+class C {
+public:
+  int foo(int a);
+};
+
+// We're really just checking that this parses.  All the assumptions are thrown
+// away immediately for now.
+int C::foo(int a)
+{
+  #pragma omp assume holds(sizeof(T) == 8) absent(parallel)
+  {
+    auto fn = [](int x) { return bar(x); };
+// CHECK: auto fn = [](int x) {
+    return fn(5);
+  }
+}
\ No newline at end of file
diff --git a/clang/test/OpenMP/assume_messages.c b/clang/test/OpenMP/assume_messages.c
new file mode 100644
index 0000000000000..33c1c6f7c51e7
--- /dev/null
+++ b/clang/test/OpenMP/assume_messages.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -verify -fopenmp -x c -std=c99 %s
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -verify -fopenmp-simd -x c -std=c99 %s
+
+#pragma omp assume no_openmp // expected-error {{unexpected OpenMP directive '#pragma omp assume'}}
+
+void foo(void) {
+  #pragma omp assume hold(1==1) // expected-warning {{valid assume clauses start with 'ext_', 'absent', 'contains', 'holds', 'no_openmp', 'no_openmp_routines', 'no_parallelism'; tokens will be ignored}} expected-note {{the ignored tokens spans until here}}
+  {}
+}
+
+void bar(void) {
+  #pragma omp assume absent(target)
+} // expected-error {{expected statement}}
+
+void qux(void) {
+  #pragma omp assume extra_bits // expected-warning {{valid assume clauses start with 'ext_', 'absent', 'contains', 'holds', 'no_openmp', 'no_openmp_routines', 'no_parallelism'; token will be ignored}}
+  {}
+}
+
+void quux(void) {
+  #pragma omp assume ext_spelled_properly
+  {}
+}
diff --git a/clang/test/OpenMP/assume_messages_attr.c b/clang/test/OpenMP/assume_messages_attr.c
new file mode 100644
index 0000000000000..47504cc6308ea
--- /dev/null
+++ b/clang/test/OpenMP/assume_messages_attr.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -verify -fopenmp -x c -std=c99 %s
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -verify -fopenmp-simd -x c -std=c99 %s
+
+[[omp::directive(assume no_openmp)]] // expected-error {{unexpected OpenMP directive '#pragma omp assume'}}
+
+void foo(void) {
+  [[omp::directive(assume hold(1==1))]] // expected-warning {{valid assume clauses start with 'ext_', 'absent', 'contains', 'holds', 'no_openmp', 'no_openmp_routines', 'no_parallelism'; tokens will be ignored}} expected-note {{the ignored tokens spans until here}}
+  {}
+}
+
+void bar(void) {
+  [[omp::directive(assume absent(target))]]
+} // expected-error {{expected statement}}
+
+void qux(void) {
+  [[omp::directive(assume extra_bits)]] // expected-warning {{valid assume clauses start with 'ext_', 'absent', 'contains', 'holds', 'no_openmp', 'no_openmp_routines', 'no_parallelism'; token will be ignored}}
+  {}
+}
+
+void quux(void) {
+  [[omp::directive(assume ext_spelled_properly)]]
+  {}
+}
diff --git a/clang/test/OpenMP/assume_template.cpp b/clang/test/OpenMP/assume_template.cpp
new file mode 100644
index 0000000000000..b0591bffb20a6
--- /dev/null
+++ b/clang/test/OpenMP/assume_template.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+extern int qux(int);
+
+template<typename T>
+int foo(T arg)
+{
+  #pragma omp assume no_openmp_routines
+  {
+    auto fn = [](int x) { return qux(x); };
+// CHECK: auto fn = [](int x) {
+    return fn(5);
+  }
+}
+
+template<typename T>
+class C {
+  T m;
+
+public:
+  T bar(T a);
+};
+
+// We're really just checking this parses.  All the assumptions are thrown
+// away immediately for now.
+template<typename T>
+T C<T>::bar(T a)
+{
+  #pragma omp assume holds(sizeof(T) == 8) absent(parallel)
+  {
+    return (T)qux((int)a);
+// CHECK: return (T)qux((int)a);
+  }
+}
+
+#endif
\ No newline at end of file
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index e91169e8da1aa..3660917e3e176 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -2089,6 +2089,9 @@ def OMP_Scan : Directive<"scan"> {
   ];
   let association = AS_Separating;
 }
+def OMP_Assume : Directive<"assume"> {
+  let association = AS_Block;
+}
 def OMP_Assumes : Directive<"assumes"> {
   let association = AS_None;
 }

@jtb20
Copy link
Contributor Author

jtb20 commented May 20, 2024

Adding @jdoerfert as potential reviewer

@jtb20 jtb20 force-pushed the main branch 2 times, most recently from c06ce37 to 49870fb Compare June 19, 2024 16:07
@llvmbot llvmbot added clang:codegen IR generation bugs: mangling, exceptions, etc. llvm:transforms labels Jun 19, 2024
@jtb20
Copy link
Contributor Author

jtb20 commented Jun 19, 2024

Ping?

Copy link
Contributor

@shiltian shiltian left a comment

Choose a reason for hiding this comment

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

don't you need more code in AST?

// CHECK: auto fn = [](int x) {
return fn(5);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

empty line EoF

Copy link
Contributor Author

@jtb20 jtb20 Jun 21, 2024

Choose a reason for hiding this comment

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

Ugh, a bad habit of that editor. I guess I should try to figure out a way of stopping it doing that automatically... (thanks!)

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, we need an empty line at the end of file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood! There is indeed a vscode option to add the missing newline (it appears to be turned off by default for some bizarre reason). I'll push a new version with them in.

}
}

#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@jtb20 jtb20 force-pushed the main branch 2 times, most recently from 822249a to edbcd82 Compare June 21, 2024 14:58
@jtb20
Copy link
Contributor Author

jtb20 commented Jun 21, 2024

don't you need more code in AST?

Sorry, I don't quite understand the question! Could you elaborate a little please?

@shiltian
Copy link
Contributor

don't you need more code in AST?

Sorry, I don't quite understand the question! Could you elaborate a little please?

I was thinking maybe you need changes in AST related files, like ASTWriter.cpp, but that might be not needed as this is adding a new directive.

@jtb20
Copy link
Contributor Author

jtb20 commented Jun 27, 2024

don't you need more code in AST?

Sorry, I don't quite understand the question! Could you elaborate a little please?

I was thinking maybe you need changes in AST related files, like ASTWriter.cpp, but that might be not needed as this is adding a new directive.

At the moment, since the "assume" directive is parsed but then immediately discarded, I don't think anything else is needed.

Actually the existing "assumes" support is reused -- the bit in SemaOpenMP.cpp adds the "assume" assumptions to the OMPAssumeScoped "stack". For "assumes", it's done like that so (e.g. top-level) declarations between begin/end "assumes" can be modified according to the assumptions on that stack. For "assume", once some use is made for the assumptions, that might turn out to not be the most useful representation. That can be revisited later though, I think.

@alexey-bataev
Copy link
Member

don't you need more code in AST?

Sorry, I don't quite understand the question! Could you elaborate a little please?

I was thinking maybe you need changes in AST related files, like ASTWriter.cpp, but that might be not needed as this is adding a new directive.

At the moment, since the "assume" directive is parsed but then immediately discarded, I don't think anything else is needed.

Actually the existing "assumes" support is reused -- the bit in SemaOpenMP.cpp adds the "assume" assumptions to the OMPAssumeScoped "stack". For "assumes", it's done like that so (e.g. top-level) declarations between begin/end "assumes" can be modified according to the assumptions on that stack. For "assume", once some use is made for the assumptions, that might turn out to not be the most useful representation. That can be revisited later though, I think.

don't you need more code in AST?

Sorry, I don't quite understand the question! Could you elaborate a little please?

I was thinking maybe you need changes in AST related files, like ASTWriter.cpp, but that might be not needed as this is adding a new directive.

At the moment, since the "assume" directive is parsed but then immediately discarded, I don't think anything else is needed.

Actually the existing "assumes" support is reused -- the bit in SemaOpenMP.cpp adds the "assume" assumptions to the OMPAssumeScoped "stack". For "assumes", it's done like that so (e.g. top-level) declarations between begin/end "assumes" can be modified according to the assumptions on that stack. For "assume", once some use is made for the assumptions, that might turn out to not be the most useful representation. That can be revisited later though, I think.

Even so, it should support serialization/deserialization and have the tests for it (like ast-dump and ast-print).

@llvmbot llvmbot added the clang:modules C++20 modules and Clang Header Modules label Jul 19, 2024
Copy link

github-actions bot commented Jul 19, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@jtb20
Copy link
Contributor Author

jtb20 commented Aug 1, 2024

The compiler builds for each intermediate step, but the result isn't necessarily useful until the 'omp assume' patch.

Copy link
Member

@alexey-bataev alexey-bataev left a comment

Choose a reason for hiding this comment

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

Need a test with the nesting of the directives


// It's not really an executable directive, but it seems convenient to use
// that as the parent class.
class OMPAssumeDirective : public OMPExecutableDirective {
Copy link
Member

Choose a reason for hiding this comment

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

class OMPAssumeDirective final : public OMPExecutableDirective

@@ -377,6 +377,8 @@ bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
/// otherwise - false.
bool isOpenMPExecutableDirective(OpenMPDirectiveKind DKind);

bool isOpenMPInformationalDirective(OpenMPDirectiveKind DKind);
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment for the function

Copy link
Member

@alexey-bataev alexey-bataev left a comment

Choose a reason for hiding this comment

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

Add the notest to OpenMPSupport.rst and release notes

@@ -3532,6 +3532,10 @@ class Parser : public CodeCompletionHandler {
OpenMPDirectiveKind DKind, SourceLocation Loc,
bool ReadDirectiveWithinMetadirective);

StmtResult ParseOpenMPInformationalDirective(
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment for the function

@@ -399,6 +399,14 @@ class SemaOpenMP : public SemaBase {
OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
StmtResult ActOnOpenMPInformationalDirective(
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment for the function

OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
SourceLocation EndLoc);
StmtResult ActOnOpenMPAssumeDirective(ArrayRef<OMPClause *> Clauses,
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment for the function

Comment on lines 9223 to 9224
for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
I != E; ++I) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
I != E; ++I) {
for (OMPClause *C : Clauses) {

Comment on lines 9244 to 9247
if (D->getDirectiveKind() == OMPD_assume)
CS = D->getAssociatedStmt();
else
llvm_unreachable("Unexpected informational directive");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (D->getDirectiveKind() == OMPD_assume)
CS = D->getAssociatedStmt();
else
llvm_unreachable("Unexpected informational directive");
assert(D->getDirectiveKind() == OMPD_assume && "Unexpected informational directive");
CS = D->getAssociatedStmt();

Comment on lines 9252 to 9254
if (AssociatedStmt.isInvalid()) {
return StmtError();
}
Copy link
Member

Choose a reason for hiding this comment

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

Drop extra braces

Comment on lines 9256 to 9258
if (TClauses.size() != Clauses.size()) {
return StmtError();
}
Copy link
Member

Choose a reason for hiding this comment

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

Drop extra braces

jtb20 added 8 commits August 2, 2024 14:41
This patch supports parsing of "omp assume" directives.  These are meant
to be hints to a compiler's optimisers: as such, it is legitimate
(if not very useful) to ignore them.  This version of the patch
implements new AST nodes for the "assume" directive and the various
clauses it accepts as arguments, and adds new (C++ module) tests for
serialization/deserialization of said nodes.

The patch now uses tail allocation for the directive kind list.

Unlike the "omp [begin/end] assumes" directives, "omp assume" is
associated with a compound statement, i.e. it can appear within a
function.  The "holds" assumption could (theoretically) be mapped
onto the existing builtin "__builtin_assume", though the latter applies
to a single point in the program, and the former to a range (i.e. the
whole of the associated compound statement).

The "assume" directive appears to be distinct from the [[omp::assume]]
annotation.

This patch fixes sollve's OpenMP 5.1 "omp assume"-based tests.
Copy link
Member

@alexey-bataev alexey-bataev left a comment

Choose a reason for hiding this comment

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

LG

@jtb20
Copy link
Contributor Author

jtb20 commented Aug 2, 2024

Thank you for the review! Again, I do not have commit access, so please apply for me if possible.

Julian

@alexey-bataev alexey-bataev merged commit a42e515 into llvm:main Aug 5, 2024
7 of 10 checks passed
Copy link

github-actions bot commented Aug 5, 2024

@jtb20 Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested
by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself.
This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@jdoerfert
Copy link
Member

This broke the Flang build. You need to add some Flang code for all changes in omp.td. Look for a similar clause in the flang subproject to see what to do, and verify by building Flang. Maybe revert for now until fixed.

@jtb20
Copy link
Contributor Author

jtb20 commented Aug 5, 2024

Hopefully fixed by: #102008

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 6, 2024

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building clang,llvm at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/4246

Here is the relevant piece of the build log for the reference:

Step 5 (build-unified-tree) failure: build (failure)
...
167.266 [233/81/6175] Building CXX object tools/mlir/lib/Dialect/OpenMP/CMakeFiles/obj.MLIROpenMPDialect.dir/IR/OpenMPDialect.cpp.o
167.286 [232/81/6176] Linking CXX static library lib/libMLIROpenMPDialect.a
167.303 [228/84/6177] Linking CXX static library lib/libMLIROpenMPToLLVM.a
167.303 [228/83/6178] Linking CXX static library lib/libMLIRSCFToOpenMP.a
167.303 [228/82/6179] Linking CXX static library lib/libMLIROpenMPToLLVMIRTranslation.a
167.304 [227/82/6180] Linking CXX static library lib/libMLIRCAPIOpenMP.a
167.319 [227/81/6181] Linking CXX static library lib/libMLIRToLLVMIRTranslationRegistration.a
167.334 [226/81/6182] Linking CXX static library lib/libMLIRCAPITarget.a
168.191 [226/80/6183] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics.cpp.o
168.206 [226/79/6184] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o
FAILED: tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o 
ccache /home/buildbots/llvm-external-buildbots/clang.16.0.1/bin/clang++ -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/lib/Lower -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/../mlir/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/mlir/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/clang/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/../clang/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o -MF tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o.d -o tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:1217:45: error: no matching function for call to 'make'
        return makeClause(getClauseId(cls), clause::make(s, semaCtx),
                                            ^~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/include/flang/Common/visit.h:72:54: note: in instantiation of function template specialization 'Fortran::lower::omp::makeClause(const parser::OmpClause &, semantics::SemanticsContext &)::(anonymous class)::operator()<const Fortran::parser::OmpClause::Absent &>' requested here
visit(VISITOR &&visitor, VARIANT &&...u) -> decltype(visitor(std::get<0>(
                                                     ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:1215:10: note: while substituting deduced template arguments into function template 'visit' [with VISITOR = (lambda at /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:1216:7), VARIANT = <const std::variant<Absent, AcqRel, Acquire, AdjustArgs, Affinity, Align, Aligned, Allocate, Allocator, AppendArgs, At, AtomicDefaultMemOrder, Bind, CancellationConstructType, Capture, Collapse, Compare, Contains, Copyprivate, Copyin, Default, Defaultmap, Depend, Depobj, Destroy, Detach, Device, DeviceType, DistSchedule, Doacross, DynamicAllocators, Enter, Exclusive, Fail, Filter, Final, Firstprivate, Flush, From, Full, Grainsize, HasDeviceAddr, Hint, Holds, If, InReduction, Inbranch, Inclusive, Indirect, Init, IsDevicePtr, Lastprivate, Linear, Link, Map, Match, MemoryOrder, Mergeable, Message, Nogroup, NoOpenmp, NoOpenmpRoutines, NoParallelism, Nowait, Nocontext, Nontemporal, Notinbranch, Novariants, NumTasks, NumTeams, NumThreads, OmpxAttribute, OmpxBare, OmpxDynCgroupMem, Order, Ordered, Partial, Priority, Private, ProcBind, Read, Reduction, Relaxed, Release, ReverseOffload, Safelen, Schedule, SeqCst, Severity, Shared, Simd, Simdlen, Sizes, TaskReduction, ThreadLimit, Threadprivate, Threads, To, UnifiedAddress, UnifiedSharedMemory, Uniform, Unknown, Untied, Update, Use, UseDeviceAddr, UseDevicePtr, UsesAllocators, Weak, When, Write> &>]
  return Fortran::common::visit(
         ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:212:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::AcqRel' for 1st argument
MAKE_EMPTY_CLASS(AcqRel, AcqRel);
^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:213:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::Acquire' for 1st argument
MAKE_EMPTY_CLASS(Acquire, Acquire);
^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:214:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::Capture' for 1st argument
MAKE_EMPTY_CLASS(Capture, Capture);
^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:215:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::Compare' for 1st argument
MAKE_EMPTY_CLASS(Compare, Compare);
^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:216:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::DynamicAllocators' for 1st argument
MAKE_EMPTY_CLASS(DynamicAllocators, DynamicAllocators);
^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'

@clementval
Copy link
Contributor

This is still breaking a buildbot. https://lab.llvm.org/buildbot/#/builders/157/builds/4246

Are you working on a fix?

@jtb20
Copy link
Contributor Author

jtb20 commented Aug 6, 2024 via email

@clementval
Copy link
Contributor

Yeah it was probably the case. It's green now.

@jtb20
Copy link
Contributor Author

jtb20 commented Aug 6, 2024

Thank you for the update!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 6, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building clang,llvm at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/5113

Here is the relevant piece of the build log for the reference:

Step 6 (build-unified-tree) failure: build (failure)
...
395.892 [3013/58/1508] Creating library symlink lib/libclang.so.20.0git lib/libclang.so
397.312 [3012/58/1509] Linking CXX executable bin/c-index-test
397.542 [3011/58/1510] Linking CXX executable bin/c-arcmt-test
402.259 [3010/58/1511] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/instrumented-parser.cpp.o
402.573 [3009/58/1512] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/parse-tree.cpp.o
404.440 [3008/58/1513] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/user-state.cpp.o
409.331 [3007/58/1514] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/expr-parsers.cpp.o
416.202 [3006/58/1515] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Coarray.cpp.o
419.544 [3005/58/1516] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/io-parsers.cpp.o
421.742 [3004/58/1517] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o
FAILED: tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DBUILD_EXAMPLES -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/build/buildbot/premerge-monolithic-linux/build/tools/flang/lib/Lower -I/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower -I/build/buildbot/premerge-monolithic-linux/llvm-project/flang/include -I/build/buildbot/premerge-monolithic-linux/build/tools/flang/include -I/build/buildbot/premerge-monolithic-linux/build/include -I/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include -isystem /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../mlir/include -isystem /build/buildbot/premerge-monolithic-linux/build/tools/mlir/include -isystem /build/buildbot/premerge-monolithic-linux/build/tools/clang/include -isystem /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o -MF tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o.d -o tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Clauses.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:1217:45: error: no matching function for call to 'make'
        return makeClause(getClauseId(cls), clause::make(s, semaCtx),
                                            ^~~~~~~~~~~~
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/include/flang/Common/visit.h:72:54: note: in instantiation of function template specialization 'Fortran::lower::omp::makeClause(const parser::OmpClause &, semantics::SemanticsContext &)::(anonymous class)::operator()<const Fortran::parser::OmpClause::Absent &>' requested here
visit(VISITOR &&visitor, VARIANT &&...u) -> decltype(visitor(std::get<0>(
                                                     ^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:1215:10: note: while substituting deduced template arguments into function template 'visit' [with VISITOR = (lambda at /build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:1216:7), VARIANT = <const std::variant<Absent, AcqRel, Acquire, AdjustArgs, Affinity, Align, Aligned, Allocate, Allocator, AppendArgs, At, AtomicDefaultMemOrder, Bind, CancellationConstructType, Capture, Collapse, Compare, Contains, Copyprivate, Copyin, Default, Defaultmap, Depend, Depobj, Destroy, Detach, Device, DeviceType, DistSchedule, Doacross, DynamicAllocators, Enter, Exclusive, Fail, Filter, Final, Firstprivate, Flush, From, Full, Grainsize, HasDeviceAddr, Hint, Holds, If, InReduction, Inbranch, Inclusive, Indirect, Init, IsDevicePtr, Lastprivate, Linear, Link, Map, Match, MemoryOrder, Mergeable, Message, Nogroup, NoOpenmp, NoOpenmpRoutines, NoParallelism, Nowait, Nocontext, Nontemporal, Notinbranch, Novariants, NumTasks, NumTeams, NumThreads, OmpxAttribute, OmpxBare, OmpxDynCgroupMem, Order, Ordered, Partial, Priority, Private, ProcBind, Read, Reduction, Relaxed, Release, ReverseOffload, Safelen, Schedule, SeqCst, Severity, Shared, Simd, Simdlen, Sizes, TaskReduction, ThreadLimit, Threadprivate, Threads, To, UnifiedAddress, UnifiedSharedMemory, Uniform, Unknown, Untied, Update, Use, UseDeviceAddr, UseDevicePtr, UsesAllocators, Weak, When, Write> &>]
  return Fortran::common::visit(
         ^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:212:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::AcqRel' for 1st argument
MAKE_EMPTY_CLASS(AcqRel, AcqRel);
^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:213:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::Acquire' for 1st argument
MAKE_EMPTY_CLASS(Acquire, Acquire);
^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:214:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::Capture' for 1st argument
MAKE_EMPTY_CLASS(Capture, Capture);
^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:215:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::Compare' for 1st argument
MAKE_EMPTY_CLASS(Compare, Compare);
^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'
  cls make(const parser::OmpClause::from_cls &,                                \
      ^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:216:1: note: candidate function not viable: no known conversion from 'const Fortran::parser::OmpClause::Absent' to 'const parser::OmpClause::DynamicAllocators' for 1st argument
MAKE_EMPTY_CLASS(DynamicAllocators, DynamicAllocators);
^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:193:7: note: expanded from macro 'MAKE_EMPTY_CLASS'

@@ -510,6 +528,18 @@ def OMP_EndAssumes : Directive<"end assumes"> {
let association = AS_Delimited;
let category = OMP_Assumes.category;
}
def OMP_Assume : Directive<"assume"> {
let association = AS_Block;

Choose a reason for hiding this comment

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

why need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand the question. Do you think the .td fragment is unnecessary for adding support for the "omp assume" directive? There is no comment here, but that follows the general trend in that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category flang:openmp llvm:transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants