[flang-commits] [flang] [Flang][OpenMP] Disable lowering of omp.simd reductions in composites (PR #112686)
via flang-commits
flang-commits at lists.llvm.org
Thu Oct 17 03:09:20 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Sergio Afonso (skatrak)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/112686.diff
1 Files Affected:
- (modified) flang/lib/Lower/OpenMP/OpenMP.cpp (+14-6)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/112686
More information about the flang-commits
mailing list