[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-07-01 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak updated 
https://github.com/llvm/llvm-project/pull/92524

>From 95d6f3446201d2b3162b694887e3fd888b628e96 Mon Sep 17 00:00:00 2001
From: Sergio Afonso 
Date: Fri, 17 May 2024 11:38:36 +0100
Subject: [PATCH] [Flang][OpenMP] Update flang with changes to the OpenMP
 dialect

This patch applies fixes after the updates to OpenMP clause operands, as well
as updating some tests that were impacted by changes to the ordering or
assembly format of some clauses in MLIR.
---
 flang/lib/Lower/OpenMP/ClauseProcessor.cpp|  4 ++--
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  4 ++--
 flang/lib/Lower/OpenMP/OpenMP.cpp | 19 ---
 flang/test/Lower/OpenMP/atomic-capture.f90|  2 +-
 flang/test/Lower/OpenMP/copyin-order.f90  |  2 +-
 flang/test/Lower/OpenMP/parallel-wsloop.f90   |  2 +-
 flang/test/Lower/OpenMP/parallel.f90  | 24 +--
 flang/test/Lower/OpenMP/simd.f90  |  2 +-
 flang/test/Lower/OpenMP/target.f90| 24 +--
 .../use-device-ptr-to-use-device-addr.f90 |  2 +-
 10 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index f78cd0f9df1a1..d507e58b164dd 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -1073,7 +1073,7 @@ bool ClauseProcessor::processEnter(
 }
 
 bool ClauseProcessor::processUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDeviceAddrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
@@ -1085,7 +1085,7 @@ bool ClauseProcessor::processUseDeviceAddr(
 }
 
 bool ClauseProcessor::processUseDevicePtr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDevicePtrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index 53571ae5abc20..43795d5c25399 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -129,12 +129,12 @@ class ClauseProcessor {
 mlir::omp::ReductionClauseOps ) const;
   bool processTo(llvm::SmallVectorImpl ) 
const;
   bool processUseDeviceAddr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDeviceAddrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
   bool processUseDevicePtr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDevicePtrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 22c41fce31723..d8679fb693659 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -244,7 +244,8 @@ createAndSetPrivatizedLoopVar(lower::AbstractConverter 
,
 //  clause. Support for such list items in a use_device_ptr clause
 //  is deprecated."
 static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+llvm::SmallVectorImpl ,
+llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) {
@@ -256,10 +257,9 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
 
   // Iterate over our use_device_ptr list and shift all non-cptr arguments into
   // use_device_addr.
-  for (auto *it = clauseOps.useDevicePtrVars.begin();
-   it != clauseOps.useDevicePtrVars.end();) {
+  for (auto *it = useDevicePtrVars.begin(); it != useDevicePtrVars.end();) {
 if (!fir::isa_builtin_cptr_type(fir::unwrapRefType(it->getType( {
-  clauseOps.useDeviceAddrVars.push_back(*it);
+  useDeviceAddrVars.push_back(*it);
   // We have to shuffle the symbols around as well, to maintain
   // the correct Input -> BlockArg for use_device_ptr/use_device_addr.
   // NOTE: However, as map's do not seem to be included currently
@@ -267,11 +267,11 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
   // future alterations. I believe the reason they are not currently
   // is that the BlockArg assign/lowering needs to be extended
   // to a greater set of types.
-  auto idx = std::distance(clauseOps.useDevicePtrVars.begin(), it);
+  auto idx = std::distance(useDevicePtrVars.begin(), it);
   moveElementToBack(idx, useDeviceTypes);
   moveElementToBack(idx, useDeviceLocs);
   moveElementToBack(idx, useDeviceSymbols);
-  it = clauseOps.useDevicePtrVars.erase(it);
+  it = useDevicePtrVars.erase(it);
   continue;
 }
 ++it;
@@ -1024,7 +1024,7 @@ static void 
genCriticalDeclareClauses(lower::AbstractConverter ,
   llvm::StringRef name) {
   ClauseProcessor 

[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-28 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak updated 
https://github.com/llvm/llvm-project/pull/92524

>From 441b83ca7fdc31b8717207529b6e86e33a1f130a Mon Sep 17 00:00:00 2001
From: Sergio Afonso 
Date: Fri, 17 May 2024 11:38:36 +0100
Subject: [PATCH] [Flang][OpenMP] Update flang with changes to the OpenMP
 dialect

This patch applies fixes after the updates to OpenMP clause operands, as well
as updating some tests that were impacted by changes to the ordering or
assembly format of some clauses in MLIR.
---
 flang/lib/Lower/OpenMP/ClauseProcessor.cpp|  4 ++--
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  4 ++--
 flang/lib/Lower/OpenMP/OpenMP.cpp | 19 ---
 flang/test/Lower/OpenMP/atomic-capture.f90|  2 +-
 flang/test/Lower/OpenMP/copyin-order.f90  |  2 +-
 flang/test/Lower/OpenMP/parallel-wsloop.f90   |  2 +-
 flang/test/Lower/OpenMP/parallel.f90  | 24 +--
 flang/test/Lower/OpenMP/simd.f90  |  2 +-
 flang/test/Lower/OpenMP/target.f90| 24 +--
 .../use-device-ptr-to-use-device-addr.f90 |  2 +-
 10 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index f78cd0f9df1a1..d507e58b164dd 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -1073,7 +1073,7 @@ bool ClauseProcessor::processEnter(
 }
 
 bool ClauseProcessor::processUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDeviceAddrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
@@ -1085,7 +1085,7 @@ bool ClauseProcessor::processUseDeviceAddr(
 }
 
 bool ClauseProcessor::processUseDevicePtr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDevicePtrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index 53571ae5abc20..43795d5c25399 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -129,12 +129,12 @@ class ClauseProcessor {
 mlir::omp::ReductionClauseOps ) const;
   bool processTo(llvm::SmallVectorImpl ) 
const;
   bool processUseDeviceAddr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDeviceAddrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
   bool processUseDevicePtr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDevicePtrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 22c41fce31723..d8679fb693659 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -244,7 +244,8 @@ createAndSetPrivatizedLoopVar(lower::AbstractConverter 
,
 //  clause. Support for such list items in a use_device_ptr clause
 //  is deprecated."
 static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+llvm::SmallVectorImpl ,
+llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) {
@@ -256,10 +257,9 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
 
   // Iterate over our use_device_ptr list and shift all non-cptr arguments into
   // use_device_addr.
-  for (auto *it = clauseOps.useDevicePtrVars.begin();
-   it != clauseOps.useDevicePtrVars.end();) {
+  for (auto *it = useDevicePtrVars.begin(); it != useDevicePtrVars.end();) {
 if (!fir::isa_builtin_cptr_type(fir::unwrapRefType(it->getType( {
-  clauseOps.useDeviceAddrVars.push_back(*it);
+  useDeviceAddrVars.push_back(*it);
   // We have to shuffle the symbols around as well, to maintain
   // the correct Input -> BlockArg for use_device_ptr/use_device_addr.
   // NOTE: However, as map's do not seem to be included currently
@@ -267,11 +267,11 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
   // future alterations. I believe the reason they are not currently
   // is that the BlockArg assign/lowering needs to be extended
   // to a greater set of types.
-  auto idx = std::distance(clauseOps.useDevicePtrVars.begin(), it);
+  auto idx = std::distance(useDevicePtrVars.begin(), it);
   moveElementToBack(idx, useDeviceTypes);
   moveElementToBack(idx, useDeviceLocs);
   moveElementToBack(idx, useDeviceSymbols);
-  it = clauseOps.useDevicePtrVars.erase(it);
+  it = useDevicePtrVars.erase(it);
   continue;
 }
 ++it;
@@ -1024,7 +1024,7 @@ static void 
genCriticalDeclareClauses(lower::AbstractConverter ,
   llvm::StringRef name) {
   ClauseProcessor 

[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-27 Thread Kareem Ergawy via llvm-branch-commits

https://github.com/ergawy approved this pull request.


https://github.com/llvm/llvm-project/pull/92524
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-26 Thread Tom Eccles via llvm-branch-commits

https://github.com/tblah approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/92524
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-26 Thread Sergio Afonso via llvm-branch-commits

skatrak wrote:

> @skatrak Is this ready for final review?

Yes, it may need very minor changes when rebasing due to recent additions to 
the main branch, but this should be it for the most part.

https://github.com/llvm/llvm-project/pull/92524
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-26 Thread Michael Klemm via llvm-branch-commits

mjklemm wrote:

@skatrak Is this ready for final review?

https://github.com/llvm/llvm-project/pull/92524
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-12 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak updated 
https://github.com/llvm/llvm-project/pull/92524

>From 33e726ed0d41dd2abb7b99eb413ea9bc014184d1 Mon Sep 17 00:00:00 2001
From: Sergio Afonso 
Date: Fri, 17 May 2024 11:38:36 +0100
Subject: [PATCH] [Flang][OpenMP] Update flang with changes to the OpenMP
 dialect

This patch applies fixes after the updates to OpenMP clause operands, as well
as updating some tests that were impacted by changes to the ordering or
assembly format of some clauses in MLIR.
---
 flang/lib/Lower/OpenMP/ClauseProcessor.cpp|  4 ++--
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  4 ++--
 flang/lib/Lower/OpenMP/OpenMP.cpp | 19 ---
 flang/test/Lower/OpenMP/atomic-capture.f90|  2 +-
 flang/test/Lower/OpenMP/copyin-order.f90  |  2 +-
 flang/test/Lower/OpenMP/parallel-wsloop.f90   |  2 +-
 flang/test/Lower/OpenMP/parallel.f90  | 24 +--
 flang/test/Lower/OpenMP/simd.f90  |  2 +-
 flang/test/Lower/OpenMP/target.f90| 24 +--
 .../use-device-ptr-to-use-device-addr.f90 |  2 +-
 10 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index 371fe6db01255..7fe39029a1280 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -990,7 +990,7 @@ bool ClauseProcessor::processEnter(
 }
 
 bool ClauseProcessor::processUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDeviceAddrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
@@ -1002,7 +1002,7 @@ bool ClauseProcessor::processUseDeviceAddr(
 }
 
 bool ClauseProcessor::processUseDevicePtr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDevicePtrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index e8b06a703fc03..1bf3aa1dbd19c 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -127,12 +127,12 @@ class ClauseProcessor {
 mlir::omp::ReductionClauseOps ) const;
   bool processTo(llvm::SmallVectorImpl ) 
const;
   bool processUseDeviceAddr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDeviceAddrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
   bool processUseDevicePtr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDevicePtrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 9a8211711123e..4ad330c6b8dfa 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -244,7 +244,8 @@ createAndSetPrivatizedLoopVar(lower::AbstractConverter 
,
 //  clause. Support for such list items in a use_device_ptr clause
 //  is deprecated."
 static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+llvm::SmallVectorImpl ,
+llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) {
@@ -256,10 +257,9 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
 
   // Iterate over our use_device_ptr list and shift all non-cptr arguments into
   // use_device_addr.
-  for (auto *it = clauseOps.useDevicePtrVars.begin();
-   it != clauseOps.useDevicePtrVars.end();) {
+  for (auto *it = useDevicePtrVars.begin(); it != useDevicePtrVars.end();) {
 if (!fir::isa_builtin_cptr_type(fir::unwrapRefType(it->getType( {
-  clauseOps.useDeviceAddrVars.push_back(*it);
+  useDeviceAddrVars.push_back(*it);
   // We have to shuffle the symbols around as well, to maintain
   // the correct Input -> BlockArg for use_device_ptr/use_device_addr.
   // NOTE: However, as map's do not seem to be included currently
@@ -267,11 +267,11 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
   // future alterations. I believe the reason they are not currently
   // is that the BlockArg assign/lowering needs to be extended
   // to a greater set of types.
-  auto idx = std::distance(clauseOps.useDevicePtrVars.begin(), it);
+  auto idx = std::distance(useDevicePtrVars.begin(), it);
   moveElementToBack(idx, useDeviceTypes);
   moveElementToBack(idx, useDeviceLocs);
   moveElementToBack(idx, useDeviceSymbols);
-  it = clauseOps.useDevicePtrVars.erase(it);
+  it = useDevicePtrVars.erase(it);
   continue;
 }
 ++it;
@@ -987,7 +987,7 @@ static void 
genCriticalDeclareClauses(lower::AbstractConverter ,
   llvm::StringRef name) {
   ClauseProcessor cp(converter, 

[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-12 Thread Sergio Afonso via llvm-branch-commits


@@ -1086,8 +1086,9 @@ static void genTargetDataClauses(
   // ordering.
   // TODO: Perhaps create a user provideable compiler option that will
   // re-introduce a hard-error rather than a warning in these cases.
-  promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(clauseOps, useDeviceTypes,
-useDeviceLocs, useDeviceSyms);
+  promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
+  clauseOps.useDeviceAddrVars, clauseOps.useDevicePtrVars, useDeviceTypes,
+  useDeviceLocs, useDeviceSyms);

skatrak wrote:

The reason I made this change is that otherwise we'd have to change the 
`clauseOps` argument type received by the function to `TargetDataClauseOps`, 
which I feel is a bit too broad. I know `target` is currently the only 
construct that uses these clauses, but even if that's always going to be the 
case, it seems wrong to pass all `target` information to a function that only 
cares about `use_device_ptr` and `use_device_addr` clauses.

Since information for these clauses is now split into independent structures, 
if we wanted to pass them as we did before without some unrelated `target` 
information (which would also restrict the function to only possibly ever apply 
to that construct), we'd have to pass both a `UseDevicePtrClauseOps` and a 
`UseDeviceAddrClauseOps` object reference. At that point passing structures 
made little sense and it was too verbose, and that's why I decided that just 
passing the lists would made a bit more sense.

So, that's the thinking behind this change. It boils down to prioritizing the 
"principle" of what should be an argument of that function over what would 
reduce the size of the argument list by one element. I'm happy to change it 
back, though, if the general consensus is to do it the other way around. Just 
sharing my thought process here.

https://github.com/llvm/llvm-project/pull/92524
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-06-07 Thread Kareem Ergawy via llvm-branch-commits


@@ -1086,8 +1086,9 @@ static void genTargetDataClauses(
   // ordering.
   // TODO: Perhaps create a user provideable compiler option that will
   // re-introduce a hard-error rather than a warning in these cases.
-  promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(clauseOps, useDeviceTypes,
-useDeviceLocs, useDeviceSyms);
+  promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
+  clauseOps.useDeviceAddrVars, clauseOps.useDevicePtrVars, useDeviceTypes,
+  useDeviceLocs, useDeviceSyms);

ergawy wrote:

Not sure why we need that change? Why not pass `clauseOps` and retrieve both 
members inside `promoteNonCPtrUseDevicePtrArgsToUseDEviceAddr`?

https://github.com/llvm/llvm-project/pull/92524
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-05-20 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak updated 
https://github.com/llvm/llvm-project/pull/92524

>From 3659909ba1e21e2a8364ee48c9c6c5b22ae4f8f5 Mon Sep 17 00:00:00 2001
From: Sergio Afonso 
Date: Fri, 17 May 2024 11:38:36 +0100
Subject: [PATCH] [Flang][OpenMP] Update flang with changes to the OpenMP
 dialect

This patch applies fixes after the updates to OpenMP clause operands, as well
as updating some tests that were impacted by changes to the ordering or
assembly format of some clauses in MLIR.
---
 flang/lib/Lower/OpenMP/ClauseProcessor.cpp|  4 ++--
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  4 ++--
 flang/lib/Lower/OpenMP/OpenMP.cpp | 19 ---
 flang/test/Lower/OpenMP/atomic-capture.f90|  2 +-
 flang/test/Lower/OpenMP/copyin-order.f90  |  2 +-
 flang/test/Lower/OpenMP/parallel-wsloop.f90   |  2 +-
 flang/test/Lower/OpenMP/parallel.f90  | 24 +--
 flang/test/Lower/OpenMP/simd.f90  |  2 +-
 flang/test/Lower/OpenMP/target.f90| 24 +--
 .../use-device-ptr-to-use-device-addr.f90 |  2 +-
 10 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index 875599098b3dc..3cbc925f8869c 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -973,7 +973,7 @@ bool ClauseProcessor::processEnter(
 }
 
 bool ClauseProcessor::processUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDeviceAddrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
@@ -985,7 +985,7 @@ bool ClauseProcessor::processUseDeviceAddr(
 }
 
 bool ClauseProcessor::processUseDevicePtr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDevicePtrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) const {
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index 4d3d4448e8f03..328d018ec2e52 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -125,12 +125,12 @@ class ClauseProcessor {
 mlir::omp::ReductionClauseOps ) const;
   bool processTo(llvm::SmallVectorImpl ) 
const;
   bool processUseDeviceAddr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDeviceAddrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
   bool processUseDevicePtr(
-  mlir::omp::UseDeviceClauseOps ,
+  mlir::omp::UseDevicePtrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ) const;
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index ece098a5bfbb1..e542f58e9b826 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -244,7 +244,8 @@ createAndSetPrivatizedLoopVar(lower::AbstractConverter 
,
 //  clause. Support for such list items in a use_device_ptr clause
 //  is deprecated."
 static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+llvm::SmallVectorImpl ,
+llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ) {
@@ -256,10 +257,9 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
 
   // Iterate over our use_device_ptr list and shift all non-cptr arguments into
   // use_device_addr.
-  for (auto *it = clauseOps.useDevicePtrVars.begin();
-   it != clauseOps.useDevicePtrVars.end();) {
+  for (auto *it = useDevicePtrVars.begin(); it != useDevicePtrVars.end();) {
 if (!fir::isa_builtin_cptr_type(fir::unwrapRefType(it->getType( {
-  clauseOps.useDeviceAddrVars.push_back(*it);
+  useDeviceAddrVars.push_back(*it);
   // We have to shuffle the symbols around as well, to maintain
   // the correct Input -> BlockArg for use_device_ptr/use_device_addr.
   // NOTE: However, as map's do not seem to be included currently
@@ -267,11 +267,11 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
   // future alterations. I believe the reason they are not currently
   // is that the BlockArg assign/lowering needs to be extended
   // to a greater set of types.
-  auto idx = std::distance(clauseOps.useDevicePtrVars.begin(), it);
+  auto idx = std::distance(useDevicePtrVars.begin(), it);
   moveElementToBack(idx, useDeviceTypes);
   moveElementToBack(idx, useDeviceLocs);
   moveElementToBack(idx, useDeviceSymbols);
-  it = clauseOps.useDevicePtrVars.erase(it);
+  it = useDevicePtrVars.erase(it);
   continue;
 }
 ++it;
@@ -931,7 +931,7 @@ static void 
genCriticalDeclareClauses(lower::AbstractConverter ,
   llvm::StringRef name) {
   ClauseProcessor cp(converter, 

[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-05-17 Thread via llvm-branch-commits

llvmbot wrote:



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

@llvm/pr-subscribers-flang-openmp

Author: Sergio Afonso (skatrak)


Changes

This patch applies fixes after the updates to OpenMP clause operands, as well 
as updating some tests that were impacted by changes to the ordering or 
assembly format of some clauses in MLIR.

---

Patch is 20.82 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/92524.diff


10 Files Affected:

- (modified) flang/lib/Lower/OpenMP/ClauseProcessor.cpp (+2-2) 
- (modified) flang/lib/Lower/OpenMP/ClauseProcessor.h (+2-2) 
- (modified) flang/lib/Lower/OpenMP/OpenMP.cpp (+10-9) 
- (modified) flang/test/Lower/OpenMP/atomic-capture.f90 (+1-1) 
- (modified) flang/test/Lower/OpenMP/copyin-order.f90 (+1-1) 
- (modified) flang/test/Lower/OpenMP/parallel-wsloop.f90 (+1-1) 
- (modified) flang/test/Lower/OpenMP/parallel.f90 (+12-12) 
- (modified) flang/test/Lower/OpenMP/simd.f90 (+1-1) 
- (modified) flang/test/Lower/OpenMP/target.f90 (+12-12) 
- (modified) flang/test/Lower/OpenMP/use-device-ptr-to-use-device-addr.f90 
(+1-1) 


``diff
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index b7198c951c8fe..357cc09bfb445 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -997,7 +997,7 @@ bool ClauseProcessor::processEnter(
 }
 
 bool ClauseProcessor::processUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDeviceAddrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl )
@@ -1011,7 +1011,7 @@ bool ClauseProcessor::processUseDeviceAddr(
 }
 
 bool ClauseProcessor::processUseDevicePtr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDevicePtrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl )
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index 78c148ab02163..220ea7b6d9920 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -128,13 +128,13 @@ class ClauseProcessor {
 mlir::omp::ReductionClauseOps ) const;
   bool processTo(llvm::SmallVectorImpl ) 
const;
   bool
-  processUseDeviceAddr(mlir::omp::UseDeviceClauseOps ,
+  processUseDeviceAddr(mlir::omp::UseDeviceAddrClauseOps ,
llvm::SmallVectorImpl ,
llvm::SmallVectorImpl ,
llvm::SmallVectorImpl
) const;
   bool
-  processUseDevicePtr(mlir::omp::UseDeviceClauseOps ,
+  processUseDevicePtr(mlir::omp::UseDevicePtrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 44011ad78f2e2..2f612dd6f2fb6 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -239,7 +239,8 @@ 
createAndSetPrivatizedLoopVar(Fortran::lower::AbstractConverter ,
 //  clause. Support for such list items in a use_device_ptr clause
 //  is deprecated."
 static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+llvm::SmallVectorImpl ,
+llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl
@@ -252,10 +253,9 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
 
   // Iterate over our use_device_ptr list and shift all non-cptr arguments into
   // use_device_addr.
-  for (auto *it = clauseOps.useDevicePtrVars.begin();
-   it != clauseOps.useDevicePtrVars.end();) {
+  for (auto *it = useDevicePtrVars.begin(); it != useDevicePtrVars.end();) {
 if (!fir::isa_builtin_cptr_type(fir::unwrapRefType(it->getType( {
-  clauseOps.useDeviceAddrVars.push_back(*it);
+  useDeviceAddrVars.push_back(*it);
   // We have to shuffle the symbols around as well, to maintain
   // the correct Input -> BlockArg for use_device_ptr/use_device_addr.
   // NOTE: However, as map's do not seem to be included currently
@@ -263,11 +263,11 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
   // future alterations. I believe the reason they are not currently
   // is that the BlockArg assign/lowering needs to be extended
   // to a greater set of types.
-  auto idx = std::distance(clauseOps.useDevicePtrVars.begin(), it);
+  auto idx = std::distance(useDevicePtrVars.begin(), it);
   moveElementToBack(idx, useDeviceTypes);
   moveElementToBack(idx, useDeviceLocs);
   moveElementToBack(idx, useDeviceSymbols);
-  it = clauseOps.useDevicePtrVars.erase(it);
+  it = useDevicePtrVars.erase(it);
   continue;
 }
 ++it;
@@ -1005,7 +1005,7 @@ 
genCriticalDeclareClauses(Fortran::lower::AbstractConverter 

[llvm-branch-commits] [flang] [Flang][OpenMP] Update flang with changes to the OpenMP dialect (PR #92524)

2024-05-17 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak created 
https://github.com/llvm/llvm-project/pull/92524

This patch applies fixes after the updates to OpenMP clause operands, as well 
as updating some tests that were impacted by changes to the ordering or 
assembly format of some clauses in MLIR.

>From 522812fb4354812e3bcfaf1b1e52dfa9e0db05ae Mon Sep 17 00:00:00 2001
From: Sergio Afonso 
Date: Fri, 17 May 2024 11:38:36 +0100
Subject: [PATCH] [Flang][OpenMP] Update flang with changes to the OpenMP
 dialect

This patch applies fixes after the updates to OpenMP clause operands, as well
as updating some tests that were impacted by changes to the ordering or
assembly format of some clauses in MLIR.
---
 flang/lib/Lower/OpenMP/ClauseProcessor.cpp|  4 ++--
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  4 ++--
 flang/lib/Lower/OpenMP/OpenMP.cpp | 19 ---
 flang/test/Lower/OpenMP/atomic-capture.f90|  2 +-
 flang/test/Lower/OpenMP/copyin-order.f90  |  2 +-
 flang/test/Lower/OpenMP/parallel-wsloop.f90   |  2 +-
 flang/test/Lower/OpenMP/parallel.f90  | 24 +--
 flang/test/Lower/OpenMP/simd.f90  |  2 +-
 flang/test/Lower/OpenMP/target.f90| 24 +--
 .../use-device-ptr-to-use-device-addr.f90 |  2 +-
 10 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index b7198c951c8fe..357cc09bfb445 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -997,7 +997,7 @@ bool ClauseProcessor::processEnter(
 }
 
 bool ClauseProcessor::processUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDeviceAddrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl )
@@ -1011,7 +1011,7 @@ bool ClauseProcessor::processUseDeviceAddr(
 }
 
 bool ClauseProcessor::processUseDevicePtr(
-mlir::omp::UseDeviceClauseOps ,
+mlir::omp::UseDevicePtrClauseOps ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl )
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index 78c148ab02163..220ea7b6d9920 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -128,13 +128,13 @@ class ClauseProcessor {
 mlir::omp::ReductionClauseOps ) const;
   bool processTo(llvm::SmallVectorImpl ) 
const;
   bool
-  processUseDeviceAddr(mlir::omp::UseDeviceClauseOps ,
+  processUseDeviceAddr(mlir::omp::UseDeviceAddrClauseOps ,
llvm::SmallVectorImpl ,
llvm::SmallVectorImpl ,
llvm::SmallVectorImpl
) const;
   bool
-  processUseDevicePtr(mlir::omp::UseDeviceClauseOps ,
+  processUseDevicePtr(mlir::omp::UseDevicePtrClauseOps ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl ,
   llvm::SmallVectorImpl
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 44011ad78f2e2..2f612dd6f2fb6 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -239,7 +239,8 @@ 
createAndSetPrivatizedLoopVar(Fortran::lower::AbstractConverter ,
 //  clause. Support for such list items in a use_device_ptr clause
 //  is deprecated."
 static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
-mlir::omp::UseDeviceClauseOps ,
+llvm::SmallVectorImpl ,
+llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl ,
 llvm::SmallVectorImpl
@@ -252,10 +253,9 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
 
   // Iterate over our use_device_ptr list and shift all non-cptr arguments into
   // use_device_addr.
-  for (auto *it = clauseOps.useDevicePtrVars.begin();
-   it != clauseOps.useDevicePtrVars.end();) {
+  for (auto *it = useDevicePtrVars.begin(); it != useDevicePtrVars.end();) {
 if (!fir::isa_builtin_cptr_type(fir::unwrapRefType(it->getType( {
-  clauseOps.useDeviceAddrVars.push_back(*it);
+  useDeviceAddrVars.push_back(*it);
   // We have to shuffle the symbols around as well, to maintain
   // the correct Input -> BlockArg for use_device_ptr/use_device_addr.
   // NOTE: However, as map's do not seem to be included currently
@@ -263,11 +263,11 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
   // future alterations. I believe the reason they are not currently
   // is that the BlockArg assign/lowering needs to be extended
   // to a greater set of types.
-  auto idx = std::distance(clauseOps.useDevicePtrVars.begin(), it);
+  auto idx = std::distance(useDevicePtrVars.begin(), it);
   moveElementToBack(idx, useDeviceTypes);
   moveElementToBack(idx, useDeviceLocs);
   moveElementToBack(idx,