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

[flang][OpenMP] Add private to allocate in parallel-sections.f90 #92185

Merged

Conversation

kparzysz
Copy link
Contributor

Add a privatizing clause to the construct that uses allocate clause. Amend the CHECK lines to reflect the expected output.

Add a privatizing clause to the construct that uses `allocate` clause.
Amend the CHECK lines to reflect the expected output.
@llvmbot
Copy link
Collaborator

llvmbot commented May 14, 2024

@llvm/pr-subscribers-flang-openmp

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

Author: Krzysztof Parzyszek (kparzysz)

Changes

Add a privatizing clause to the construct that uses allocate clause. Amend the CHECK lines to reflect the expected output.


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

1 Files Affected:

  • (modified) flang/test/Lower/OpenMP/parallel-sections.f90 (+2-6)
diff --git a/flang/test/Lower/OpenMP/parallel-sections.f90 b/flang/test/Lower/OpenMP/parallel-sections.f90
index 2f78dd4562b0a..ff96bdc29d425 100644
--- a/flang/test/Lower/OpenMP/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/parallel-sections.f90
@@ -40,12 +40,8 @@ subroutine omp_parallel_sections_allocate(x, y)
   use omp_lib
   integer, intent(inout) :: x, y
   !CHECK: %[[allocator_1:.*]] = arith.constant 4 : i64
-  !CHECK: %[[allocator_2:.*]] = arith.constant 4 : i64
-  !CHECK: omp.parallel allocate(
-  !CHECK: %[[allocator_2]] : i64 -> %{{.*}} : !fir.ref<i32>) {
-  !CHECK: omp.sections allocate(
-  !CHECK: %[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
-  !$omp parallel sections allocate(omp_high_bw_mem_alloc: x)
+  !CHECK: omp.sections allocate(%[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
+  !$omp parallel sections allocate(omp_high_bw_mem_alloc: x) private(x, y)
     !CHECK: omp.section {
     !$omp section
       x = x + 12

Comment on lines +43 to +44
!CHECK: omp.sections allocate(%[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
!$omp parallel sections allocate(omp_high_bw_mem_alloc: x) private(x, y)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you miss the CHECK for parallel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

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.

Thanks for the fix. nit: I think this test also does not need to depend upon openmp_runtime

@kparzysz
Copy link
Contributor Author

Thanks for the fix. nit: I think this test also does not need to depend upon openmp_runtime

We'd need to remove the omp_high_bw_mem_alloc from the allocate clause. That symbol comes from omp_lib.mod, which is a part of the runtime. Are you ok with that, or should we leave it as it is now?

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.

LG.

@tblah
Copy link
Contributor

tblah commented May 15, 2024

Feel free to leave it as it is if it isn't trivial

@kparzysz
Copy link
Contributor Author

The generated code will change slightly. This isn't the only test where the allocate modifier is used---we can decide later whether we want to keep using it in tests or not. Better yet, we'd fix the module dependency issue...

@kparzysz kparzysz merged commit 97a3044 into llvm:main May 15, 2024
4 checks passed
@kparzysz kparzysz deleted the users/kparzysz/parallel-sections-assertion branch May 15, 2024 13:57
mub-at-arm pushed a commit to mub-at-arm/llvm-project that referenced this pull request May 16, 2024
…lvm#92185)

Add a privatizing clause to the construct that uses `allocate` clause.
Amend the CHECK lines to reflect the expected output.
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 Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants