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

2024-05-20 Thread Tom Eccles 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:

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

2024-04-26 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. LG. Thanks for the cleanup https://github.com/llvm/llvm-project/pull/90108 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [flang] [flang][OpenMP] Pass symTable to all genXYZ functions, NFC (PR #90090)

2024-04-26 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/90090 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

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

2024-04-26 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. LG 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] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)

2024-04-23 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. LGTM. I'm sorry this fell off my radar https://github.com/llvm/llvm-project/pull/89211 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

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

2024-04-18 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. LGTM 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][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)

2024-04-18 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/89212 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

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

2024-04-18 Thread Tom Eccles 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] [flang] [flang][OpenMP] lower reductions of assumed shape arrays (PR #86982)

2024-03-28 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/86982 Patch 1: https://github.com/llvm/llvm-project/pull/86978 Patch 2: https://github.com/llvm/llvm-project/pull/86979 >From 9f68c844b6f4c4a52002cd9d90cd158b10e64bf2 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Tue,

[llvm-branch-commits] [mlir] [mlir][OpenMP] map argument to reduction initialization region (PR #86979)

2024-03-28 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah edited https://github.com/llvm/llvm-project/pull/86979 ___ 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] map argument to reduction initialization region (PR #86979)

2024-03-28 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/86979 The argument to the initialization region of reduction declarations was never mapped. This meant that if this argument was accessed inside the initialization region, that mlir operation would be translated to an

[llvm-branch-commits] [mlir] [mlir][LLVM] erase call mappings in forgetMapping() (PR #84955)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
tblah wrote: Sorry about the force push. Github wasn't showing the new commit (02550e1). It is just a rebase onto the target branch. https://github.com/llvm/llvm-project/pull/84955 ___ llvm-branch-commits mailing list

[llvm-branch-commits] [mlir] [mlir][LLVM] erase call mappings in forgetMapping() (PR #84955)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84955 >From 0b2f5fee61d170b0a2197fd5da92f0e84b3b14f4 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Wed, 21 Feb 2024 14:22:39 + Subject: [PATCH 1/3] [mlir][LLVM] erase call mappings in forgetMapping() It looks like

[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
@@ -92,10 +93,42 @@ std::string ReductionProcessor::getReductionName(llvm::StringRef name, if (isByRef) byrefAddition = "_byref"; - return (llvm::Twine(name) + - (ty.isIntOrIndex() ? llvm::Twine("_i_") : llvm::Twine("_f_")) + -

[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84958 >From bd668cd95d95d1e5b9c8436875c14878c98902ff Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Mon, 12 Feb 2024 14:03:00 + Subject: [PATCH 1/5] [flang][OpenMP] lower simple array reductions This has been

[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84958 >From bd668cd95d95d1e5b9c8436875c14878c98902ff Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Mon, 12 Feb 2024 14:03:00 + Subject: [PATCH 1/4] [flang][OpenMP] lower simple array reductions This has been

[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
@@ -92,10 +93,42 @@ std::string ReductionProcessor::getReductionName(llvm::StringRef name, if (isByRef) byrefAddition = "_byref"; - return (llvm::Twine(name) + - (ty.isIntOrIndex() ? llvm::Twine("_i_") : llvm::Twine("_f_")) + -

[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
@@ -0,0 +1,74 @@ +! RUN: bbc -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s +! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s + +program reduce +integer, dimension(3) :: i = 0 + +!$omp parallel reduction(+:i) +i(1) = 1 +i(2) = 2 +i(3) = 3

[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-18 Thread Tom Eccles via llvm-branch-commits
@@ -283,13 +316,166 @@ mlir::Value ReductionProcessor::createScalarCombiner( return reductionOp; } +/// Create reduction combiner region for reduction variables which are boxed +/// arrays +static void genBoxCombiner(fir::FirOpBuilder , mlir::Location loc, +

[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-15 Thread Tom Eccles via llvm-branch-commits
@@ -390,15 +559,35 @@ void ReductionProcessor::addReductionDecl( // initial pass to collect all recuction vars so we can figure out if this // should happen byref + fir::FirOpBuilder = converter.getFirOpBuilder(); for (const Fortran::parser::OmpObject :

[llvm-branch-commits] [mlir] [mlir][LLVM] erase call mappings in forgetMapping() (PR #84955)

2024-03-15 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84955 >From c62b31262bc619145866a304e10925a35462f5bf Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Wed, 21 Feb 2024 14:22:39 + Subject: [PATCH 1/2] [mlir][LLVM] erase call mappings in forgetMapping() It looks like

[llvm-branch-commits] [flang] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (PR #84954)

2024-03-15 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84954 >From f951d16cf6cb1ab221f47ca2e712020b9af0af87 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Fri, 1 Mar 2024 16:59:09 + Subject: [PATCH 1/5] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops

[llvm-branch-commits] [flang] [flang] run CFG conversion on omp reduction declare ops (PR #84953)

2024-03-15 Thread Tom Eccles via llvm-branch-commits
tblah wrote: > Wouldn't applying the patterns on the module in a single pass work here as > well? Yes that would work but we would loose parallelism. I wanted to keep that because there was talk in the past about breaking up the existing Module passes so that different functions (or other

[llvm-branch-commits] [flang] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (PR #84954)

2024-03-14 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84954 >From f951d16cf6cb1ab221f47ca2e712020b9af0af87 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Fri, 1 Mar 2024 16:59:09 + Subject: [PATCH 1/4] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops

[llvm-branch-commits] [flang] [flang] run CFG conversion on omp reduction declare ops (PR #84953)

2024-03-14 Thread Tom Eccles via llvm-branch-commits
tblah wrote: > Wouldn't it be cleaner to expose the patterns via a > `populateFirCfgConversionPatterns` function and reuse it in you extra pass > instead of making two pass from the initial file? > > We did this recently for the FirToLLVM patterns. #83492 Thanks for taking a look at this. I

[llvm-branch-commits] [flang] [flang] run CFG conversion on omp reduction declare ops (PR #84953)

2024-03-14 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84953 >From 192da3c05fd8c0759f280e0895ffc2f09b2203e4 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Thu, 15 Feb 2024 12:12:29 + Subject: [PATCH 1/2] [flang] run CFG conversion on omp reduction declare ops Most FIR

[llvm-branch-commits] [flang] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (PR #84954)

2024-03-14 Thread Tom Eccles via llvm-branch-commits
@@ -319,6 +320,10 @@ class CodeGenRewrite : public fir::impl::CodeGenRewriteBase { runOn(func, func.getBody()); for (auto global : mod.getOps()) runOn(global, global.getRegion()); +for (auto omp : mod.getOps()) { tblah wrote: Good idea.

[llvm-branch-commits] [flang] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (PR #84954)

2024-03-14 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84954 >From f951d16cf6cb1ab221f47ca2e712020b9af0af87 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Fri, 1 Mar 2024 16:59:09 + Subject: [PATCH 1/3] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops

[llvm-branch-commits] [flang] [flang][OpenMP] Convert processTODO and remove unused objects (PR #81627)

2024-03-13 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/81627 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

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

2024-03-13 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. Thanks for explaining. LGTM https://github.com/llvm/llvm-project/pull/81623 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [flang] [flang] support fir.alloca operations inside of omp reduction ops (PR #84952)

2024-03-13 Thread Tom Eccles via llvm-branch-commits
@@ -410,8 +410,15 @@ class FIROpConversion : public mlir::ConvertOpToLLVMPattern { mlir::ConversionPatternRewriter ) const { auto thisPt = rewriter.saveInsertionPoint(); mlir::Operation *parentOp = rewriter.getInsertionBlock()->getParentOp(); -mlir::Block

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

2024-03-12 Thread Tom Eccles via llvm-branch-commits
@@ -181,45 +172,41 @@ genDependKindAttr(fir::FirOpBuilder , pbKind); } -static mlir::Value getIfClauseOperand( -Fortran::lower::AbstractConverter , -const Fortran::parser::OmpClause::If *ifClause, -

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

2024-03-12 Thread Tom Eccles via llvm-branch-commits
@@ -181,45 +172,41 @@ genDependKindAttr(fir::FirOpBuilder , pbKind); } -static mlir::Value getIfClauseOperand( -Fortran::lower::AbstractConverter , -const Fortran::parser::OmpClause::If *ifClause, -

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

2024-03-12 Thread Tom Eccles via llvm-branch-commits
@@ -87,50 +87,44 @@ getSimdModifier(const omp::clause::Schedule ) { static void genAllocateClause(Fortran::lower::AbstractConverter , - const Fortran::parser::OmpAllocateClause , + const omp::clause::Allocate ,

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

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. 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] lower simple array reductions (PR #84958)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah edited https://github.com/llvm/llvm-project/pull/84958 ___ 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][NFC] move extractSequenceType helper out of OpenACC to share code (PR #84957)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah edited https://github.com/llvm/llvm-project/pull/84957 ___ 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][LLVM] erase call mappings in forgetMapping() (PR #84955)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah edited https://github.com/llvm/llvm-project/pull/84955 ___ 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][CodeGen] Run PreCGRewrite on omp reduction declare ops (PR #84954)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah edited https://github.com/llvm/llvm-project/pull/84954 ___ 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] run CFG conversion on omp reduction declare ops (PR #84953)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah edited https://github.com/llvm/llvm-project/pull/84953 ___ 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] support fir.alloca operations inside of omp reduction ops (PR #84952)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah edited https://github.com/llvm/llvm-project/pull/84952 ___ 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] lower simple array reductions (PR #84958)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/84958 This has been tested with arrays with compile-time constant bounds. Allocatable arrays and arrays with non-constant bounds are not yet supported. User-defined reduction functions are also not yet supported. The

[llvm-branch-commits] [flang] [flang][NFC] move extractSequenceType helper out of OpenACC to share code (PR #84957)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/84957 Moving extractSequenceType to FIRType.h so that this can also be used from OpenMP. OpenMP array reductions 5/6 >From 2ff12fa0a580cb060f208d173d9af72bfa49d3b2 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Fri,

[llvm-branch-commits] [mlir] [mlir][LLVM] erase call mappings in forgetMapping() (PR #84955)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/84955 It looks like the mappings for call instructions were forgotten here. This fixes a bug in OpenMP when in-lining a region containing call operations multiple times. OpenMP array reductions 4/6 >From

[llvm-branch-commits] [flang] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (PR #84954)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/84954 OpenMP reduction declare operations can contain FIR code which needs to be lowered to LLVM. With array reductions, these regions can contain more complicated operations which need PreCGRewriting. A similar extra

[llvm-branch-commits] [flang] [flang] run CFG conversion on omp reduction declare ops (PR #84953)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/84953 Most FIR passes only look for FIR operations inside of functions (either because they run only on func.func or they run on the module but iterate over functions internally). But there can also be FIR operations

[llvm-branch-commits] [flang] [flang] support fir.alloca operations inside of omp reduction ops (PR #84952)

2024-03-12 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/84952 Advise to place the alloca at the start of the first block of whichever region (init or combiner) we are currently inside. It probably isn't safe to put an alloca inside of a combiner region because this will be

[llvm-branch-commits] [flang] [flang][TBAABuilder] not all loads and stores are inside of functions (PR #84305)

2024-03-07 Thread Tom Eccles via llvm-branch-commits
tblah wrote: Next PR in the series https://github.com/llvm/llvm-project/pull/84304 https://github.com/llvm/llvm-project/pull/84305 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [flang] [flang][TBAABuilder] not all loads and stores are inside of functions (PR #84305)

2024-03-07 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/84305 TBAA builder assumed that all loads/stores are inside of functions and hit an assertion once it found loads and stores inside of an omp::ReductionDeclareOp. For now just don't add TBAA tags to those loads and

[llvm-branch-commits] [flang] [llvm] [mlir] [flang][OpenMP][OMPIRBuilder][mlir] Optionally pass reduction vars by ref (PR #84304)

2024-03-07 Thread Tom Eccles via llvm-branch-commits
tblah wrote: co-authored with @Leporacanthicus (github seems to have taken the tag out of the commit message but shows it in the UI) https://github.com/llvm/llvm-project/pull/84304 ___ llvm-branch-commits mailing list

[llvm-branch-commits] [flang] [mlir] [mlir][flang][openmp] Rework wsloop reduction operations (PR #80019)

2024-02-08 Thread Tom Eccles via llvm-branch-commits
https://github.com/tblah approved this pull request. Thanks for the update! https://github.com/llvm/llvm-project/pull/80019 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [mlir] [flang] [mlir][flang][openmp] Rework wsloop reduction operations (PR #80019)

2024-02-05 Thread Tom Eccles via llvm-branch-commits
@@ -398,11 +400,39 @@ struct ParallelOpLowering : public OpRewritePattern { // Replace the reduction operations contained in this loop. Must be done // here rather than in a separate pattern to have access to the list of // reduction variables. +unsigned int

[llvm-branch-commits] [mlir] [flang] [mlir][flang][openmp] Rework wsloop reduction operations (PR #80019)

2024-02-05 Thread Tom Eccles via llvm-branch-commits
@@ -398,11 +400,39 @@ struct ParallelOpLowering : public OpRewritePattern { // Replace the reduction operations contained in this loop. Must be done // here rather than in a separate pattern to have access to the list of // reduction variables. +unsigned int

[llvm-branch-commits] [mlir] [flang] [mlir][flang][openmp] Rework wsloop reduction operations (PR #80019)

2024-02-05 Thread Tom Eccles via llvm-branch-commits
tblah wrote: Please could you update the documentation for reductions on line 442 - I presume we don't want to encourage `omp.reduction` operations anymore https://github.com/llvm/llvm-project/pull/80019 ___