Skip to content

[flang][OpenMP] Add parsing support for Task detach #112312

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 1 commit into from
Nov 4, 2024

Conversation

NimishMishra
Copy link
Contributor

Add parsing support for task detach, along with parse/unparse tests.

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:openmp flang:parser clang:openmp OpenMP related changes to Clang labels Oct 15, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2024

@llvm/pr-subscribers-flang-fir-hlfir

@llvm/pr-subscribers-flang-parser

Author: None (NimishMishra)

Changes

Add parsing support for task detach, along with parse/unparse tests.


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

6 Files Affected:

  • (modified) flang/include/flang/Parser/dump-parse-tree.h (+1)
  • (modified) flang/include/flang/Parser/parse-tree.h (+6)
  • (modified) flang/lib/Parser/openmp-parsers.cpp (+7-1)
  • (modified) flang/lib/Parser/unparse.cpp (+3)
  • (added) flang/test/Parser/OpenMP/task.f90 (+16)
  • (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+1)
diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index 5d243b4e5d3e9a..f21eae3b92d5bd 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -507,6 +507,7 @@ class ParseTreeDumper {
   NODE_ENUM(OmpDefaultmapClause, ImplicitBehavior)
   NODE_ENUM(OmpDefaultmapClause, VariableCategory)
   NODE(parser, OmpDependClause)
+  NODE(parser, OmpDetachClause)
   NODE(OmpDependClause, InOut)
   NODE(OmpDependClause, Sink)
   NODE(OmpDependClause, Source)
diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 21b4a344dbc438..484aaf50e223f0 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3515,6 +3515,12 @@ struct OmpIfClause {
   std::tuple<std::optional<DirectiveNameModifier>, ScalarLogicalExpr> t;
 };
 
+// OpenMPv5.2 12.5.2 detach-clause -> DETACH (event-handle)
+struct OmpDetachClause {
+  WRAPPER_CLASS_BOILERPLATE(OmpDetachClause, OmpObject);
+  CharBlock source;
+};
+
 // 2.8.1 aligned-clause -> ALIGNED (variable-name-list[ : scalar-constant])
 struct OmpAlignedClause {
   TUPLE_CLASS_BOILERPLATE(OmpAlignedClause);
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 8634c522cf343a..2a67f87128588f 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -215,7 +215,7 @@ TYPE_PARSER(construct<OmpIfClause>(
         ":"),
     scalarLogicalExpr))
 
-// 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
+// OpenMPv5.2 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
 TYPE_PARSER(construct<OmpReductionOperator>(Parser<DefinedOperator>{}) ||
     construct<OmpReductionOperator>(Parser<ProcedureDesignator>{}))
 
@@ -298,6 +298,10 @@ TYPE_CONTEXT_PARSER("Omp LINEAR clause"_en_US,
         construct<OmpLinearClause>(construct<OmpLinearClause::WithoutModifier>(
             nonemptyList(name), maybe(":" >> scalarIntConstantExpr)))))
 
+// 12.5.2 detach-clause -> DETACH (event-handle)
+TYPE_PARSER(construct<OmpDetachClause>(
+	Parser<OmpObject>{}))
+
 // 2.8.1 ALIGNED (list: alignment)
 TYPE_PARSER(construct<OmpAlignedClause>(
     Parser<OmpObjectList>{}, maybe(":" >> scalarIntConstantExpr)))
@@ -414,6 +418,8 @@ TYPE_PARSER(
                        parenthesized(Parser<OmpReductionClause>{}))) ||
     "IN_REDUCTION" >> construct<OmpClause>(construct<OmpClause::InReduction>(
                           parenthesized(Parser<OmpInReductionClause>{}))) ||
+    "DETACH" >> construct<OmpClause>(construct<OmpClause::Detach>(
+		    	  parenthesized(Parser<OmpDetachClause>{}))) ||
     "TASK_REDUCTION" >>
         construct<OmpClause>(construct<OmpClause::TaskReduction>(
             parenthesized(Parser<OmpReductionClause>{}))) ||
diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index d1011fe58a0264..bb8ec168ced2d5 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -2131,6 +2131,9 @@ class UnparseVisitor {
     Put(":");
     Walk(std::get<OmpObjectList>(x.t));
   }
+  void Unparse(const OmpDetachClause &x){
+    Walk(x.v);
+  }
   void Unparse(const OmpInReductionClause &x) {
     Walk(std::get<OmpReductionOperator>(x.t));
     Put(":");
diff --git a/flang/test/Parser/OpenMP/task.f90 b/flang/test/Parser/OpenMP/task.f90
new file mode 100644
index 00000000000000..dbeb6e51b345b1
--- /dev/null
+++ b/flang/test/Parser/OpenMP/task.f90
@@ -0,0 +1,16 @@
+! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50  %s | FileCheck --ignore-case %s
+! RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=50  %s | FileCheck --ignore-case --check-prefix="CHECK-UNPARSE" %s
+
+!CHECK: OmpBlockDirective -> llvm::omp::Directive = task
+!CHECK: OmpClauseList -> OmpClause -> Detach -> OmpDetachClause -> OmpObject -> Designator -> DataRef -> Name = 'event'
+
+!CHECK-UNPARSE: INTEGER(KIND=8_4) event
+!CHECK-UNPARSE: !$OMP TASK  DETACH(event)
+!CHECK-UNPARSE: !$OMP END TASK
+subroutine task_detach
+  use omp_lib
+  implicit none
+  integer(kind=omp_event_handle_kind) :: event
+  !$omp task detach(event)
+  !$omp end task
+end subroutine
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index f2f09812a86905..6ed224f0857a9b 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -132,6 +132,7 @@ def OMPC_Destroy : Clause<"destroy"> {
 }
 def OMPC_Detach : Clause<"detach"> {
   let clangClass = "OMPDetachClause";
+  let flangClass = "OmpDetachClause";
 }
 def OMPC_Device : Clause<"device"> {
   let clangClass = "OMPDeviceClause";

@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2024

@llvm/pr-subscribers-flang-openmp

Author: None (NimishMishra)

Changes

Add parsing support for task detach, along with parse/unparse tests.


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

6 Files Affected:

  • (modified) flang/include/flang/Parser/dump-parse-tree.h (+1)
  • (modified) flang/include/flang/Parser/parse-tree.h (+6)
  • (modified) flang/lib/Parser/openmp-parsers.cpp (+7-1)
  • (modified) flang/lib/Parser/unparse.cpp (+3)
  • (added) flang/test/Parser/OpenMP/task.f90 (+16)
  • (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+1)
diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index 5d243b4e5d3e9a..f21eae3b92d5bd 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -507,6 +507,7 @@ class ParseTreeDumper {
   NODE_ENUM(OmpDefaultmapClause, ImplicitBehavior)
   NODE_ENUM(OmpDefaultmapClause, VariableCategory)
   NODE(parser, OmpDependClause)
+  NODE(parser, OmpDetachClause)
   NODE(OmpDependClause, InOut)
   NODE(OmpDependClause, Sink)
   NODE(OmpDependClause, Source)
diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 21b4a344dbc438..484aaf50e223f0 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3515,6 +3515,12 @@ struct OmpIfClause {
   std::tuple<std::optional<DirectiveNameModifier>, ScalarLogicalExpr> t;
 };
 
+// OpenMPv5.2 12.5.2 detach-clause -> DETACH (event-handle)
+struct OmpDetachClause {
+  WRAPPER_CLASS_BOILERPLATE(OmpDetachClause, OmpObject);
+  CharBlock source;
+};
+
 // 2.8.1 aligned-clause -> ALIGNED (variable-name-list[ : scalar-constant])
 struct OmpAlignedClause {
   TUPLE_CLASS_BOILERPLATE(OmpAlignedClause);
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 8634c522cf343a..2a67f87128588f 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -215,7 +215,7 @@ TYPE_PARSER(construct<OmpIfClause>(
         ":"),
     scalarLogicalExpr))
 
-// 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
+// OpenMPv5.2 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
 TYPE_PARSER(construct<OmpReductionOperator>(Parser<DefinedOperator>{}) ||
     construct<OmpReductionOperator>(Parser<ProcedureDesignator>{}))
 
@@ -298,6 +298,10 @@ TYPE_CONTEXT_PARSER("Omp LINEAR clause"_en_US,
         construct<OmpLinearClause>(construct<OmpLinearClause::WithoutModifier>(
             nonemptyList(name), maybe(":" >> scalarIntConstantExpr)))))
 
+// 12.5.2 detach-clause -> DETACH (event-handle)
+TYPE_PARSER(construct<OmpDetachClause>(
+	Parser<OmpObject>{}))
+
 // 2.8.1 ALIGNED (list: alignment)
 TYPE_PARSER(construct<OmpAlignedClause>(
     Parser<OmpObjectList>{}, maybe(":" >> scalarIntConstantExpr)))
@@ -414,6 +418,8 @@ TYPE_PARSER(
                        parenthesized(Parser<OmpReductionClause>{}))) ||
     "IN_REDUCTION" >> construct<OmpClause>(construct<OmpClause::InReduction>(
                           parenthesized(Parser<OmpInReductionClause>{}))) ||
+    "DETACH" >> construct<OmpClause>(construct<OmpClause::Detach>(
+		    	  parenthesized(Parser<OmpDetachClause>{}))) ||
     "TASK_REDUCTION" >>
         construct<OmpClause>(construct<OmpClause::TaskReduction>(
             parenthesized(Parser<OmpReductionClause>{}))) ||
diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index d1011fe58a0264..bb8ec168ced2d5 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -2131,6 +2131,9 @@ class UnparseVisitor {
     Put(":");
     Walk(std::get<OmpObjectList>(x.t));
   }
+  void Unparse(const OmpDetachClause &x){
+    Walk(x.v);
+  }
   void Unparse(const OmpInReductionClause &x) {
     Walk(std::get<OmpReductionOperator>(x.t));
     Put(":");
diff --git a/flang/test/Parser/OpenMP/task.f90 b/flang/test/Parser/OpenMP/task.f90
new file mode 100644
index 00000000000000..dbeb6e51b345b1
--- /dev/null
+++ b/flang/test/Parser/OpenMP/task.f90
@@ -0,0 +1,16 @@
+! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50  %s | FileCheck --ignore-case %s
+! RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=50  %s | FileCheck --ignore-case --check-prefix="CHECK-UNPARSE" %s
+
+!CHECK: OmpBlockDirective -> llvm::omp::Directive = task
+!CHECK: OmpClauseList -> OmpClause -> Detach -> OmpDetachClause -> OmpObject -> Designator -> DataRef -> Name = 'event'
+
+!CHECK-UNPARSE: INTEGER(KIND=8_4) event
+!CHECK-UNPARSE: !$OMP TASK  DETACH(event)
+!CHECK-UNPARSE: !$OMP END TASK
+subroutine task_detach
+  use omp_lib
+  implicit none
+  integer(kind=omp_event_handle_kind) :: event
+  !$omp task detach(event)
+  !$omp end task
+end subroutine
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index f2f09812a86905..6ed224f0857a9b 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -132,6 +132,7 @@ def OMPC_Destroy : Clause<"destroy"> {
 }
 def OMPC_Detach : Clause<"detach"> {
   let clangClass = "OMPDetachClause";
+  let flangClass = "OmpDetachClause";
 }
 def OMPC_Device : Clause<"device"> {
   let clangClass = "OMPDeviceClause";

Copy link

github-actions bot commented Oct 15, 2024

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

Copy link
Contributor

@kiranchandramohan kiranchandramohan left a comment

Choose a reason for hiding this comment

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

Can you add a TODO in lowering (OpenMP.cpp) to catch that there is no lowering support?

// OpenMPv5.2 12.5.2 detach-clause -> DETACH (event-handle)
struct OmpDetachClause {
WRAPPER_CLASS_BOILERPLATE(OmpDetachClause, OmpObject);
CharBlock source;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used currently? Don't you have to use a sourced() parser to fill it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thought was to pre-emptively add it for the patch on semantic checks for detach clause. Yeah I missed the sourced(), thanks for that. I am removing this though; on second thoughts, we would have the source for the task construct itself. So that should be sufficient to report any errors. If at all needed, we can bring this back later. Does that work?

!CHECK-UNPARSE: !$OMP TASK DETACH(event)
!CHECK-UNPARSE: !$OMP END TASK
subroutine task_detach
use omp_lib
Copy link
Contributor

Choose a reason for hiding this comment

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

use omp_lib needs ! REQUIRES: openmp_runtime, to avoid errors when OpenMP runtime is not available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

@@ -215,7 +215,7 @@ TYPE_PARSER(construct<OmpIfClause>(
":"),
scalarLogicalExpr))

// 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
// OpenMPv5.2 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
Copy link
Contributor

Choose a reason for hiding this comment

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

The 2.15.3.6 reference is from OpenMP 4.5. In OpenMP 5.2 it seems to be 5.5.8.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry. I accidentally modified the REDUCTION. Reverting it.

@@ -298,6 +298,9 @@ TYPE_CONTEXT_PARSER("Omp LINEAR clause"_en_US,
construct<OmpLinearClause>(construct<OmpLinearClause::WithoutModifier>(
nonemptyList(name), maybe(":" >> scalarIntConstantExpr)))))

// 12.5.2 detach-clause -> DETACH (event-handle)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// 12.5.2 detach-clause -> DETACH (event-handle)
// OpenMPv5.2 12.5.2 detach-clause -> DETACH (event-handle)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Added it.

Copy link
Contributor Author

@NimishMishra NimishMishra left a comment

Choose a reason for hiding this comment

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

Thanks all for the reviews.

// OpenMPv5.2 12.5.2 detach-clause -> DETACH (event-handle)
struct OmpDetachClause {
WRAPPER_CLASS_BOILERPLATE(OmpDetachClause, OmpObject);
CharBlock source;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thought was to pre-emptively add it for the patch on semantic checks for detach clause. Yeah I missed the sourced(), thanks for that. I am removing this though; on second thoughts, we would have the source for the task construct itself. So that should be sufficient to report any errors. If at all needed, we can bring this back later. Does that work?

@@ -215,7 +215,7 @@ TYPE_PARSER(construct<OmpIfClause>(
":"),
scalarLogicalExpr))

// 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
// OpenMPv5.2 2.15.3.6 REDUCTION (reduction-identifier: variable-name-list)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry. I accidentally modified the REDUCTION. Reverting it.

@@ -298,6 +298,9 @@ TYPE_CONTEXT_PARSER("Omp LINEAR clause"_en_US,
construct<OmpLinearClause>(construct<OmpLinearClause::WithoutModifier>(
nonemptyList(name), maybe(":" >> scalarIntConstantExpr)))))

// 12.5.2 detach-clause -> DETACH (event-handle)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Added it.

!CHECK-UNPARSE: !$OMP TASK DETACH(event)
!CHECK-UNPARSE: !$OMP END TASK
subroutine task_detach
use omp_lib
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@NimishMishra NimishMishra merged commit 0653698 into llvm:main Nov 4, 2024
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 4, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building flang,llvm at step 7 "Add check check-flang".

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

Here is the relevant piece of the build log for the reference
Step 7 (Add check check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/OpenMP/Todo/task_detach.f90' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/not bbc -emit-fir -fopenmp -fopenmp-version=50 -o - /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90 2>&1 | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/not bbc -emit-fir -fopenmp -fopenmp-version=50 -o - /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90:9:10: error: CHECK: expected string not found in input
! CHECK: not yet implemented: OpenMP Block construct clause
         ^
<stdin>:1:1: note: scanning from here
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90:11:7: error: Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found
^
<stdin>:4:112: note: possible intended match here
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90:12:17: error: Must be a constant value
                                                                                                               ^

Input file: <stdin>
Check file: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90:11:7: error: Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found 
check:9'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
           2:  use omp_lib 
check:9'0     ~~~~~~~~~~~~~
           3:  ^^^^^^^ 
check:9'0     ~~~~~~~~~
           4: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90:12:17: error: Must be a constant value 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:9'1                                                                                                                    ?                                    possible intended match
           5:  integer (kind=omp_event_handle_kind) :: event 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           6:  ^^^^^^^^^^^^^^^^^^^^^ 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~
           7: bbc: semantic errors in /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/task_detach.f90 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

--

********************


@NimishMishra
Copy link
Contributor Author

Can anyone suggest on how to fix the buildbot failure on openmp-offload-sles-build-only

Issue: "Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found"

We need the module file to access omp_event_handle_kind while defining the event handle. Is there a way to disable the test on a target when the module file is missing?

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 4, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-rel-assert running on linaro-flang-aarch64-rel-assert while building flang,llvm at step 6 "test-build-unified-tree-check-flang".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/OpenMP/Todo/task_detach.f90' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/not bbc -emit-fir -fopenmp -fopenmp-version=50 -o - /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90 2>&1 | /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/not bbc -emit-fir -fopenmp -fopenmp-version=50 -o - /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90:9:10: error: CHECK: expected string not found in input
! CHECK: not yet implemented: OpenMP Block construct clause
         ^
<stdin>:1:1: note: scanning from here
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90:11:7: error: Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found
^
<stdin>:4:114: note: possible intended match here
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90:12:17: error: Must be a constant value
                                                                                                                 ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90:11:7: error: Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found 
check:9'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
           2:  use omp_lib 
check:9'0     ~~~~~~~~~~~~~
           3:  ^^^^^^^ 
check:9'0     ~~~~~~~~~
           4: /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90:12:17: error: Must be a constant value 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:9'1                                                                                                                      ?                                    possible intended match
           5:  integer (kind=omp_event_handle_kind) :: event 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           6:  ^^^^^^^^^^^^^^^^^^^^^ 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~
           7: bbc: semantic errors in /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/OpenMP/Todo/task_detach.f90 
check:9'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

--

********************


@DavidSpickett
Copy link
Collaborator

DavidSpickett commented Nov 4, 2024

FYI there are actually 2 failures on Linaro's bots: https://lab.llvm.org/buildbot/#/builders/29/builds/6009 (looks like the same cause, the missing file)

You won't be getting failure emails because your commit address is set to a GitHub noreply address. Consider changing that to a real email address for future contributions.

@DavidSpickett
Copy link
Collaborator

@luporl might be able to help here.

On a high level, you would find out what produces that omp_lib (openmp being an enabled subproject?) and then add a lit test feature for that thing. Maybe this existing one would do the job?

! REQUIRES: openmp_runtime

@kiranchandramohan
Copy link
Contributor

Can anyone suggest on how to fix the buildbot failure on openmp-offload-sles-build-only

Issue: "Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found"

We need the module file to access omp_event_handle_kind while defining the event handle. Is there a way to disable the test on a target when the module file is missing?

Can you try adding %openmp_flags to see whether it fixes the issue like in the following?

! RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - 2>&1 | FileCheck %s
! RUN: bbc %openmp_flags -emit-hlfir -o - %s 2>&1 | FileCheck %s

@NimishMishra
Copy link
Contributor Author

Thanks @DavidSpickett and @kiranchandramohan for the suggestions. I think this should solve the issue. I am monitoring the buildbots at the moment, will update here once they are clean. Thanks

@NimishMishra
Copy link
Contributor Author

The buildbots flang-aarch64-rel-assert and openmp-offload-sles-build-only are now clean. %openmp_flags and ! REQUIRES: openmp_runtime were sufficient. Thanks all.

PhilippRados pushed a commit to PhilippRados/llvm-project that referenced this pull request Nov 6, 2024
Add parsing support for task detach, along with parse/unparse tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:openmp OpenMP related changes to Clang flang:fir-hlfir flang:openmp flang:parser flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants