[llvm-branch-commits] [mlir] [MLIR][OpenMP] Clause-based OpenMP operation definition (PR #92523)

2024-06-06 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: @tblah thanks for giving this a look. Basically the issue here with the reduction clause is that its description is currently different for each operation that accepts it. They are generally quite similar, just not the same. I think the clause is already consistent in terms of h

[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, useDevi

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Clause-based OpenMP operation definition (PR #92523)

2024-06-12 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: Quick update about reduction clause descriptions @tblah: I updated the previous PR on the stack (#92521) to add a shared description that basically incorporates all of the information that was spread across the various operations using it. I updated the description of `omp.taskl

[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

[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-

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Clause-based OpenMP operation definition (PR #92523)

2024-06-26 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: > > I guess fixing byref is on me (#92244). Unfortunately I can't work on this > > immediately so I won't hold up this PR for it. > > @skatrak does #96215 cover everything you need? Thank you for the heads-up, that certainly helps. My plan is to update the PR stack after yours

[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

[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

[llvm-branch-commits] [flang] [Flang][OpenMP] Prevent allocas from being inserted into loop wrappers (PR #97563)

2024-07-03 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/97563 This patch updates the `FirOpBuilder::getAllocaBlock()` method to avoid returning blocks which are part of a region owned by a loop wrapper operation. This avoids introducing `fir.alloca` operations inside of lo

[llvm-branch-commits] [flang] [Flang][OpenMP] NFC: Remove unused argument for omp.target lowering (PR #97564)

2024-07-03 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/97564 This patch removes the `outerCombined` argument from `genTargetOp()` and the `processReduction` argument from `genTargetClauses()`, as they aren't used. >From 83d53c3299de2e7b9874ee0083d180674ab51c30 Mon Sep 17

[llvm-branch-commits] [flang] [Flang][OpenMP] NFC: Share DataSharingProcessor creation logic for all loop directives (PR #97565)

2024-07-03 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/97565 This patch moves the logic associated with the creation of a `DataSharingProcessor` instance for loop-associated OpenMP leaf constructs to the `genOMPDispatch` function, avoiding code duplication for standalone

[llvm-branch-commits] [flang] [Flang][OpenMP] Refactor loop-related lowering for composite support (PR #97566)

2024-07-03 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/97566 This patch splits the lowering for `omp.loop_nest` into its own function and updates lowering for all supported loop wrappers to stop creating this operation themselves. Lowering functions for loop constructs a

[llvm-branch-commits] [flang] [mlir] [Flang][OpenMP] Add lowering support for DO SIMD (PR #97718)

2024-07-04 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/97718 This patch adds support for lowering 'DO SIMD' constructs to MLIR. SIMD information is now stored in an `omp.simd` loop wrapper, which is currently ignored by the OpenMP dialect to LLVM IR translation stage. Th

[llvm-branch-commits] [flang] [mlir] [Flang][OpenMP] Add lowering support for DO SIMD (PR #97718)

2024-07-05 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/97718 >From 27490fbac8e08ed6c11437ef28efd8298fb120b1 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 4 Jul 2024 12:56:43 +0100 Subject: [PATCH 1/2] [Flang][OpenMP] Add lowering support for DO SIMD This patch a

[llvm-branch-commits] [flang] [mlir] [Flang][OpenMP] Add lowering support for DO SIMD (PR #97718)

2024-07-05 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/97718 >From 27490fbac8e08ed6c11437ef28efd8298fb120b1 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 4 Jul 2024 12:56:43 +0100 Subject: [PATCH 1/3] [Flang][OpenMP] Add lowering support for DO SIMD This patch a

[llvm-branch-commits] [flang] [Flang][OpenMP] Add lowering support for DISTRIBUTE SIMD (PR #97819)

2024-07-05 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/97819 This patch adds support for lowering 'DISTRIBUTE SIMD' constructs to MLIR. Translation of `omp.distribute` operations to LLVM IR is still not supported, so its composition with `omp.simd` isn't either. >From 41

[llvm-branch-commits] [flang] [mlir] [Flang][OpenMP] Add lowering support for DO SIMD (PR #97718)

2024-07-08 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/97718 >From 69253a2e1d7a53f4cae907eed30a1c2bdf12c223 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 4 Jul 2024 12:56:43 +0100 Subject: [PATCH] [Flang][OpenMP] Add lowering support for DO SIMD This patch adds

[llvm-branch-commits] [flang] [Flang][OpenMP] Add lowering support for DISTRIBUTE SIMD (PR #97819)

2024-07-08 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/97819 >From 7fc2ea1416a502dae450e16d4da61b2bfbf06a99 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Fri, 5 Jul 2024 12:49:46 +0100 Subject: [PATCH] [Flang][OpenMP] Add lowering support for DISTRIBUTE SIMD This pat

[llvm-branch-commits] [flang] [Flang][OpenMP] Add lowering support for DISTRIBUTE SIMD (PR #97819)

2024-07-09 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/97819 >From a61b3069a400f43eaa4f71e443b8a85c90aea0f0 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Fri, 5 Jul 2024 12:49:46 +0100 Subject: [PATCH] [Flang][OpenMP] Add lowering support for DISTRIBUTE SIMD This pat

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Create `LoopRelatedClause` (PR #99506)

2024-07-18 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/99506 This patch introduces a new OpenMP clause definition not defined by the spec. Its main purpose is to define the `loop_inclusive` (previously "inclusive", renamed according to the parent of this PR in the stack)

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Add missing clauses to OpenMP op definitions (PR #99507)

2024-07-18 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/99507 This patch adds the missing `OpenMP_Clause` definitions to all existing `OpenMP_Op`s and updates their operand structure based builders to initialize the new arguments. The result of this change is that operati

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-18 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/99508 This patch adds the "gen-openmp-clause-ops" `mlir-tblgen` generator to produce the structure definitions previously in OpenMPClauseOperands.h automatically from the information contained in OpenMPOps.td and Open

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-19 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/99508 >From 1d99939c020aab8650cd20df24e0b1e71726ae90 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Jul 2024 13:26:09 +0100 Subject: [PATCH 1/2] [MLIR][OpenMP] Automate operand structure definition This pa

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-19 Thread Sergio Afonso via llvm-branch-commits
@@ -12,11 +12,43 @@ #include "mlir/TableGen/GenInfo.h" +#include "mlir/TableGen/CodeGenHelpers.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/TypeSwitch.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" using namespace llvm; +/// The cod

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-19 Thread Sergio Afonso via llvm-branch-commits
@@ -148,6 +169,110 @@ static void verifyClause(Record *op, Record *clause) { "or explicitly skipping this field."); } +/// Translate the type of an OpenMP clause's argument to its corresponding +/// representation for clause operand structures. +/// +/// All kinds

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-19 Thread Sergio Afonso via llvm-branch-commits
@@ -23,303 +23,31 @@ #define GET_ATTRDEF_CLASSES #include "mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc" +#include "mlir/Dialect/OpenMP/OpenMPClauseOps.h.inc" + namespace mlir { namespace omp { //===--=

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Add omp.target_triples attribute to the OffloadModuleInterface (PR #100154)

2024-07-23 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/100154 The `OffloadModuleInterface` holds getter/setter methods to access OpenMP dialect module-level discardable attributes used to hold general OpenMP compilation information. This patch adds the `omp.target_triple

[llvm-branch-commits] [flang] [Flang][OpenMP] Add frontend support for -fopenmp-targets (PR #100155)

2024-07-23 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/100155 This patch adds support for the `-fopenmp-targets` option to the `bbc` and `flang -fc1` tools. It adds an `OMPTargetTriples` property to the `LangOptions` structure, which is filled with the triples represented

[llvm-branch-commits] [flang] [Flang][OpenMP] Add frontend support for -fopenmp-targets (PR #100155)

2024-07-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/100155 >From 54e52e8a37fd725976e157cd0f9e0221a355dead Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 23 Jul 2024 16:40:18 +0100 Subject: [PATCH 1/2] [Flang][OpenMP] Add frontend support for -fopenmp-targets T

[llvm-branch-commits] [flang] [Flang][OpenMP] Add frontend support for -fopenmp-targets (PR #100155)

2024-07-24 Thread Sergio Afonso via llvm-branch-commits
@@ -894,6 +894,7 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args, /// options accordingly. Returns false if new errors are generated. static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, skatrak wrote:

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-25 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/99508 >From 1d99939c020aab8650cd20df24e0b1e71726ae90 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Jul 2024 13:26:09 +0100 Subject: [PATCH 1/3] [MLIR][OpenMP] Automate operand structure definition This pa

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-25 Thread Sergio Afonso via llvm-branch-commits
@@ -12,11 +12,52 @@ #include "mlir/TableGen/GenInfo.h" +#include "mlir/TableGen/CodeGenHelpers.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/TypeSwitch.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" using namespace llvm; +/// The cod

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-25 Thread Sergio Afonso via llvm-branch-commits
@@ -12,11 +12,52 @@ #include "mlir/TableGen/GenInfo.h" +#include "mlir/TableGen/CodeGenHelpers.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/TypeSwitch.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" using namespace llvm; +/// The cod

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-25 Thread Sergio Afonso via llvm-branch-commits
@@ -408,17 +408,26 @@ class ElementsAttrBase : let storageType = [{ ::mlir::ElementsAttr }]; let returnType = [{ ::mlir::ElementsAttr }]; let convertFromStorage = "$_self"; + + // The underlying C++ value type of each element. + string elementReturnType = ?; ---

[llvm-branch-commits] [flang] [mlir] [MLIR][OpenMP] Create `LoopRelatedClause` (PR #99506)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/99506 >From 96ddba7f30440a83602e8f89d1193813a03dceee Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 16 Jul 2024 15:48:00 +0100 Subject: [PATCH 1/2] [MLIR][OpenMP] Create `LoopRelatedClause` This patch introdu

[llvm-branch-commits] [flang] [mlir] [MLIR][OpenMP] Create `LoopRelatedClause` (PR #99506)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: @Meinersbur I have updated this PR according to our discussion in #99505. Now the loop bounds and steps are now part of the `LoopRelatedClause` and named `loopLowerBounds`, `loopUpperBounds` and `loopSteps`. https://github.com/llvm/llvm-project/pull/99506 ___

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Add missing clauses to OpenMP op definitions (PR #99507)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/99507 >From c80e6f18eabfc05804c1ac5320bf12af756f5b79 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 16 Jul 2024 17:18:13 +0100 Subject: [PATCH] [MLIR][OpenMP] Add missing clauses to OpenMP op definitions This

[llvm-branch-commits] [flang] [mlir] [MLIR][OpenMP] Automate operand structure definition (PR #99508)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/99508 >From 893b8de7264be5c290db38adee66b7e00d4b6fe6 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Jul 2024 13:26:09 +0100 Subject: [PATCH] [MLIR][OpenMP] Automate operand structure definition This patch

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Add omp.target_triples attribute to the OffloadModuleInterface (PR #100154)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/100154 >From 81fddab5c1b5043a477787872c9f18307efaacf6 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 23 Jul 2024 16:32:16 +0100 Subject: [PATCH] [MLIR][OpenMP] Add omp.target_triples attribute to the OffloadM

[llvm-branch-commits] [flang] [Flang][OpenMP] Add frontend support for -fopenmp-targets (PR #100155)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/100155 >From f16bc33e0ac3af52aa33400e3402b1931d16dc33 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 23 Jul 2024 16:40:18 +0100 Subject: [PATCH] [Flang][OpenMP] Add frontend support for -fopenmp-targets This

[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.target_triples (PR #100156)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/100156 >From 9094873e1176b0e8af5065cfc9a7c3fbc12794c0 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 23 Jul 2024 16:53:40 +0100 Subject: [PATCH] [MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.targe

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
@@ -2370,6 +2370,24 @@ static void processMapMembersWithParent( assert(memberDataIdx >= 0 && "could not find mapped member of structure"); +if (checkIfPointerMap(memberClause)) { skatrak wrote: Nit: It would be nice to add a short comment of what's a

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/96265 ___ 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] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-07-26 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you Andrew, this looks reasonable to me, though I'd suggest waiting for another approval before merging. Also, it looks like the flang/test/Integration/OpenMP/map-types-and-sizes.f90 test needs to be updated. https://github.com/llvm

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/96266 ___ 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] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -189,85 +295,60 @@ generateMemberPlacementIndices(const Object &object, indices = llvm::SmallVector{llvm::reverse(indices)}; } -void addChildIndexAndMapToParent( -const omp::Object &object, -std::map> &parentMemberIndices, -mlir::omp::MapInfoOp &mapOp, semanti

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -953,6 +954,22 @@ bool ClauseProcessor::processMap( if (origSymbol && fir::isTypeWithDescriptor(origSymbol.getType())) symAddr = origSymbol; + if (object.sym()->owner().IsDerivedType()) { +omp::ObjectList objectList = gatherObjects

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -203,10 +201,11 @@ bool ClauseProcessor::processMotionClauses(lower::StatementContext &stmtCtx, for (const omp::Object &object : objects) { llvm::SmallVector bounds; std::stringstream asFortran; + std::optional parentObj; - lo

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thank you Andrew for this work, and sorry for the delay getting to it. I've got some comments, most of them nits as usual. https://github.com/llvm/llvm-project/pull/96266 ___ llvm-branch-commits mailing list llvm-

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -52,12 +52,22 @@ using DeclareTargetCapturePair = struct OmpMapMemberIndicesData { // The indices representing the component members placement in its derived // type parents hierarchy. - llvm::SmallVector memberPlacementIndices; + llvm::SmallVector> memberPlacementIndi

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -953,6 +954,22 @@ bool ClauseProcessor::processMap( if (origSymbol && fir::isTypeWithDescriptor(origSymbol.getType())) symAddr = origSymbol; + if (object.sym()->owner().IsDerivedType()) { +omp::ObjectList objectList = gatherObjects

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -280,75 +361,66 @@ void insertChildMapInfoIntoParent( // precedes the children. An alternative, may be to do // delayed generation of map info operations from the clauses and // organize them first before generation. - mapOp->moveAfter(indices.second.b

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -14,14 +14,15 @@ #define FORTRAN_LOWER_SUPPORT_UTILS_H #include "flang/Common/indirection.h" +#include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Parser/char-block.h" #include "flang/Semantics/tools.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -55,6 +55,13 @@ struct IdTyTemplate { return designator == other.designator; } + // defining an "ordering" which allows types derived from this to be + // utilised in maps and other containers that require comparison + // operators for ordering ska

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -189,85 +295,60 @@ generateMemberPlacementIndices(const Object &object, indices = llvm::SmallVector{llvm::reverse(indices)}; } -void addChildIndexAndMapToParent( -const omp::Object &object, -std::map> &parentMemberIndices, -mlir::omp::MapInfoOp &mapOp, semanti

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -85,67 +135,227 @@ class OMPMapInfoFinalizationPass descriptor = alloca; } +return descriptor; + } + + /// Simple function that will generate a FIR operation accessing + /// the descriptors base address (BoxOffsetOp) and then generate a + /// MapInfoOp for

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -85,67 +135,227 @@ class OMPMapInfoFinalizationPass descriptor = alloca; } +return descriptor; + } + + /// Simple function that will generate a FIR operation accessing + /// the descriptors base address (BoxOffsetOp) and then generate a + /// MapInfoOp for

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -189,85 +295,60 @@ generateMemberPlacementIndices(const Object &object, indices = llvm::SmallVector{llvm::reverse(indices)}; } -void addChildIndexAndMapToParent( -const omp::Object &object, -std::map> &parentMemberIndices, -mlir::omp::MapInfoOp &mapOp, semanti

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -671,4 +672,51 @@ static inline bool isEqual(const Fortran::lower::SomeExpr *x, } } // end namespace Fortran::lower +// OpenMP utility functions used in locations outside of the +// OpenMP lowering. +namespace Fortran::lower::omp { + +[[maybe_unused]] static void fillMembe

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -85,67 +135,227 @@ class OMPMapInfoFinalizationPass descriptor = alloca; } +return descriptor; + } + + /// Simple function that will generate a FIR operation accessing + /// the descriptors base address (BoxOffsetOp) and then generate a + /// MapInfoOp for

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -280,75 +361,66 @@ void insertChildMapInfoIntoParent( // precedes the children. An alternative, may be to do // delayed generation of map info operations from the clauses and // organize them first before generation. - mapOp->moveAfter(indices.second.b

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -51,21 +55,66 @@ class OMPMapInfoFinalizationPass : public fir::impl::OMPMapInfoFinalizationPassBase< OMPMapInfoFinalizationPass> { - void genDescriptorMemberMaps(mlir::omp::MapInfoOp op, - fir::FirOpBuilder &builder, -

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -51,21 +55,66 @@ class OMPMapInfoFinalizationPass : public fir::impl::OMPMapInfoFinalizationPassBase< OMPMapInfoFinalizationPass> { - void genDescriptorMemberMaps(mlir::omp::MapInfoOp op, - fir::FirOpBuilder &builder, -

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-07-29 Thread Sergio Afonso via llvm-branch-commits
@@ -85,67 +135,227 @@ class OMPMapInfoFinalizationPass descriptor = alloca; } +return descriptor; + } + + /// Simple function that will generate a FIR operation accessing + /// the descriptors base address (BoxOffsetOp) and then generate a + /// MapInfoOp for

[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.target_triples (PR #100156)

2024-08-01 Thread Sergio Afonso via llvm-branch-commits
@@ -7053,13 +7053,30 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::emitTargetTask( << "\n"); return Builder.saveIP(); } + static void emitTargetCall( OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, OpenMPIRBuilder::InsertPointTy Alloc

[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.target_triples (PR #100156)

2024-08-01 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/100156 >From 366b716e3a192265aed4a1328c49d0ffeef0166d Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 23 Jul 2024 16:53:40 +0100 Subject: [PATCH] [MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.targe

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-08 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/102341 ___ 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] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-08 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thank you for picking up this work. In general it looks good, but apart from some nits I think some improvements can be made to the op verifiers as well. Also, please update mlir/test/Dialect/OpenMP/ops.mlir to add the `omp.composite` attribute to all ops

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-08 Thread Sergio Afonso via llvm-branch-commits
@@ -1796,6 +1810,10 @@ LogicalResult SimdOp::verify() { if (getNestedWrapper()) return emitOpError() << "must wrap an 'omp.loop_nest' directly"; + if (llvm::cast(getOperation()).isComposite()) skatrak wrote: This check is incorrect, since `omp.simd` mi

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-08 Thread Sergio Afonso via llvm-branch-commits
@@ -1546,6 +1546,9 @@ LogicalResult ParallelOp::verify() { if (!isWrapper()) return emitOpError() << "must take a loop wrapper role if nested inside " "of 'omp.distribute'"; +if (!llvm::cast(getOperation()).isComposite())

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-08 Thread Sergio Afonso via llvm-branch-commits
@@ -1749,10 +1755,18 @@ LogicalResult WsloopOp::verify() { return emitOpError() << "must be a loop wrapper"; if (LoopWrapperInterface nested = getNestedWrapper()) { +if (!llvm::cast(getOperation()).isComposite()) + return emitError() + << "'omp.compo

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-08 Thread Sergio Afonso via llvm-branch-commits
@@ -2063,10 +2063,14 @@ static void genCompositeDistributeSimd( // TODO: Populate entry block arguments with private variables. auto distributeOp = genWrapperOp( converter, loc, distributeClauseOps, /*blockArgTypes=*/{}); + llvm::cast(distributeOp.getOperation()) +

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-08 Thread Sergio Afonso via llvm-branch-commits
@@ -1825,11 +1843,17 @@ LogicalResult DistributeOp::verify() { return emitOpError() << "must be a loop wrapper"; if (LoopWrapperInterface nested = getNestedWrapper()) { +if (!llvm::cast(getOperation()).isComposite()) + return emitError() + << "'omp.c

[llvm-branch-commits] [flang] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/102613 After decomposition of OpenMP compound constructs and assignment of applicable clauses to each leaf construct, composite constructs are then combined again into a single element in the construct queue. This hel

[llvm-branch-commits] [flang] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/102613 ___ 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] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/102613 >From aa0403a8a137295345b066cebaab9635e4b9886f Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Fri, 9 Aug 2024 12:58:27 +0100 Subject: [PATCH 1/2] [Flang][OpenMP] Prevent re-composition of composite construc

[llvm-branch-commits] [flang] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/102613 ___ 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] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
@@ -2141,13 +2154,50 @@ static void genCompositeTaskloopSimd( semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval, mlir::Location loc, const ConstructQueue &queue, ConstructQueue::const_iterator item, DataSharingProcessor &dsp) { + assert(std::distan

[llvm-branch-commits] [flang] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
@@ -90,38 +83,33 @@ ConstructQueue buildConstructQueue( Fortran::lower::pft::Evaluation &eval, const parser::CharBlock &source, llvm::omp::Directive compound, const List &clauses) { - List constructs; - ConstructDecomposition decompose(modOp, semaCtx, eval, compoun

[llvm-branch-commits] [flang] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thank you Krzysztof for your comments, they should be addressed now. https://github.com/llvm/llvm-project/pull/102613 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/c

[llvm-branch-commits] [flang] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)

2024-08-09 Thread Sergio Afonso via llvm-branch-commits
@@ -2263,24 +2321,13 @@ static void genOMPDispatch(lower::AbstractConverter &converter, // Composite constructs case llvm::omp::Directive::OMPD_distribute_parallel_do: -genCompositeDistributeParallelDo(converter, symTable, semaCtx, eval, loc, -

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/102341 ___ 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] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you again Akash, this LGTM. I have a couple of minor nits left, but there's no need for another review by me after addressing them. Can you add to ops.mlir an instance of `distribute parallel do/for simd` after line 117? https://gith

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2383,3 +2383,165 @@ func.func @masked_arg_count_mismatch(%arg0: i32, %arg1: i32) { }) : (i32, i32) -> () return } + +// - +func.func @omp_parallel_missing_composite(%lb: index, %ub: index, %step: index) -> () { + omp.distribute { + // expected-error@+1 {{'omp.

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -1748,11 +1754,27 @@ LogicalResult WsloopOp::verify() { if (!isWrapper()) return emitOpError() << "must be a loop wrapper"; + auto wrapper = + llvm::dyn_cast_if_present((*this)->getParentOp()); + bool isCompositeWrapper = wrapper && wrapper.isWrapper() && +

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -1748,11 +1754,27 @@ LogicalResult WsloopOp::verify() { if (!isWrapper()) return emitOpError() << "must be a loop wrapper"; + auto wrapper = + llvm::dyn_cast_if_present((*this)->getParentOp()); + bool isCompositeWrapper = wrapper && wrapper.isWrapper() && -

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -210,7 +210,7 @@ func.func @invalid_nested_wrapper(%lb : index, %ub : index, %step : index) { omp.terminator } skatrak wrote: Nit: Add attribute to `omp.distribute` too. https://github.com/llvm/llvm-project/pull/102341 ___

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -36,9 +36,9 @@ func.func @invalid_nested_wrapper(%lb : index, %ub : index, %step : index) { omp.terminator } skatrak wrote: Nit: I suppose it doesn't matter because the parent op's verifier fails before checking this one, but I think it makes

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2173,7 +2173,7 @@ func.func @omp_distribute_nested_wrapper(%lb: index, %ub: index, %step: index) - "omp.terminator"() : () -> () }) : () -> () skatrak wrote: Nit: Add attribute to `omp.wsloop` too. https://github.com/llvm/llvm-project/pull/10234

[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -1965,7 +1965,7 @@ func.func @taskloop(%lb: i32, %ub: i32, %step: i32) { omp.terminator } skatrak wrote: Nit: Add attribute to `omp.distribute` too. https://github.com/llvm/llvm-project/pull/102341 ___ l

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -1064,16 +1064,15 @@ static void printMapClause(OpAsmPrinter &p, Operation *op, } static ParseResult parseMembersIndex(OpAsmParser &parser, - DenseIntElementsAttr &membersIdx) { - SmallVector values; +

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/96265 ___ 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] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2541,6 +2541,31 @@ static void processMapMembersWithParent( assert(memberDataIdx >= 0 && "could not find mapped member of structure"); +// If we're currently mapping a pointer to a block of data, we must +// initially map the pointer, and then attatch/bind the

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you Andrew for working on my previous comments. I have a couple of suggestions to hopefully help simplify things a bit further, but it LGTM. No need to wait for another look by me before merging. https://github.com/llvm/llvm-project/

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2261,47 +2261,47 @@ static int getMapDataMemberIdx(MapInfoData &mapData, static mlir::omp::MapInfoOp getFirstOrLastMappedMemberPtr(mlir::omp::MapInfoOp mapInfo, bool first) { - mlir::DenseIntElementsAttr indexAttr = mapInfo.getMembersIndexAttr(); - + mlir::ArrayAttr inde

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2541,6 +2541,31 @@ static void processMapMembersWithParent( assert(memberDataIdx >= 0 && "could not find mapped member of structure"); +// If we're currently mapping a pointer to a block of data, we must +// initially map the pointer, and then attatch/bind the

[llvm-branch-commits] [OpenMP][MLIR] Descriptor explicit member map lowering changes (PR #96265)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -1087,50 +1086,31 @@ static ParseResult parseMembersIndex(OpAsmParser &parser, if (failed(parser.parseRSquare())) return failure(); -// Only set once, if any indices are not the same size -// we error out in the next check as that's unsupported -if (s

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/96266 ___ 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] Derived type explicit allocatable member mapping (PR #96266)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -267,6 +267,24 @@ mlir::Block *fir::FirOpBuilder::getAllocaBlock() { return getEntryBlock(); } +static mlir::ArrayAttr makeI64ArrayAttr(llvm::ArrayRef values, +mlir::MLIRContext *context) { + llvm::SmallVector attrs; + for (auto &

[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

2024-08-12 Thread Sergio Afonso via llvm-branch-commits
@@ -175,99 +271,63 @@ getComponentObject(std::optional object, return getComponentObject(baseObj.value(), semaCtx); } -static void -generateMemberPlacementIndices(const Object &object, - llvm::SmallVectorImpl &indices, -

  1   2   3   4   5   6   7   >