[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
@@ -185,7 +184,12 @@ template bool ClauseProcessor::processMotionClauses( skatrak wrote: Not for this patch, but perhaps we should think about refactoring `processMap` and `processMotionClauses` to avoid code duplication for those parts that are shared betwee

[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
@@ -1177,10 +1178,11 @@ static void genTargetDataClauses( llvm::SmallVectorImpl &useDeviceTypes, llvm::SmallVectorImpl &useDeviceLocs, llvm::SmallVectorImpl &useDeviceSyms) { + llvm::SmallVector mapSyms; skatrak wrote: Changes to this function can

[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
@@ -218,17 +223,34 @@ bool ClauseProcessor::processMotionClauses( // Explicit map captures are captured ByRef by default, // optimisation passes may alter this to ByCopy or other capture // types to optimise - mlir::Value mapOp = createMap

[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 &stmtCtx, mlir::omp::MapClauseOps &result, - llvm::SmallVectorImpl *mapSyms = - nullptr, + llvm::SmallVectorImpl *mapS

[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 &converter, mlir::Value mapOp = createMapInfoOp( firOpBuilder, baseOp.getLoc(), baseOp, mlir::Value{}, name.str(), -bounds, {}, +bounds, {}, mlir::DenseIntElementsAt

[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 &builder, 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 k

[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() + .derivedTypeSpec

[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() + .derivedTypeSpec

[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 &converter, mlir::Value mapOp = createMapInfoOp( firOpBuilder, copyVal.getLoc(), copyVal, mlir::Value{}, name.str(), bounds, llvm::SmallVector{}, +mlir::DenseInt

[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
@@ -0,0 +1,260 @@ +//===- OMPMapInfoFinalization.cpp +//---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Id

[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
@@ -19,7 +19,7 @@ subroutine foo() implicit none - + skatrak wrote: Nit: Accidental change? https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.or

[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
@@ -0,0 +1,260 @@ +//===- OMPMapInfoFinalization.cpp +//---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Id

[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() + .derivedTypeSpec

[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
@@ -218,17 +223,34 @@ bool ClauseProcessor::processMotionClauses( // Explicit map captures are captured ByRef by default, // optimisation passes may alter this to ByCopy or other capture // types to optimise - mlir::Value mapOp = createMap

[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@lists.llvm.

[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 &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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 allo

[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 &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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)); - - combinedInfo.BasePointers.emplace_back(m

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

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

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

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

[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 &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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
@@ -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 allo

[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 &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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)); - - combinedInfo.BasePointers.emplace_back(m

[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)); - - combinedInfo.BasePointers.emplace_back(m

[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 < mapData.MapClause.si

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

[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 &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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 = d

[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 &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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-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][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) Thi

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

[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][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) Thi

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

[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] [flang] [flang][OpenMP] Implement getIterationVariableSymbol helper function,… (PR #90087)

2024-04-30 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you, LGTM. Just a small comment. https://github.com/llvm/llvm-project/pull/90087 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[llvm-branch-commits] [flang] [flang][OpenMP] Implement getIterationVariableSymbol helper function,… (PR #90087)

2024-04-30 Thread Sergio Afonso via llvm-branch-commits
@@ -87,6 +88,27 @@ mlir::Type getLoopVarType(Fortran::lower::AbstractConverter &converter, return converter.getFirOpBuilder().getIntegerType(loopVarTypeSize); } +Fortran::semantics::Symbol * +getIterationVariableSymbol(const Fortran::lower::pft::Evaluation &eval) {

[llvm-branch-commits] [flang] [flang][OpenMP] Implement getIterationVariableSymbol helper function,… (PR #90087)

2024-04-30 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/90087 ___ 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] Pass symTable to all genXYZ functions, NFC (PR #90090)

2024-04-30 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/90090 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-com

[llvm-branch-commits] [flang] [flang][OpenMP] Don't pass clauses to op-generating functions anymore (PR #90108)

2024-05-07 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/90108 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-com

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

2024-05-07 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you Andrew for addressing my concerns, LGTM https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-

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

2024-05-07 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak deleted 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-05-07 Thread Sergio Afonso via llvm-branch-commits
@@ -2122,6 +2124,66 @@ void collectMapDataFromMapOperands(MapInfoData &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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-05-07 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-05-07 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you Andrew for working on my suggestions. LGTM, I just have some minimal nits, but there's no need for another review from me before merging this PR. 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-05-07 Thread Sergio Afonso via llvm-branch-commits
@@ -2122,6 +2124,66 @@ void collectMapDataFromMapOperands(MapInfoData &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + 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-05-07 Thread Sergio Afonso via llvm-branch-commits
@@ -0,0 +1,63 @@ +// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s + +// This test checks the offload sizes, map types and base pointers and pointers +// provided to the OpenMP kernel argument structure are correct when lowering +// to LLVM-IR from MLIR when performing ex

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

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

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

2024-05-07 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() + .derivedTypeSpec

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

2024-05-07 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-05-07 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you Andrew, you've addressed all my concerns so this LGTM. https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://list

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

2024-05-07 Thread Sergio Afonso via llvm-branch-commits
@@ -97,7 +269,7 @@ getOmpObjectSymbol(const Fortran::parser::OmpObject &ompObject) { if (auto *arrayEle = Fortran::parser::Unwrap( designator)) { - sym = GetFirstName(arrayEle->base).symbol; + sy

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

2024-05-07 Thread Sergio Afonso via llvm-branch-commits
@@ -116,6 +119,216 @@ void gatherFuncAndVarSyms( symbolAndClause.emplace_back(clause, *object.id()); } +mlir::omp::MapInfoOp +createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, +mlir::Value baseAddr, mlir::Value varPtrPtr, std::string name, +

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

2024-05-07 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() + .derivedTypeSpec

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

2024-05-07 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() + .derivedTypeSpec

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Support clause-based representation of operations (PR #92519)

2024-05-17 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/92519 Currently, OpenMP operations are defined independently of each other. However, one property of the OpenMP specification is that many clauses can be applied to multiple constructs. Keeping the MLIR representatio

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Add `OpenMP_Clause` tablegen definitions (PR #92521)

2024-05-17 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/92521 This patch adds a new tablegen file for the OpenMP dialect containing the list of clauses currently supported. >From e1aa6cb890dfc8f7f03fade845cff45a163201ff Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: F

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

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Support clause-based representation of operations (PR #92519)

2024-05-17 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: > I like the idea, but also have some questions: > > 1. How does an operation definition look like with all its clauses > defined? Does it have to be repeated for each operation supporting the same > clause(s)? You can see how things would look like in #92523, but I can cop

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Support clause-based representation of operations (PR #92519)

2024-05-17 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: Here's a link to the RFC about this proposal, with links to all related PRs: https://discourse.llvm.org/t/rfc-clause-based-representation-of-openmp-dialect-operations/79053 https://github.com/llvm/llvm-project/pull/92519 ___ llvm-branch

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Add `OpenMP_Clause` tablegen definitions (PR #92521)

2024-05-20 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/92521 >From 7466061b62bb48352696a3890898dcea56f7e509 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Fri, 17 May 2024 10:56:32 +0100 Subject: [PATCH] [MLIR][OpenMP] Add `OpenMP_Clause` tablegen definitions This pat

[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

[llvm-branch-commits] [mlir] [MLIR][OpenMP] Add `OpenMP_Clause` tablegen definitions (PR #92521)

2024-05-20 Thread Sergio Afonso via llvm-branch-commits
@@ -0,0 +1,1183 @@ +//=== OpenMPClauses.td - OpenMP dialect clause definitions -*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[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 https://lists.llvm.org/cg

[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 &eval, const Fortran::parser::OpenMPDeclarativeConstruct &omp) { genOMP(converter, eval, omp); skatrak wrote: Nit: I guess the `symTable` argume

[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 &converter, .t); // Currently only private/firstprivate clause is handled, and // all privatization is done within `omp.section` operations. + symTable.pushScope(); skatrak wrot

[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 &eval, int collapseValue) { skatrak wrote: Nit: I tend to read this function name as meaning "return th

[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 https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-com

[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 https://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 &converter, template static void createBodyOfOp( Op &op, Fortran::lower::AbstractConverter &converter, mlir::Location &loc, -Fortran::lower::pft::Evaluation &eval, +Fortran::lowe

[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 &converter, template static void createBodyOfOp( Op &op, Fortran::lower::AbstractConverter &converter, mlir::Location &loc, -Fortran::lower::pft::Evaluation &eval, +Fortran::lowe

[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@lists.llvm

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

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

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

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

[llvm-branch-commits] [mlir] [mlir][OpenMP] Convert reduction alloc region to LLVMIR (PR #102524)

2024-08-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you, this LGTM. https://github.com/llvm/llvm-project/pull/102524 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-b

[llvm-branch-commits] [flang] [mlir] [flang][OpenMP] use reduction alloc region (PR #102525)

2024-08-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thanks for this work, it LGTM. https://github.com/llvm/llvm-project/pull/102525 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[llvm-branch-commits] [flang] [flang][omp] Emit omp.workshare in frontend (PR #101444)

2024-08-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/101444 ___ 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][omp] Emit omp.workshare in frontend (PR #101444)

2024-08-22 Thread Sergio Afonso via llvm-branch-commits
https://github.com/skatrak approved this pull request. Thank you, LGTM as well. https://github.com/llvm/llvm-project/pull/101444 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llv

[llvm-branch-commits] [flang] [flang][omp] Emit omp.workshare in frontend (PR #101444)

2024-08-22 Thread Sergio Afonso via llvm-branch-commits
@@ -1272,6 +1272,15 @@ static void genTaskwaitClauses(lower::AbstractConverter &converter, loc, llvm::omp::Directive::OMPD_taskwait); } +static void genWorkshareClauses(lower::AbstractConverter &converter, skatrak wrote: Ultra-nit: Move below `genTeams

[llvm-branch-commits] [flang] [flang] Introduce custom loop nest generation for loops in workshare construct (PR #101445)

2024-08-22 Thread Sergio Afonso via llvm-branch-commits
skatrak wrote: > I am debating introducing a new operation workshare_loop_container which > exists only to "contain" a omp.loop_nest between lowering an elemental to > lowering the omp.workshare it is contained in. > > so we would have this state: > > ``` > omp.workshare { > omp.workshare_l

<    1   2   3   4   5   6   7   >