[Lldb-commits] [lldb] [libc] [compiler-rt] [libcxxabi] [flang] [libcxx] [clang-tools-extra] [lld] [clang] [llvm] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)
https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/77758 >From 62f31654ec66fe0e2a27200d0484d3c70d4ce2c1 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Wed, 20 Dec 2023 15:12:04 -0600 Subject: [PATCH 1/5] [Flang][OpenMP] Separate creation of work-sharing and SIMD loops, NFC These two constructs were both handled in `genOMP` for loop constructs. There is some shared code between the two, but there are also enough differences to separate these two cases into individual functions. The shared code may be placed into a helper function later if needed. Recursive lowering [1/5] --- flang/lib/Lower/OpenMP.cpp | 252 ++--- 1 file changed, 153 insertions(+), 99 deletions(-) diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index c3a570bf15ea0d..350cb29121da93 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -2968,24 +2968,150 @@ genOMP(Fortran::lower::AbstractConverter &converter, standaloneConstruct.u); } -static void genOMP(Fortran::lower::AbstractConverter &converter, - Fortran::lower::pft::Evaluation &eval, - Fortran::semantics::SemanticsContext &semanticsContext, - const Fortran::parser::OpenMPLoopConstruct &loopConstruct) { +static void +createSimdLoop(Fortran::lower::AbstractConverter &converter, + Fortran::lower::pft::Evaluation &eval, + llvm::omp::Directive ompDirective, + const Fortran::parser::OmpClauseList &loopOpClauseList, + mlir::Location loc) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); - llvm::SmallVector lowerBound, upperBound, step, linearVars, - linearStepVars, reductionVars; + DataSharingProcessor dsp(converter, loopOpClauseList, eval); + dsp.processStep1(); + + Fortran::lower::StatementContext stmtCtx; mlir::Value scheduleChunkClauseOperand; - mlir::IntegerAttr orderedClauseOperand; + llvm::SmallVector lowerBound, upperBound, step, reductionVars; + llvm::SmallVector iv; + llvm::SmallVector reductionDeclSymbols; + mlir::omp::ClauseOrderKindAttr orderClauseOperand; + std::size_t loopVarTypeSize; + + ClauseProcessor cp(converter, loopOpClauseList); + cp.processCollapse(loc, eval, lowerBound, upperBound, step, iv, + loopVarTypeSize); + cp.processScheduleChunk(stmtCtx, scheduleChunkClauseOperand); + cp.processReduction(loc, reductionVars, reductionDeclSymbols); + cp.processTODO(loc, ompDirective); + + // The types of lower bound, upper bound, and step are converted into the + // type of the loop variable if necessary. + mlir::Type loopVarType = getLoopVarType(converter, loopVarTypeSize); + for (unsigned it = 0; it < (unsigned)lowerBound.size(); it++) { +lowerBound[it] = +firOpBuilder.createConvert(loc, loopVarType, lowerBound[it]); +upperBound[it] = +firOpBuilder.createConvert(loc, loopVarType, upperBound[it]); +step[it] = firOpBuilder.createConvert(loc, loopVarType, step[it]); + } + + llvm::SmallVector alignedVars, nontemporalVars; + mlir::Value ifClauseOperand; + mlir::IntegerAttr simdlenClauseOperand, safelenClauseOperand; + cp.processIf(Fortran::parser::OmpIfClause::DirectiveNameModifier::Simd, + ifClauseOperand); + cp.processSimdlen(simdlenClauseOperand); + cp.processSafelen(safelenClauseOperand); + cp.processTODO(loc, ompDirective); + + mlir::TypeRange resultType; + auto simdLoopOp = firOpBuilder.create( + loc, resultType, lowerBound, upperBound, step, alignedVars, + /*alignment_values=*/nullptr, ifClauseOperand, nontemporalVars, + orderClauseOperand, simdlenClauseOperand, safelenClauseOperand, + /*inclusive=*/firOpBuilder.getUnitAttr()); + createBodyOfOp(simdLoopOp, converter, loc, eval, +&loopOpClauseList, iv, +/*outer=*/false, &dsp); +} + +static void createWsLoop(Fortran::lower::AbstractConverter &converter, + Fortran::lower::pft::Evaluation &eval, + llvm::omp::Directive ompDirective, + const Fortran::parser::OmpClauseList &beginClauseList, + const Fortran::parser::OmpClauseList *endClauseList, + mlir::Location loc) { + fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); + DataSharingProcessor dsp(converter, beginClauseList, eval); + dsp.processStep1(); + + Fortran::lower::StatementContext stmtCtx; + mlir::Value scheduleChunkClauseOperand; + llvm::SmallVector lowerBound, upperBound, step, reductionVars, + linearVars, linearStepVars; + llvm::SmallVector iv; + llvm::SmallVector reductionDeclSymbols; mlir::omp::ClauseOrderKindAttr orderClauseOperand; mlir::omp::ClauseScheduleKindAttr scheduleValClauseOperand; - mlir::omp::ScheduleModifierAttr scheduleModClauseOperand; mlir::UnitAttr
[Lldb-commits] [lldb] [libc] [compiler-rt] [libcxxabi] [flang] [libcxx] [clang-tools-extra] [lld] [clang] [llvm] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)
@@ -3655,8 +3661,7 @@ void Fortran::lower::genOpenMPDeclarativeConstruct( Fortran::lower::pft::Evaluation &eval, const Fortran::parser::OpenMPDeclarativeConstruct &omp) { genOMP(converter, eval, omp); kparzysz wrote: I made all `genOMP` functions have the same interface. That required a small change in Bridge.cpp to pass two extra arguments, and in OpenMP.h to reflect the change in a function header. https://github.com/llvm/llvm-project/pull/77758 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [lld] [clang-tools-extra] [lldb] [compiler-rt] [clang] [libcxx] [flang] [libcxxabi] [libc] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)
kparzysz wrote: Here's link to my comment about symbol table in the thread, followed by response from Valentin: https://discourse.llvm.org/t/openmp-lowering-from-pft-to-fir/75263/49 https://github.com/llvm/llvm-project/pull/77758 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libc] [llvm] [libcxx] [compiler-rt] [lld] [libcxxabi] [lldb] [clang-tools-extra] [flang] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)
@@ -110,6 +110,34 @@ static void gatherFuncAndVarSyms( } } +static Fortran::lower::pft::Evaluation * +getCollapsedEval(Fortran::lower::pft::Evaluation &eval, int collapseValue) { kparzysz wrote: I'll make this change in another commit. https://github.com/llvm/llvm-project/pull/77758 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [lldb] [libcxx] [compiler-rt] [libcxxabi] [lld] [clang-tools-extra] [clang] [flang] [llvm] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)
@@ -110,6 +110,34 @@ static void gatherFuncAndVarSyms( } } +static Fortran::lower::pft::Evaluation * +getCollapsedEval(Fortran::lower::pft::Evaluation &eval, int collapseValue) { + // Return the Evaluation of the innermost collapsed loop, or the current + // evaluation, if there is nothing to collapse. + if (collapseValue == 0) +return &eval; kparzysz wrote: I'll make this change in another commit. https://github.com/llvm/llvm-project/pull/77758 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [clang] [libcxx] [lld] [llvm] [compiler-rt] [lldb] [clang-tools-extra] [libcxxabi] [libc] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)
https://github.com/kparzysz closed https://github.com/llvm/llvm-project/pull/77758 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libc] [llvm] [libcxx] [compiler-rt] [lld] [libcxxabi] [lldb] [clang-tools-extra] [flang] [Flang][OpenMP] Handle SECTION construct from within SECTIONS (PR #77759)
https://github.com/kparzysz edited https://github.com/llvm/llvm-project/pull/77759 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [lldb] [libcxx] [compiler-rt] [libcxxabi] [lld] [clang-tools-extra] [clang] [flang] [llvm] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)
kparzysz wrote: Suggested changed made in https://github.com/llvm/llvm-project/commit/705d9273c5417e04dc542f0e46b90960c235c753. The buildkite times are really long now (7h on Friday), and I didn't want to delay merging of this PR by that much, plus the changes were really minor. https://github.com/llvm/llvm-project/pull/77758 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [clang-tools-extra] [lld] [clang] [compiler-rt] [flang] [libc] [lldb] [libcxx] [libcxxabi] [Flang][OpenMP] Handle SECTION construct from within SECTIONS (PR #77759)
https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/77759 >From 62f31654ec66fe0e2a27200d0484d3c70d4ce2c1 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Wed, 20 Dec 2023 15:12:04 -0600 Subject: [PATCH 1/7] [Flang][OpenMP] Separate creation of work-sharing and SIMD loops, NFC These two constructs were both handled in `genOMP` for loop constructs. There is some shared code between the two, but there are also enough differences to separate these two cases into individual functions. The shared code may be placed into a helper function later if needed. Recursive lowering [1/5] --- flang/lib/Lower/OpenMP.cpp | 252 ++--- 1 file changed, 153 insertions(+), 99 deletions(-) diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index c3a570bf15ea0d..350cb29121da93 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -2968,24 +2968,150 @@ genOMP(Fortran::lower::AbstractConverter &converter, standaloneConstruct.u); } -static void genOMP(Fortran::lower::AbstractConverter &converter, - Fortran::lower::pft::Evaluation &eval, - Fortran::semantics::SemanticsContext &semanticsContext, - const Fortran::parser::OpenMPLoopConstruct &loopConstruct) { +static void +createSimdLoop(Fortran::lower::AbstractConverter &converter, + Fortran::lower::pft::Evaluation &eval, + llvm::omp::Directive ompDirective, + const Fortran::parser::OmpClauseList &loopOpClauseList, + mlir::Location loc) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); - llvm::SmallVector lowerBound, upperBound, step, linearVars, - linearStepVars, reductionVars; + DataSharingProcessor dsp(converter, loopOpClauseList, eval); + dsp.processStep1(); + + Fortran::lower::StatementContext stmtCtx; mlir::Value scheduleChunkClauseOperand; - mlir::IntegerAttr orderedClauseOperand; + llvm::SmallVector lowerBound, upperBound, step, reductionVars; + llvm::SmallVector iv; + llvm::SmallVector reductionDeclSymbols; + mlir::omp::ClauseOrderKindAttr orderClauseOperand; + std::size_t loopVarTypeSize; + + ClauseProcessor cp(converter, loopOpClauseList); + cp.processCollapse(loc, eval, lowerBound, upperBound, step, iv, + loopVarTypeSize); + cp.processScheduleChunk(stmtCtx, scheduleChunkClauseOperand); + cp.processReduction(loc, reductionVars, reductionDeclSymbols); + cp.processTODO(loc, ompDirective); + + // The types of lower bound, upper bound, and step are converted into the + // type of the loop variable if necessary. + mlir::Type loopVarType = getLoopVarType(converter, loopVarTypeSize); + for (unsigned it = 0; it < (unsigned)lowerBound.size(); it++) { +lowerBound[it] = +firOpBuilder.createConvert(loc, loopVarType, lowerBound[it]); +upperBound[it] = +firOpBuilder.createConvert(loc, loopVarType, upperBound[it]); +step[it] = firOpBuilder.createConvert(loc, loopVarType, step[it]); + } + + llvm::SmallVector alignedVars, nontemporalVars; + mlir::Value ifClauseOperand; + mlir::IntegerAttr simdlenClauseOperand, safelenClauseOperand; + cp.processIf(Fortran::parser::OmpIfClause::DirectiveNameModifier::Simd, + ifClauseOperand); + cp.processSimdlen(simdlenClauseOperand); + cp.processSafelen(safelenClauseOperand); + cp.processTODO(loc, ompDirective); + + mlir::TypeRange resultType; + auto simdLoopOp = firOpBuilder.create( + loc, resultType, lowerBound, upperBound, step, alignedVars, + /*alignment_values=*/nullptr, ifClauseOperand, nontemporalVars, + orderClauseOperand, simdlenClauseOperand, safelenClauseOperand, + /*inclusive=*/firOpBuilder.getUnitAttr()); + createBodyOfOp(simdLoopOp, converter, loc, eval, +&loopOpClauseList, iv, +/*outer=*/false, &dsp); +} + +static void createWsLoop(Fortran::lower::AbstractConverter &converter, + Fortran::lower::pft::Evaluation &eval, + llvm::omp::Directive ompDirective, + const Fortran::parser::OmpClauseList &beginClauseList, + const Fortran::parser::OmpClauseList *endClauseList, + mlir::Location loc) { + fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); + DataSharingProcessor dsp(converter, beginClauseList, eval); + dsp.processStep1(); + + Fortran::lower::StatementContext stmtCtx; + mlir::Value scheduleChunkClauseOperand; + llvm::SmallVector lowerBound, upperBound, step, reductionVars, + linearVars, linearStepVars; + llvm::SmallVector iv; + llvm::SmallVector reductionDeclSymbols; mlir::omp::ClauseOrderKindAttr orderClauseOperand; mlir::omp::ClauseScheduleKindAttr scheduleValClauseOperand; - mlir::omp::ScheduleModifierAttr scheduleModClauseOperand; mlir::UnitAttr
[Lldb-commits] [compiler-rt] [libcxx] [libcxxabi] [lldb] [flang] [clang-tools-extra] [libc] [llvm] [clang] [lld] [Flang][OpenMP] Handle SECTION construct from within SECTIONS (PR #77759)
https://github.com/kparzysz closed https://github.com/llvm/llvm-project/pull/77759 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [libcxx] [libcxxabi] [lldb] [flang] [clang-tools-extra] [libc] [llvm] [clang] [lld] [Flang][OpenMP] Handle SECTION construct from within SECTIONS (PR #77759)
kparzysz wrote: > > Introduce createSectionOp > > `genSectionOp`? Yes---fixed the commit message. https://github.com/llvm/llvm-project/pull/77759 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 502c246 - [LLDB] Change getValue to value in NativeRegisterContextFreeBSD_x86_64.cpp
Author: Krzysztof Parzyszek Date: 2022-11-26T08:38:54-06:00 New Revision: 502c246519ec7462450e0b05465063d190cadcb5 URL: https://github.com/llvm/llvm-project/commit/502c246519ec7462450e0b05465063d190cadcb5 DIFF: https://github.com/llvm/llvm-project/commit/502c246519ec7462450e0b05465063d190cadcb5.diff LOG: [LLDB] Change getValue to value in NativeRegisterContextFreeBSD_x86_64.cpp Optional::getValue has been removed. Added: Modified: lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp Removed: diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp index b69cfa7d5d837..5910980a889e9 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp @@ -434,7 +434,7 @@ NativeRegisterContextFreeBSD_x86_64::ReadRegister(const RegisterInfo *reg_info, return error; } - RegSetKind set = opt_set.getValue(); + RegSetKind set = opt_set.value(); error = ReadRegisterSet(set); if (error.Fail()) return error; @@ -500,7 +500,7 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteRegister( return error; } - RegSetKind set = opt_set.getValue(); + RegSetKind set = opt_set.value(); error = ReadRegisterSet(set); if (error.Fail()) return error; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits