[llvm-branch-commits] [flang] [flang][OpenMP] Convert repeatable clauses (except Map) in ClauseProc… (PR #81623)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: This LGTM, I just have a question on a part of the patch that I wasn't able to fully understand. https://github.com/llvm/llvm-project/pull/81623 ___ llvm-branch-commits mailing list

[llvm-branch-commits] [flang] [flang][OpenMP] Convert repeatable clauses (except Map) in ClauseProc… (PR #81623)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
@@ -2865,53 +2865,45 @@ bool ClauseProcessor::processDepend( llvm::SmallVectorImpl ) const { fir::FirOpBuilder = converter.getFirOpBuilder(); - return findRepeatableClause( - [&](const ClauseTy::Depend *dependClause, + return findRepeatableClause( +

[llvm-branch-commits] [flang] [flang][OpenMP] Convert repeatable clauses (except Map) in ClauseProc… (PR #81623)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/81623 ___ 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] Convert unique clauses in ClauseProcessor (PR #81622)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
@@ -2639,54 +2641,50 @@ bool ClauseProcessor::processFinal(Fortran::lower::StatementContext , } bool ClauseProcessor::processHint(mlir::IntegerAttr ) const { - if (auto *hintClause = findUniqueClause()) { + if (auto *clause = findUniqueClause()) { fir::FirOpBuilder =

[llvm-branch-commits] [flang] [flang][OpenMP] Convert unique clauses in ClauseProcessor (PR #81622)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/81622 ___ 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] Convert unique clauses in ClauseProcessor (PR #81622)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thanks, LGTM. https://github.com/llvm/llvm-project/pull/81622 ___ 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] Convert processTODO and remove unused objects (PR #81627)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: LGTM. https://github.com/llvm/llvm-project/pull/81627 ___ 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] Convert DataSharingProcessor to omp::Clause (PR #81629)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: LGTM, just small comments. https://github.com/llvm/llvm-project/pull/81629 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [flang] [flang][OpenMP] Convert DataSharingProcessor to omp::Clause (PR #81629)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
@@ -1278,14 +1278,15 @@ class DataSharingProcessor { llvm::SetVector symbolsInNestedRegions; llvm::SetVector symbolsInParentRegions; Fortran::lower::AbstractConverter + Fortran::semantics::SemanticsContext skatrak wrote: Do we expect to need it

[llvm-branch-commits] [flang] [flang][OpenMP] Convert DataSharingProcessor to omp::Clause (PR #81629)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
@@ -1384,30 +1386,28 @@ void DataSharingProcessor::copyLastPrivateSymbol( } void DataSharingProcessor::collectOmpObjectListSymbol( -const Fortran::parser::OmpObjectList , +const omp::ObjectList , llvm::SetVector ) { - for (const Fortran::parser::OmpObject :

[llvm-branch-commits] [flang] [flang][OpenMP] Convert DataSharingProcessor to omp::Clause (PR #81629)

2024-02-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/81629 ___ 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] Push genEval calls to individual operations, NFC (PR #77758)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thanks Krzysztof! Just some small comments, but I like the approach. https://github.com/llvm/llvm-project/pull/77758 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/77758 ___ 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] Push genEval calls to individual operations, NFC (PR #77758)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
@@ -3655,8 +3661,7 @@ void Fortran::lower::genOpenMPDeclarativeConstruct( Fortran::lower::pft::Evaluation , const Fortran::parser::OpenMPDeclarativeConstruct ) { genOMP(converter, eval, omp); skatrak wrote: Nit: I guess the `symTable` argument

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
@@ -3358,14 +3396,17 @@ genOMP(Fortran::lower::AbstractConverter , .t); // Currently only private/firstprivate clause is handled, and // all privatization is done within `omp.section` operations. + symTable.pushScope(); skatrak wrote: Why

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
@@ -110,6 +110,32 @@ static void gatherFuncAndVarSyms( } } +static Fortran::lower::pft::Evaluation * +getEvalPastCollapse(Fortran::lower::pft::Evaluation , int collapseValue) { skatrak wrote: Nit: I tend to read this function name as meaning "return the

[llvm-branch-commits] [flang] [Flang][OpenMP] Handle SECTION construct from within SECTIONS (PR #77759)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thanks, LGTM! https://github.com/llvm/llvm-project/pull/77759 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval closer to leaf lowering functions (PR #77760)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: I have just a couple of small comments, thank you again for this work! https://github.com/llvm/llvm-project/pull/77760 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval closer to leaf lowering functions (PR #77760)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/77760 ___ 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] Push genEval closer to leaf lowering functions (PR #77760)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2178,7 +2178,7 @@ createAndSetPrivatizedLoopVar(Fortran::lower::AbstractConverter , template static void createBodyOfOp( Op , Fortran::lower::AbstractConverter , mlir::Location , -Fortran::lower::pft::Evaluation , +Fortran::lower::pft::Evaluation , bool

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval closer to leaf lowering functions (PR #77760)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2178,7 +2178,7 @@ createAndSetPrivatizedLoopVar(Fortran::lower::AbstractConverter , template static void createBodyOfOp( Op , Fortran::lower::AbstractConverter , mlir::Location , -Fortran::lower::pft::Evaluation , +Fortran::lower::pft::Evaluation , bool

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval closer to leaf lowering functions (PR #77760)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
@@ -2248,11 +2248,15 @@ static void createBodyOfOp( if (clauses) ClauseProcessor(converter, *clauses).processCopyin(); } + + if (genNested) +genNestedEvaluations(converter, eval); } static void genBodyOfTargetDataOp( Fortran::lower::AbstractConverter

[llvm-branch-commits] [flang] [Flang][OpenMP] Push genEval closer to leaf lowering functions (PR #77760)

2024-01-12 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/77760 ___ 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] Restructure recursive lowering in `createBodyOfOp` (PR #77761)

2024-01-15 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/77761 ___ 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] Restructure recursive lowering in `createBodyOfOp` (PR #77761)

2024-01-15 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thanks Krzysztof! This looks ok to me, but I suggest waiting for approval from a second reviewer. https://github.com/llvm/llvm-project/pull/77761 ___ llvm-branch-commits mailing list

[llvm-branch-commits] [flang] [Flang][OpenMP] Restructure recursive lowering in `createBodyOfOp` (PR #77761)

2024-01-15 Thread Sergio Afonso via llvm-branch-commits
@@ -0,0 +1,19 @@ +! RUN: bbc -fopenmp -o - %s | FileCheck %s + +! Check that this test can be lowered successfully. +! See https://github.com/llvm/llvm-project/issues/74348 + +! CHECK-LABEL: func.func @_QPsb +! CHECK: omp.parallel skatrak wrote: I think it would

[llvm-branch-commits] [mlir] [flang] [Flang][MLIR][OpenMP] Use function-attached target attributes for OpenMP lowering (PR #78291)

2024-01-16 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/78291 This patch removes the omp.target module attribute, since the information it held on the target CPU and features is available to each function as a function attribute. Target outlining during the MLIR to LLVM

[llvm-branch-commits] [flang] [Flang][Lower] Attach target_cpu and target_features attributes to MLIR functions (PR #78289)

2024-01-16 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/78289 This patch forwards the target CPU and features information from the Flang frontend to MLIR func.func operation attributes, which are later used to populate the target_cpu and target_features llvm.func

[llvm-branch-commits] [mlir] [flang] [Flang][MLIR][OpenMP] Use function-attached target attributes for OpenMP lowering (PR #78291)

2024-01-17 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: > Not for this patch, but would we need to add this info for all outlined > functions? I think it probably should, since otherwise there would be no target information for the new functions. https://github.com/llvm/llvm-project/pull/78291

[llvm-branch-commits] [flang] [Flang][Lower] Attach target_cpu and target_features attributes to MLIR functions (PR #78289)

2024-01-17 Thread Sergio Afonso via llvm-branch-commits
@@ -4290,6 +4291,18 @@ class FirConverter : public Fortran::lower::AbstractConverter { assert(blockId == 0 && "invalid blockId"); assert(activeConstructStack.empty() && "invalid construct stack state"); +// Set target_cpu and target_features attributes to be

[llvm-branch-commits] [mlir] [llvm] [OpenMPIRBuilder][MLIR] Pass target-cpu and target-features to outlined functions (PR #80283)

2024-02-01 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/80283 This patch adds support for forwarding the target-cpu and target-features attributes to functions outlined in the OpenMPIRBuilder. This, in turn, results in the addition of these attributes for functions

[llvm-branch-commits] [flang] [mlir] [MLIR][Flang][OpenMP] Make omp.wsloop into a loop wrapper (PR #88403)

2024-04-16 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: I'm planning to split this into a PR stack after landing #87365, since it's too large to review. However, only the last commit of the stack will compile and pass tests, so they all would have to land simultaneously. I'm open to suggestions on how to best achieve this.

[llvm-branch-commits] [mlir] [MLIR][OpenMP] NFC: Remove LoopControl parsing/printing code (PR #88909)

2024-04-16 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/88909 This patch removes the LoopControl parsing/printing functions that are no longer used after transitioning `omp.simdloop` and `omp.taskloop` into loop wrapper operations. >From

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-18 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/89214 This patch introduces minimal changes to the MLIR to LLVM IR translation of omp.wsloop to support the loop wrapper approach. There is `omp.loop_nest` related translation code that should be extracted and

[llvm-branch-commits] [mlir] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)

2024-04-18 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/89212 This patch makes changes to the `scf.parallel` to `omp.parallel` + `omp.wsloop` lowering pass in order to introduce a nested `omp.loop_nest` as well, and to follow the new loop wrapper role for `omp.wsloop`.

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-18 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/89211 This patch updates verifiers for `omp.ordered.region`, `omp.cancel` and `omp.cancellation_point`, which check for a parent `omp.wsloop`. After transitioning to a loop wrapper-based approach, the expected direct

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-18 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/89211 ___ 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] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-18 Thread Sergio Afonso via llvm-branch-commits
@@ -1977,9 +1977,10 @@ LogicalResult OrderedRegionOp::verify() { if (getSimd()) return failure(); - if (auto container = (*this)->getParentOfType()) { -if (!container.getOrderedValAttr() || -container.getOrderedValAttr().getInt() != 0) + if (auto loopOp =

[llvm-branch-commits] [llvm] [Frontend][OpenMP] Add functions for checking construct type (PR #87258)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/87258 ___ 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] [llvm] [Frontend][OpenMP] Add functions for checking construct type (PR #87258)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
@@ -37,3 +37,29 @@ TEST(Composition, GetCompoundConstruct) { Directive C6 = getCompoundConstruct({OMPD_parallel_for, OMPD_simd}); ASSERT_EQ(C6, OMPD_parallel_for_simd); } + +TEST(Composition, IsLeafConstruct) { + ASSERT_TRUE(isLeafConstruct(OMPD_loop)); +

[llvm-branch-commits] [llvm] [Frontend][OpenMP] Add functions for checking construct type (PR #87258)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
@@ -37,3 +37,29 @@ TEST(Composition, GetCompoundConstruct) { Directive C6 = getCompoundConstruct({OMPD_parallel_for, OMPD_simd}); ASSERT_EQ(C6, OMPD_parallel_for_simd); } + +TEST(Composition, IsLeafConstruct) { + ASSERT_TRUE(isLeafConstruct(OMPD_loop)); +

[llvm-branch-commits] [llvm] [Frontend][OpenMP] Add functions for checking construct type (PR #87258)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. LGTM, just small comments. Thanks! https://github.com/llvm/llvm-project/pull/87258 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/82851 ___ 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] Add new arguments to map_info to help support record type maps (PR #82851)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
@@ -1452,10 +1454,14 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> { - `var_type`: The type of the variable to copy. - `var_ptr_ptr`: Used when the variable copied is a member of a class, structure or derived type and refers to the

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
@@ -990,6 +990,77 @@ static void printMapClause(OpAsmPrinter , Operation *op, } } +static ParseResult parseMembersIndex(OpAsmParser , + DenseIntElementsAttr ) { + SmallVector values; + int64_t value; + int64_t shape[2] = {0, 0}; +

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. This LGTM, I just have some small nits. Thanks Andrew! https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
@@ -1466,6 +1472,8 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> { - 'map_capture_type': Capture type for the variable e.g. this, byref, byvalue, byvla this can affect how the variable is lowered. - `name`: Holds the name of variable as

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/82851 ___ 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] [llvm] [LLVM][OpenMP] Implement getLeafOrCompositeConstructs (PR #89104)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/89104 ___ 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] [llvm] [LLVM][OpenMP] Implement getLeafOrCompositeConstructs (PR #89104)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thank you Krzysztof for working on this. I have a suggestion to simplify the implementation quite a bit, but let me know if you have issues with it. https://github.com/llvm/llvm-project/pull/89104 ___

[llvm-branch-commits] [llvm] [LLVM][OpenMP] Implement getLeafOrCompositeConstructs (PR #89104)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
@@ -25,6 +25,43 @@ using namespace llvm::omp; #define GEN_DIRECTIVES_IMPL #include "llvm/Frontend/OpenMP/OMP.inc" +static iterator_range::iterator> +getFirstCompositeRange(iterator_range::iterator> Leafs) { skatrak wrote: My understanding is that there can

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-04-22 Thread Sergio Afonso via llvm-branch-commits
@@ -1452,10 +1454,14 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> { - `var_type`: The type of the variable to copy. - `var_ptr_ptr`: Used when the variable copied is a member of a class, structure or derived type and refers to the

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thank you Andrew, as usual I have a lot of nits but the overall approach seems reasonable to me. https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2081,6 +2083,79 @@ void collectMapDataFromMapOperands(MapInfoData , } } +static int getMapDataMemberIdx(MapInfoData , + mlir::omp::MapInfoOp memberOp) { + auto *res = llvm::find(mapData.MapClause, memberOp); + assert(res !=

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/82852 ___ 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] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2210,42 +2287,68 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers( // Fortran pointers and allocatables, the mapping of the pointed to // data by the descriptor (which itself, is a structure containing // runtime information on the dynamically

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2081,6 +2083,79 @@ void collectMapDataFromMapOperands(MapInfoData , } } +static int getMapDataMemberIdx(MapInfoData , + mlir::omp::MapInfoOp memberOp) { + auto *res = llvm::find(mapData.MapClause, memberOp); + assert(res !=

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2306,18 +2405,81 @@ static void processMapMembersWithParent( llvm::OpenMPIRBuilder::DeviceInfoTy::None); combinedInfo.Names.emplace_back( LLVM::createMappingInformation(memberClause.getLoc(), ompBuilder)); - -

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2186,6 +2261,9 @@ calculateBoundsOffset(LLVM::ModuleTranslation , // which is utilised in subsequent member mappings (by modifying there map type // with it) to indicate that a member is part of this parent and should be // treated by the runtime as such. Important to

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2210,42 +2287,68 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers( // Fortran pointers and allocatables, the mapping of the pointed to // data by the descriptor (which itself, is a structure containing // runtime information on the dynamically

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2210,42 +2287,68 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers( // Fortran pointers and allocatables, the mapping of the pointed to // data by the descriptor (which itself, is a structure containing // runtime information on the dynamically

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2210,42 +2287,68 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers( // Fortran pointers and allocatables, the mapping of the pointed to // data by the descriptor (which itself, is a structure containing // runtime information on the dynamically

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2081,6 +2083,79 @@ void collectMapDataFromMapOperands(MapInfoData , } } +static int getMapDataMemberIdx(MapInfoData , + mlir::omp::MapInfoOp memberOp) { + auto *res = llvm::find(mapData.MapClause, memberOp); + assert(res !=

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -1977,9 +1977,10 @@ LogicalResult OrderedRegionOp::verify() { if (getSimd()) return failure(); - if (auto container = (*this)->getParentOfType()) { -if (!container.getOrderedValAttr() || -container.getOrderedValAttr().getInt() != 0) + if (auto loopOp =

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2210,42 +2287,68 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers( // Fortran pointers and allocatables, the mapping of the pointed to // data by the descriptor (which itself, is a structure containing // runtime information on the dynamically

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2081,6 +2083,79 @@ void collectMapDataFromMapOperands(MapInfoData , } } +static int getMapDataMemberIdx(MapInfoData , + mlir::omp::MapInfoOp memberOp) { + auto *res = llvm::find(mapData.MapClause, memberOp); + assert(res !=

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2306,18 +2405,81 @@ static void processMapMembersWithParent( llvm::OpenMPIRBuilder::DeviceInfoTy::None); combinedInfo.Names.emplace_back( LLVM::createMappingInformation(memberClause.getLoc(), ompBuilder)); - -

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2306,18 +2405,81 @@ static void processMapMembersWithParent( llvm::OpenMPIRBuilder::DeviceInfoTy::None); combinedInfo.Names.emplace_back( LLVM::createMappingInformation(memberClause.getLoc(), ompBuilder)); - -

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2283,16 +2386,12 @@ static void processMapMembersWithParent( for (auto mappedMembers : parentClause.getMembers()) { auto memberClause = mlir::dyn_cast(mappedMembers.getDefiningOp()); -int memberDataIdx = -1; -for (size_t i = 0; i <

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -33,6 +33,8 @@ #include "llvm/Transforms/Utils/ModuleUtils.h" #include +#include +#include skatrak wrote: Maybe not needed if `std::iota` call is removed? https://github.com/llvm/llvm-project/pull/82852 ___

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -2081,6 +2083,79 @@ void collectMapDataFromMapOperands(MapInfoData , } } +static int getMapDataMemberIdx(MapInfoData , + mlir::omp::MapInfoOp memberOp) { + auto *res = llvm::find(mapData.MapClause, memberOp); + assert(res !=

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89214 >From 25dc3a45645ab2310606b2ab02346eed700c7f97 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 11:07:10 +0100 Subject: [PATCH] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5)

[llvm-branch-commits] [mlir] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89212 >From fdee8cf17cd7d2dbdb6cf872574776f02e70be7c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 10:55:16 +0100 Subject: [PATCH 1/2] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5)

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/89211 ___ 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] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/89214 ___ 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] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89214 >From 25dc3a45645ab2310606b2ab02346eed700c7f97 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 11:07:10 +0100 Subject: [PATCH] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5)

[llvm-branch-commits] [mlir] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89212 >From fdee8cf17cd7d2dbdb6cf872574776f02e70be7c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 10:55:16 +0100 Subject: [PATCH 1/2] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5)

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89211 >From f9b14e37a6f437768c405291c064f541f0655b1c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Apr 2024 16:40:03 +0100 Subject: [PATCH 1/2] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89211 >From f9b14e37a6f437768c405291c064f541f0655b1c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Apr 2024 16:40:03 +0100 Subject: [PATCH 1/2] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
@@ -2081,6 +2083,79 @@ void collectMapDataFromMapOperands(MapInfoData , } } +static int getMapDataMemberIdx(MapInfoData , + mlir::omp::MapInfoOp memberOp) { + auto *res = llvm::find(mapData.MapClause, memberOp); + assert(res !=

[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-04-24 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/82852 ___ 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] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89211 >From f9b14e37a6f437768c405291c064f541f0655b1c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Apr 2024 16:40:03 +0100 Subject: [PATCH 1/2] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
@@ -1977,9 +1977,10 @@ LogicalResult OrderedRegionOp::verify() { if (getSimd()) return failure(); - if (auto container = (*this)->getParentOfType()) { -if (!container.getOrderedValAttr() || -container.getOrderedValAttr().getInt() != 0) + if (auto loopOp =

[llvm-branch-commits] [mlir] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89212 >From fdee8cf17cd7d2dbdb6cf872574776f02e70be7c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 10:55:16 +0100 Subject: [PATCH 1/2] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5)

[llvm-branch-commits] [mlir] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
@@ -461,18 +461,51 @@ struct ParallelOpLowering : public OpRewritePattern { // Replace the loop. { OpBuilder::InsertionGuard allocaGuard(rewriter); -auto loop = rewriter.create( +// Create worksharing loop wrapper. +auto wsloopOp =

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89214 >From 25dc3a45645ab2310606b2ab02346eed700c7f97 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 11:07:10 +0100 Subject: [PATCH] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5)

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
@@ -916,49 +916,50 @@ static LogicalResult inlineReductionCleanup( static LogicalResult convertOmpWsloop(Operation , llvm::IRBuilderBase , LLVM::ModuleTranslation ) { - auto loop = cast(opInst); - const bool isByRef = loop.getByref(); + auto wsloopOp =

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
@@ -1008,33 +1009,34 @@ convertOmpWsloop(Operation , llvm::IRBuilderBase , auto bodyGen = [&](llvm::OpenMPIRBuilder::InsertPointTy ip, llvm::Value *iv) { // Make sure further conversions know about the induction variable. moduleTranslation.mapValue( -

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
@@ -379,14 +385,16 @@ llvm.func @body(i32) // CHECK-LABEL: @test_omp_wsloop_static_defchunk llvm.func @test_omp_wsloop_static_defchunk(%lb : i32, %ub : i32, %step : i32) -> () { - omp.wsloop schedule(static) - for (%iv) : i32 = (%lb) to (%ub) step (%step) { - // CHECK:

[llvm-branch-commits] [flang] [Flang][OpenMP][Lower] Update workshare-loop lowering (5/5) (PR #89215)

2024-04-19 Thread Sergio Afonso via llvm-branch-commits
@@ -369,7 +369,9 @@ getDeclareTargetFunctionDevice( static llvm::SmallVector skatrak wrote: Done. I also simplified it a bit, since the return value wasn't necessary. https://github.com/llvm/llvm-project/pull/89215

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -115,8 +115,7 @@ class ClauseProcessor { bool processMap( mlir::Location currentLocation, Fortran::lower::StatementContext , mlir::omp::MapClauseOps , - llvm::SmallVectorImpl *mapSyms = - nullptr, + llvm::SmallVectorImpl *mapSyms,

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -1664,7 +1667,7 @@ genTargetOp(Fortran::lower::AbstractConverter , mlir::Value mapOp = createMapInfoOp( firOpBuilder, baseOp.getLoc(), baseOp, mlir::Value{}, name.str(), -bounds, {}, +bounds, {}, mlir::DenseIntElementsAttr{},

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -811,9 +811,10 @@ mlir::omp::MapInfoOp createMapInfoOp(fir::FirOpBuilder , mlir::Location loc, skatrak wrote: It looks like this function belongs in Utils.cpp, rather than here. I suppose that change doesn't belong in this PR, but it's something to keep in

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -88,6 +91,175 @@ void gatherFuncAndVarSyms( symbolAndClause.emplace_back(clause, *object.id()); } +int getComponentPlacementInParent( +const Fortran::semantics::Symbol *componentSym) { + const auto *derived = + componentSym->owner() +

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -88,6 +91,175 @@ void gatherFuncAndVarSyms( symbolAndClause.emplace_back(clause, *object.id()); } +int getComponentPlacementInParent( +const Fortran::semantics::Symbol *componentSym) { + const auto *derived = + componentSym->owner() +

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -966,6 +966,7 @@ genBodyOfTargetOp(Fortran::lower::AbstractConverter , mlir::Value mapOp = createMapInfoOp( firOpBuilder, copyVal.getLoc(), copyVal, mlir::Value{}, name.str(), bounds, llvm::SmallVector{}, +

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/82853 ___ 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][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -903,24 +908,39 @@ bool ClauseProcessor::processMap( // Explicit map captures are captured ByRef by default, // optimisation passes may alter this to ByCopy or other capture // types to optimise - mlir::Value mapOp = createMapInfoOp( +

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak commented: Thank you for all the work here Andrew, I've got some comments but they should be relatively easy to address. https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list

[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-04-23 Thread Sergio Afonso via llvm-branch-commits
@@ -903,24 +908,39 @@ bool ClauseProcessor::processMap( // Explicit map captures are captured ByRef by default, // optimisation passes may alter this to ByCopy or other capture // types to optimise - mlir::Value mapOp = createMapInfoOp( +

  1   2   >