[flang-commits] [flang] c44860c - [Flang][OpenMP] Disable lowering of omp.simd reductions in composites (#112686)
via flang-commits
flang-commits at lists.llvm.org
Mon Oct 21 06:32:27 PDT 2024
Author: Sergio Afonso
Date: 2024-10-21T14:32:21+01:00
New Revision: c44860c8d2582abd88794267b4fa0fa953bbef80
URL: https://github.com/llvm/llvm-project/commit/c44860c8d2582abd88794267b4fa0fa953bbef80
DIFF: https://github.com/llvm/llvm-project/commit/c44860c8d2582abd88794267b4fa0fa953bbef80.diff
LOG: [Flang][OpenMP] Disable lowering of omp.simd reductions in composites (#112686)
Currently, the `omp.simd` operation is ignored during MLIR to LLVM IR
translation when it takes part in a composite construct. One consequence
of this limitation is that any entry block arguments defined by that
operation will trigger a compiler crash if they are used anywhere, as
they are not bound to an LLVM IR value.
A previous PR introducing support for the `reduction` clause resulted in
the creation and use of entry block arguments attached to the `omp.simd`
operation, causing compiler crashes on 'do simd reduction(...)'
constructs.
This patch disables Flang lowering of simd reductions in 'do simd'
constructs to avoid triggering these errors while translation to LLVM IR
is still incomplete.
Added:
Modified:
flang/lib/Lower/OpenMP/OpenMP.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index cf469003b7298d..52a077cd5a797a 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -2209,6 +2209,12 @@ static void genCompositeDistributeParallelDoSimd(
genSimdClauses(converter, semaCtx, simdItem->clauses, loc, simdClauseOps,
simdReductionSyms);
+ // TODO: Remove this after omp.simd reductions on composite constructs are
+ // supported.
+ simdClauseOps.reductionVars.clear();
+ simdClauseOps.reductionByref.clear();
+ simdClauseOps.reductionSyms.clear();
+
mlir::omp::LoopNestOperands loopNestClauseOps;
llvm::SmallVector<const semantics::Symbol *> iv;
genLoopNestClauses(converter, semaCtx, eval, simdItem->clauses, loc,
@@ -2230,9 +2236,7 @@ static void genCompositeDistributeParallelDoSimd(
wsloopOp.setComposite(/*val=*/true);
EntryBlockArgs simdArgs;
- // TODO: Add private syms and vars.
- simdArgs.reduction.syms = simdReductionSyms;
- simdArgs.reduction.vars = simdClauseOps.reductionVars;
+ // TODO: Add private and reduction syms and vars.
auto simdOp =
genWrapperOp<mlir::omp::SimdOp>(converter, loc, simdClauseOps, simdArgs);
simdOp.setComposite(/*val=*/true);
@@ -2325,6 +2329,12 @@ static void genCompositeDoSimd(lower::AbstractConverter &converter,
genSimdClauses(converter, semaCtx, simdItem->clauses, loc, simdClauseOps,
simdReductionSyms);
+ // TODO: Remove this after omp.simd reductions on composite constructs are
+ // supported.
+ simdClauseOps.reductionVars.clear();
+ simdClauseOps.reductionByref.clear();
+ simdClauseOps.reductionSyms.clear();
+
// TODO: Support delayed privatization.
DataSharingProcessor dsp(converter, semaCtx, simdItem->clauses, eval,
/*shouldCollectPreDeterminedSymbols=*/true,
@@ -2348,9 +2358,7 @@ static void genCompositeDoSimd(lower::AbstractConverter &converter,
wsloopOp.setComposite(/*val=*/true);
EntryBlockArgs simdArgs;
- // TODO: Add private syms and vars.
- simdArgs.reduction.syms = simdReductionSyms;
- simdArgs.reduction.vars = simdClauseOps.reductionVars;
+ // TODO: Add private and reduction syms and vars.
auto simdOp =
genWrapperOp<mlir::omp::SimdOp>(converter, loc, simdClauseOps, simdArgs);
simdOp.setComposite(/*val=*/true);
More information about the flang-commits
mailing list