Skip to content

[Flang][OpenMP]Add tests for align and allocator in allocate clauses #121356

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 3 commits into from
Jan 20, 2025

Conversation

Leporacanthicus
Copy link
Contributor

No functional change.

(Also, tried to filter out all ALLOCATOR modifiers, but that makes some other tests fail).

No functional change.

(Also, tried to filter out all ALLOCATOR modifiers, but that makes some
other tests fail).
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir flang:openmp flang:parser labels Dec 30, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 30, 2024

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

@llvm/pr-subscribers-flang-openmp

Author: Mats Petersson (Leporacanthicus)

Changes

No functional change.

(Also, tried to filter out all ALLOCATOR modifiers, but that makes some other tests fail).


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

3 Files Affected:

  • (modified) flang/lib/Parser/openmp-parsers.cpp (+2-2)
  • (added) flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 (+14)
  • (added) flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 (+15)
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 67385c03f66c80..dea4102205be0c 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -157,8 +157,8 @@ static TypeDeclarationStmt makeIterSpecDecl(std::list<ObjectName> &&names) {
 
 TYPE_PARSER(construct<OmpAlignment>(scalarIntExpr))
 
-TYPE_PARSER(construct<OmpAlignModifier>( //
-    "ALIGN" >> parenthesized(scalarIntExpr)))
+TYPE_PARSER(
+    construct<OmpAlignModifier>("ALIGN"_tok >> parenthesized(scalarIntExpr)))
 
 TYPE_PARSER(construct<OmpAllocatorComplexModifier>(
     "ALLOCATOR" >> parenthesized(scalarIntExpr)))
diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90
new file mode 100644
index 00000000000000..c51ba9be84235b
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90
@@ -0,0 +1,14 @@
+! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: OmpAllocateClause ALIGN modifier
+program p
+  use omp_lib
+  integer :: x
+  integer :: a
+  integer :: i
+  !$omp parallel private(x) allocate(align(4): x)
+  do i=1,10
+     a = a + i
+  end do
+  !$omp end parallel
+end program p
diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
new file mode 100644
index 00000000000000..01a91e84a0d477
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
@@ -0,0 +1,15 @@
+! RUN: %not_todo_cmd %flang_fc1 -emit-llvm -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: Unhandled clause allocate in omp.parallel
+! CHECK: LLVM Translation failed for operation: omp.parallel
+program p
+  use omp_lib
+  integer :: x
+  integer :: a
+  integer :: i
+  !$omp parallel private(x) allocate(allocator(omp_default_mem_alloc): x)
+  do i=1,10
+     a = a + i
+  end do
+  !$omp end parallel
+end program p

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.

What about a parse tree / unparse tests?

@Leporacanthicus
Copy link
Contributor Author

What about a parse tree / unparse tests?

There are existing tests that covers the same clause in lang/test/Parser/OpenMP/allocators-unparse.f90 - it isn't a parallel construct, but it shouldn't make any difference to the parser/unparse side. Despite being called unparse, it also covers the parse-tree too.

Copy link
Contributor

@kparzysz kparzysz left a comment

Choose a reason for hiding this comment

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

The added 'REQUIRES` line is now causing these tests to be skipped, at least in the Linux tests:

UNSUPPORTED: Flang :: Lower/OpenMP/Todo/allocate-clause-align.f90 (1066 of 3198)
UNSUPPORTED: Flang :: Lower/OpenMP/Todo/allocate-clause-allocator.f90 (1067 of 3198)

Did you check locally that these two behave properly when the runtime is present?

Comment on lines 160 to 161
TYPE_PARSER(construct<OmpAlignModifier>( //
"ALIGN" >> parenthesized(scalarIntExpr)))
Copy link
Contributor

Choose a reason for hiding this comment

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

The idea here (and below) is that the actual source word starts a line. This makes is easier to visually break it down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I kinda realized that when I saw it in the review. I'll undo that.

@Leporacanthicus
Copy link
Contributor Author

Did you check locally that these two behave properly when the runtime is present?

I did. But I also realize that I can remove the use omp_lib in the align version, so I'm changing that - as I'm reverting the "remove comment" thing.

Copy link
Contributor

@kparzysz kparzysz 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!

@tblah tblah merged commit 9da7c3b into llvm:main Jan 20, 2025
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 20, 2025

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

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

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/allocate-clause-allocator.f90' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/not /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -fc1 -emit-llvm -fopenmp -fopenmp-version=51 -o - /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.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/allocate-clause-allocator.f90
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/not /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -fc1 -emit-llvm -fopenmp -fopenmp-version=51 -o - /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.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/allocate-clause-allocator.f90
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90:4:10: error: CHECK: expected string not found in input
! CHECK: not yet implemented: Unhandled clause allocate in omp.parallel
         ^
<stdin>:1:1: note: scanning from here
error: Semantic errors in /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
^
<stdin>:1:101: note: possible intended match here
error: Semantic errors in /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
                                                                                                    ^

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

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

Input was:
<<<<<<
           1: error: Semantic errors in /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 
check:4'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:4'1                                                                                                         ?                                                possible intended match
           2: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90:7:7: error: Cannot parse module file for module 'omp_lib': Source file 'omp_lib.mod' was not found 
check:4'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           3:  use omp_lib 
check:4'0     ~~~~~~~~~~~~~
           4:  ^^^^^^^ 
check:4'0     ~~~~~~~~~
           5: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90:11:48: error: Must have INTEGER type, but is REAL(4) 
check:4'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           6:  !$omp parallel private(x) allocate(allocator(omp_default_mem_alloc): x) 
check:4'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           7:  ^^^^^^^^^^^^^^^^^^^^^ 
check:4'0     ~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

--

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


@jplehr
Copy link
Contributor

jplehr commented Jan 20, 2025

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

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

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

Did anybody else see this error? The bot appears to be still failing.

dpalermo pushed a commit that referenced this pull request Jan 21, 2025
It appears that omp_lib is not correctly (or maybe not at all?) found
from the build directory. This made a few buildbots break after
[PR#121356](#121356) landed.
This is a workaround to unblock the buildbots.

https://lab.llvm.org/staging/#/builders/130/builds/12654
https://lab.llvm.org/buildbot/#/builders/140/builds/15102
https://lab.llvm.org/staging/#/builders/105/builds/13855
github-actions bot pushed a commit to arm/arm-toolchain that referenced this pull request Jan 21, 2025
It appears that omp_lib is not correctly (or maybe not at all?) found
from the build directory. This made a few buildbots break after
[PR#121356](llvm/llvm-project#121356) landed.
This is a workaround to unblock the buildbots.

https://lab.llvm.org/staging/#/builders/130/builds/12654
https://lab.llvm.org/buildbot/#/builders/140/builds/15102
https://lab.llvm.org/staging/#/builders/105/builds/13855
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants