Revert "[flang][OpenMP] Lowering support for default clause"This reverts commit 05e6fce84fd39d150195b8928561f2c90c71e538.
[flang][OpenMP] Lowering support for default clauseThis patch adds lowering support for default clause.1. During symbol resolution in semantics, should the enclosing context havea default data s
[flang][OpenMP] Lowering support for default clauseThis patch adds lowering support for default clause.1. During symbol resolution in semantics, should the enclosing context havea default data sharing clause defined and a `parser::Name` is not attachedto an explicit data sharing clause, the`semantics::Symbol::Flag::OmpPrivate` flag (in case of `default(private)`)and `semantics::Symbol::Flag::OmpFirstprivate` flag (in case of`default(firstprivate)`) is added to the symbol.2. During lowering, all symbols having either `semantics::Symbol::Flag::OmpPrivate` or `semantics::Symbol::Flag::OmpFirstprivate` flag are collected and privatised appropriately.Co-authored-by: Peixin Qiao <[email protected]>Reviewed By: kiranchandramohanDifferential Revision: https://reviews.llvm.org/D123930
show more ...
[Flang][OpenMP] Add support for lastprivate clause for worksharing loop.This patch adds an initial support to the lastprivate clause for worksharing loop. The patch creates necessary control flow
[Flang][OpenMP] Add support for lastprivate clause for worksharing loop.This patch adds an initial support to the lastprivate clause for worksharing loop. The patch creates necessary control flow to guarantee the store of the value from the logical last iteration of the workshare loop.Reviewed By: kiranchandramohanDifferential Revision: https://reviews.llvm.org/D130027
[Flang][OpenMP] Initial support for integer reduction in worksharing-loopLower the Flang parse-tree containing OpenMP reductions to the OpenMPdialect. The OpenMP dialect models reductions with,1)
[Flang][OpenMP] Initial support for integer reduction in worksharing-loopLower the Flang parse-tree containing OpenMP reductions to the OpenMPdialect. The OpenMP dialect models reductions with,1) A reduction declaration operation that specifies how to initialize, combine,and atomically combine private reduction variables.2) The OpenMP operation (like wsloop) that supports reductions has an array ofreduction accumulator variables (operands) and an array attribute of the samesize that points to the reduction declaration to be used for the reductionaccumulation.3) The OpenMP reduction operation that takes a value and an accumulator.This operation replaces the original reduction operation in the source.(1) is implemented by the `createReductionDecl` in OpenMP.cpp,(2) is implemented while creating the OpenMP operation,(3) is implemented by the `genOpenMPReduction` function in OpenMP.cpp, andcalled from Bridge.cpp. The implementation of (3) is not very robust.NOTE 1: The patch currently supports only reductions for integer type addition.NOTE 2: Only supports reduction in the worksharing loop.NOTE 3: Does not generate atomic combination region.NOTE 4: Other options for creating the reduction operation includea) having the reduction operation as a construct containing an assignmentand then handling it appropriately in the Bridge.b) we can modify `genAssignment` or `genFIR(AssignmentStmt)` in the Bridge tohandle OpenMP reduction but so far we have tried not to mix OpenMPand non-OpenMP code and this will break that.I will try (b) in a separate patch.NOTE 5: OpenMP dialect gained support for reduction with the patches:D105358, D107343. See https://discourse.llvm.org/t/rfc-openmp-reduction-support/3367for more details.Reviewed By: awarzynskiDifferential Revision: https://reviews.llvm.org/D130077Co-authored-by: Peixin-Qiao <[email protected]>
[flang][OpenMP] Lowering support for atomic update constructThis patch adds lowering support for atomic update construct. A regionis associated with every `omp.atomic.update` operation wherein res
[flang][OpenMP] Lowering support for atomic update constructThis patch adds lowering support for atomic update construct. A regionis associated with every `omp.atomic.update` operation wherein resides:(1) the evaluation of the expression on the RHS of the atomic assignmentstatement, and (2) a `omp.yield` operation that yields the extended valueof expression evaluated in (1).Reviewed By: peixinDifferential Revision: https://reviews.llvm.org/D125668
[flang][OpenMP] Fix firstprivate bugIn case where the bound(s) of a workshare loop use(s) firstprivate var(s), currently, that use is not updated with the created clone. It still uses the shared v
[flang][OpenMP] Fix firstprivate bugIn case where the bound(s) of a workshare loop use(s) firstprivate var(s), currently, that use is not updated with the created clone. It still uses the shared variable. This patch fixes that.Reviewed By: peixinDifferential Revision: https://reviews.llvm.org/D127137
[mlir][OpenMP] Add if clause to OpenMP simd constructThis patch adds if clause to OpenMP TableGen for simd construct.Reviewed By: peixinDifferential Revision: https://reviews.llvm.org/D128940
[mlir][OpenMP] Add if clause to OpenMP simd constructThis patch adds if clause to OpenMP TableGen for simd construct.Reviewed By: peixinDifferential Revision: https://reviews.llvm.org/D128940Signed-off-by: Dominik Adamski <[email protected]>
[NFC][OpenMP] Fix worksharing-loop1. Remove the redundant collapse clause in MLIR OpenMP worksharing-loop operation.2. Fix several typos.3. Refactor the chunk size type conversion since Create
[NFC][OpenMP] Fix worksharing-loop1. Remove the redundant collapse clause in MLIR OpenMP worksharing-loop operation.2. Fix several typos.3. Refactor the chunk size type conversion since CreateSExtOrTrunc has both type check and type conversion.Reviewed By: kiranchandramohanDifferential Revision: https://reviews.llvm.org/D128338
[flang][OpenMP] Initial support the lowering of copyin clauseThis supports the lowering of copyin clause initially. The pointer,allocatable, common block, polymorphic varaibles will be supportedl
[flang][OpenMP] Initial support the lowering of copyin clauseThis supports the lowering of copyin clause initially. The pointer,allocatable, common block, polymorphic varaibles will be supportedlater.This also includes the following changes:1. Resolve the COPYIN clause and make the entity as host associated.2. Fix collectSymbolSet by adding one option to control collecting the symbol itself or ultimate symbol of it so that it can be used explicitly differentiate the host and associated variables in host-association.3. Add one helper function `lookupOneLevelUpSymbol` to differentiate the usage of host and associated variables explicitly. The previous lowering of firstprivate depends on the order of `createHostAssociateVarClone` and `lookupSymbol` of host symbol. With this fix, this dependence is removed.4. Reuse `copyHostAssociateVar` for copying operation of COPYIN clause.Reviewed By: kiranchandramohan, NimishMishraDifferential Revision: https://reviews.llvm.org/D127468
[flang][OpenMP] Fix firstprivate with barrierThis patch fixes the unintentional data race in firstprivateimplementation. There is a Read-Write race when one thread triesto copy the value inside t
[flang][OpenMP] Fix firstprivate with barrierThis patch fixes the unintentional data race in firstprivateimplementation. There is a Read-Write race when one thread triesto copy the value inside the omp.parallel region while otherthread modifies it from inside the region (using pointers orsome other form of indirect access).For detailed discussion please refer to [[ https://discourse.llvm.org/t/issues-with-the-current-implementation-of-privatization-in-openmp-with-fortran/62335 | discourse ]].Reviewed By: kiranchandramohan, peixin, NimishMishraDifferential Revision: https://reviews.llvm.org/D125689
[Flang][OpenMP] Avoid double privatisation of loop variablesLoop variables of a worksharing loop and sequential loops in parallelregion are privatised by default. These variables are marked withO
[Flang][OpenMP] Avoid double privatisation of loop variablesLoop variables of a worksharing loop and sequential loops in parallelregion are privatised by default. These variables are marked withOmpPreDetermined. Skip explicit privatisation of these variables.Note: This is part of upstreaming from the fir-dev branch ofhttps://github.com/flang-compiler/f18-llvm-project.Reviewed By: LeporacanthicusDifferential Revision: https://reviews.llvm.org/D127249Co-authored-by: Jean Perier <[email protected]>Co-authored-by: Mats Petersson <[email protected]>
[Flang][OpenMP] Implementation of lowering of SIMD construct.This patch adds code so that using bbc we are able to see an end-to-end lowering of simd construct in action.Reviewed By: kiranchandra
[Flang][OpenMP] Implementation of lowering of SIMD construct.This patch adds code so that using bbc we are able to see an end-to-end lowering of simd construct in action.Reviewed By: kiranchandramohan, peixin, shraiyshDifferential Revision: https://reviews.llvm.org/D125282
[flang]Add support for do concurrent[flang]Add support for do concurrentUpstreaming from fir-dev on https://github.com/flang-compiler/f18-llvm-projectSupport for concurrent execution in do-loop
[flang]Add support for do concurrent[flang]Add support for do concurrentUpstreaming from fir-dev on https://github.com/flang-compiler/f18-llvm-projectSupport for concurrent execution in do-loops.A selection of tests are also added.Co-authored-by: V Donaldson <[email protected]>Reviewed By: kiranchandramohanDifferential Revision: https://reviews.llvm.org/D127240
[Flang][OpenMP] Lower schedule modifiers for worksharing loopAdd support for lowering the schedule modifiers (simd, monotonic,non-monotonic) in worksharing loops.Note: This is part of upstreamin
[Flang][OpenMP] Lower schedule modifiers for worksharing loopAdd support for lowering the schedule modifiers (simd, monotonic,non-monotonic) in worksharing loops.Note: This is part of upstreaming from the fir-dev branch ofhttps://github.com/flang-compiler/f18-llvm-project.Reviewed By: peixinDifferential Revision: https://reviews.llvm.org/D127311Co-authored-by: Mats Petersson <[email protected]>Co-authored-by: Jean Perier <[email protected]>Co-authored-by: Eric Schweitz <[email protected]>Co-authored-by: V Donaldson <[email protected]>
[Flang,MLIR,OpenMP] Fix a few tests that were not converting to LLVMA few OpenMP tests were retaining the FIR operands even after runningthe LLVM conversion pass. To fix these tests the legality c
[Flang,MLIR,OpenMP] Fix a few tests that were not converting to LLVMA few OpenMP tests were retaining the FIR operands even after runningthe LLVM conversion pass. To fix these tests the legality checkes forOpenMP conversion are made stricter to include operands and results.The Flush, Single and Sections operations are added to conversions orlegality checks. The RegionLessOpConversion is appropriately renamedto clarify that it works only for operations with Variable operands.The operands of the flush operation are changed to match those ofVariable Operands.Fix for an OpenMP issue mentioned inhttps://github.com/llvm/llvm-project/issues/55210.Reviewed By: shraiysh, peixin, awarzynskiDifferential Revision: https://reviews.llvm.org/D127092
[flang][OpenMP] Support lowering parse-tree to MLIR for threadprivate directiveThis supports lowering parse-tree to MLIR for threadprivate directivefollowing the OpenMP 5.1 [2.21.2] standard. Take
[flang][OpenMP] Support lowering parse-tree to MLIR for threadprivate directiveThis supports lowering parse-tree to MLIR for threadprivate directivefollowing the OpenMP 5.1 [2.21.2] standard. Take the following as anexample:```program m integer, save :: i !$omp threadprivate(i) call sub(i) !$omp parallel call sub(i) !$omp end parallelend``````func.func @_QQmain() { %0 = fir.address_of(@_QFEi) : !fir.ref<i32> %1 = omp.threadprivate %0 : !fir.ref<i32> -> !fir.ref<i32> fir.call @_QPsub(%1) : (!fir.ref<i32>) -> () omp.parallel { %2 = omp.threadprivate %0 : !fir.ref<i32> -> !fir.ref<i32> fir.call @_QPsub(%2) : (!fir.ref<i32>) -> () omp.terminator } return}```A threadprivate operation (omp.threadprivate) is created for allreferences to a threadprivate variable. The runtime will appropriatelyreturn a threadprivate var (%1 as above) or its copy (%2 as above)depending on whether it is outside or inside a parallel region. Forthreadprivate access outside the parallel region, the threadprivateoperation is created in instantiateVar. Inside the parallel region, itis created in createBodyOfOp.One new utility function collectSymbolSet is created for collectingall the variables with a property within a evaluation, which may be oneFortran, or OpenMP, or OpenACC construct.Reviewed By: kiranchandramohanDifferential Revision: https://reviews.llvm.org/D124226
[flang] Update tests for opaque pointersThere is still one remaining failure in Lower/forall/character-1.f90.
[flang][OpenMP]Make omp.wsloop arguments appear in memory (#1277)As per issue #1196, the loop induction variable, which is an argumentin the omp.wsloop operation, does not have a memory location,
[flang][OpenMP]Make omp.wsloop arguments appear in memory (#1277)As per issue #1196, the loop induction variable, which is an argumentin the omp.wsloop operation, does not have a memory location, so whenpassed to a function or subroutine, the reference to the value is nota memory location, but the value of the induction variable. The calleefunction/subroutine is then trying to dereference memory at address 1or some other "not a good memory location".This is fixed by creating a temporary memory location and storing thevalue of the induction variable in that.Test fixes as a consequence of the changed code generated.Add checking for some of the omp-unstructured.f90 to check for alloca,store and load operations, to ensure the correct flow. Add a testfor CYCLE inside a omp-do loop.Also convert to use -emit-fir in the omp-unstructrued, and makethe symbol matching consistent in the omp-wsloop-variable test.Reviewed By: peixinDifferential Revision: https://reviews.llvm.org/D126711
[Flang][OpenMP] Fix for unstructured regions in OpenMP constructs - 2The following changes are made for OpenMP operations with unstructured region,1. For combined constructs the outer operation is
[Flang][OpenMP] Fix for unstructured regions in OpenMP constructs - 2The following changes are made for OpenMP operations with unstructured region,1. For combined constructs the outer operation is considered a structuredregion and the inner one as the unstructured.2. Added a condition to ensure that we create new blocks only once for nestedunstructured OpenMP constructs.Tests are added for checking the structure of the CFG.Note: This is part of upstreaming from the fir-dev branch ofhttps://github.com/flang-compiler/f18-llvm-project. Code originally reviewedat https://github.com/flang-compiler/f18-llvm-project/pull/1394.Reviewed By: vdonaldson, shraiysh, peixinDifferential Revision: https://reviews.llvm.org/D126375
[OpenMP] Pass chunk-size to MLIR while lowering from parse-treeTest that chunk size is passed to the static init function.Using three different variations:1. Single constant.2. Expression with c
[OpenMP] Pass chunk-size to MLIR while lowering from parse-treeTest that chunk size is passed to the static init function.Using three different variations:1. Single constant.2. Expression with constants.3. Variable value.Reviewed By: peixin, shraiyshDifferential Revision: https://reviews.llvm.org/D126383
[flang][OpenMP] Fix pointer variables in atomic read/writeFor pointer variables, using getSymbolAddress cannot get the coorectaddress for atomic read/write operands. Use genExprAddr to fix it.Re
[flang][OpenMP] Fix pointer variables in atomic read/writeFor pointer variables, using getSymbolAddress cannot get the coorectaddress for atomic read/write operands. Use genExprAddr to fix it.Reviewed By: shraiysh, NimishMishraDifferential Revision: https://reviews.llvm.org/D125793
[flang][OpenMP][NFC] Cleanup the sections testsThis patch cleans up the sections tests as per the recent effort toseparate integration tests from unit tests.Reviewed By: kiranchandramohan, peixi
[flang][OpenMP][NFC] Cleanup the sections testsThis patch cleans up the sections tests as per the recent effort toseparate integration tests from unit tests.Reviewed By: kiranchandramohan, peixinDifferential Revision: https://reviews.llvm.org/D126368
[Flang][OpenMP] Fixes for unstructured OpenMP codeSince the FIR operations are mostly structured, it is only the functionsthat could contain multiple blocks inside an operation. This changeswith
[Flang][OpenMP] Fixes for unstructured OpenMP codeSince the FIR operations are mostly structured, it is only the functionsthat could contain multiple blocks inside an operation. This changeswith OpenMP since OpenMP regions can contain multiple blocks. Forunstructured code, the blocks are created in advance and belong to thetop-level function. This caused code in OpenMP region to be placed underthe function level.In this fix, if the OpenMP region is unstructured then new blocks arecreated inside it.Note1: This is part of upstreaming from the fir-dev branch ofhttps://github.com/flang-compiler/f18-llvm-project. The code in this patch is asubset of the changes in https://github.com/flang-compiler/f18-llvm-project/pull/1178.Reviewed By: vdonaldsonDifferential Revision: https://reviews.llvm.org/D126293Co-authored-by: Val Donaldson <[email protected]>Co-authored-by: Eric Schweitz <[email protected]>Co-authored-by: Valentin Clement <[email protected]>
[NFC][flang] Change the OpenMP atomic read/write test casesRemove the integration tests and rename the file.Reviewed By: shraiysh, NimishMishraDifferential Revision: https://reviews.llvm.org/D1
[NFC][flang] Change the OpenMP atomic read/write test casesRemove the integration tests and rename the file.Reviewed By: shraiysh, NimishMishraDifferential Revision: https://reviews.llvm.org/D126169
[flang][OpenMP] Fix the types of worksharing-loop variablesThe types of lower bound, upper bound, and step are converted into thetype of the loop variable if necessary. OpenMP runtime requires 32-
[flang][OpenMP] Fix the types of worksharing-loop variablesThe types of lower bound, upper bound, and step are converted into thetype of the loop variable if necessary. OpenMP runtime requires 32-bitor 64-bit loop variables. OpenMP loop iteration variable cannot havemore than 64 bits size and will be narrowed.This patch is part of upstreaming code from the fir-dev branch ofhttps://github.com/flang-compiler/f18-llvm-project. (#1256)Co-authored-by: kiranchandramohan <[email protected]>Reviewed By: kiranchandramohan, shraiyshDifferential Revision: https://reviews.llvm.org/D125740
12