1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

161 Commits

Author SHA1 Message Date
Michael Kruse
930857b772 [OpenMPIRBuilder] Implement collapseLoops.
The collapseLoops method implements a transformations facilitating the implementation of the collapse-clause. It takes a list of loops from a loop nest and reduces it to a single loop that can be used by other methods that are implemented on just a single loop, such as createStaticWorkshareLoop.

This patch shares some changes with D92974 (such as adding some getters to CanonicalLoopNest), used by both patches.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D93268
2021-02-03 19:12:02 -06:00
Valentin Clement
f7b64e36c0 [flang][openacc] Allow multiple wait clauses
kernels loop and enter data had a too restrictive constraint for the wait clause.
The wait clause is allowed multiple times and not only once. This patch fix this problem.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D95469
2021-01-27 13:18:46 -05:00
Valentin Clement
1973b57fb0 [flang][openacc] Fix clause restriction for exit data directive
Restriction on clauses for the EXIT DATA directive were not fully correct.
This patch fixes the situation. The async, if and finalize clauses are allowed
only once.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D95470
2021-01-27 10:07:19 -05:00
Valentin Clement
202f767031 [flang][openacc] Fix clause restriction for host_data directive
Restriction on clauses for the HOST_DATA directive were not fully correct.
This patch fixes the situation. The if and if_present clauses are allowed
only once.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D95473
2021-01-27 10:06:33 -05:00
Michael Kruse
d945273b52 [OpenMPIRBuilder] Implement tileLoops.
The  tileLoops method implements the code generation part of the tile directive introduced in OpenMP 5.1. It takes a list of loops forming a loop nest, tiles it, and returns the CanonicalLoopInfo representing the generated loops.

The implementation takes n CanonicalLoopInfos, n tile size Values and returns 2*n new CanonicalLoopInfos. The input CanonicalLoopInfos are invalidated and BBs not reused in the new loop nest removed from the function.

In a modified version of D76342, I was able to correctly compile and execute a tiled loop nest.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D92974
2021-01-23 19:39:29 -06:00
Joseph Huber
627ae5f2d2 [OpenMP] Add support for mapping names in mapper API
Summary:
The custom mapper API did not previously support the mapping names added previously. This means they were not present if a user requested debugging information while using the mapper functions. This adds basic support for passing the mapped names to the runtime library.

Reviewers: jdoerfert

Differential Revision: https://reviews.llvm.org/D94806
2021-01-21 09:26:44 -05:00
Valentin Clement
715d713b9e [flang][directive] Get rid of flangClassValue in TableGen
The TableGen emitter for directives has two slots for flangClass information and this was mainly
to be able to keep up with the legacy openmp parser at the time. Now that all clauses are encapsulated in
AccClause or OmpClause, these two strings are not necessary anymore and were the the source of couple
of problem while working with the generic structure checker for OpenMP.
This patch remove the flangClassValue string from DirectiveBase.td and use the string flangClass as the
placeholder for the encapsulated class.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D94821
2021-01-19 10:28:46 -05:00
Valentin Clement
53b440883c [openacc] Rename generated file from ACC.cpp.inc to ACC.inc to match D92955
This patch rename the tablegen generated file ACC.cpp.inc to ACC.inc in order
to match what was done in D92955. This file is included in header file as well as .cpp
file so it make more sense.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D93485
2021-01-14 14:19:53 -05:00
Valentin Clement
1f72844930 [mlir][openacc] Use TableGen information for default enum
Use TableGen and information in ACC.td for the Default enum in the OpenACC dialect.
This patch generalize what was done for OpenMP for directives.

Follow up patch after D93576

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D93710
2021-01-12 09:42:42 -05:00
Giorgis Georgakoudis
68536a3264 [OpenMPOpt][WIP] Expand parallel region merging
The existing implementation of parallel region merging applies only to
consecutive parallel regions that have speculatable sequential
instructions in-between. This patch lifts this limitation to expand
merging with any sequential instructions in-between, except calls to
unmergable OpenMP runtime functions. In-between sequential instructions
in the merged region are sequentialized in a "master" region and any
output values are broadcasted to the following parallel regions and the
sequential region continuation of the merged region.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D90909
2021-01-11 08:06:23 -08:00
Johannes Doerfert
611ba4c14f [OpenMP][FIX] Ensure the isa trait is evaluated last
Since isa can cause diagnostics we want it to be evaluated last to avoid
the "unknown isa" warning if the rest of the selector wouldn't match
anyway. That allows us to guard isa with arch properly.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D93785
2021-01-07 14:31:20 -06:00
Valentin Clement
d774f94470 [flang][openmp] Make Reduction clause part of OmpClause
After discussion in D93105 we found that the reduction clause was not following
the common OmpClause convention. This patch makes reduction clause part of OmpClause
with a value of OmpReductionClause in a similar way than task_reduction.
The unparse function for OmpReductionClause is adapted since the keyword and parenthesis
are issued by the corresponding unparse function for parser::OmpClause::Reduction.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D93482
2021-01-04 15:19:00 -05:00
sameeran joshi
f4e95b4b07 [Flang][openmp][5.0] Add task_reduction clause.
See OMP-5.0 2.19.5.5 task_reduction Clause.
To add a positive test case we need `taskgroup` directive which is not added hence skipping the test.
This is a dependency for `taskgroup` construct.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D93105

Co-authored-by: Valentin Clement <clementval@gmail.com>
2021-01-04 08:48:11 +05:30
Brandon Bergren
ed0f2ce728 [PowerPC] Enable OpenMP for powerpcle target. [5/5]
Enable OpenMP for powerpcle to match the rest of powerpc*.

Update tests.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D92445
2021-01-02 12:18:07 -06:00
sameeran joshi
1f7bfce5b3 Revert "[Flang][openmp][5.0] Add task_reduction clause."
This reverts commit 9a7895dc20852b662a66976d06871ec2a0b968c8.
Reverting due to missing Co-author attribution.

https://reviews.llvm.org/D93105
2020-12-22 23:53:51 +05:30
sameeran joshi
d525c0db00 [Flang][openmp][5.0] Add task_reduction clause.
See OMP-5.0 2.19.5.5 task_reduction Clause.
To add a positive test case we need `taskgroup` directive which is not added hence skipping the test.
This is a dependency for `taskgroup` construct.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D93105
2020-12-22 22:34:38 +05:30
sameeran joshi
fbe8dbe091 [Flang][openmp][5/5] Make dist_schedule clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpDistScheduleClause` clause part of `OmpClause`.
The unparse function for `OmpDistScheduleClause` is adapted since the keyword
and parenthesis are issued by the corresponding unparse function for
`parser::OmpClause::DistSchedule`.

Reviewed By: clementval, kiranktp

Differential Revision: https://reviews.llvm.org/D93644
2020-12-22 14:32:33 +05:30
sameeran joshi
4a13143c75 [Flang][openmp][4/5] Make nowait clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpNoWait` clause part of `OmpClause`.

Reviewed By: clementval, kiranktp

Differential Revision: https://reviews.llvm.org/D93643
2020-12-22 14:02:19 +05:30
sameeran joshi
f7a5280f64 [Flang][openmp][3/5] Make ProcBind clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpProcBindClause` clause part of `OmpClause`.
The unparse function is dropped as the unparsing is done by `WALK_NESTED_ENUM`
for `OmpProcBindClause`.

Reviewed By: clementval, kiranktp

Differential Revision: https://reviews.llvm.org/D93642
2020-12-22 13:40:38 +05:30
sameeran joshi
f1474a4f31 [Flang][openmp][2/5] Make Default clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpDefaultClause` clause part of `OmpClause`.
The unparse function is dropped as the unparsing is done by `WALK_NESTED_ENUM`
for `OmpDefaultClause`.

Reviewed By: clementval, kiranktp

Differential Revision: https://reviews.llvm.org/D93641
2020-12-22 13:17:44 +05:30
sameeran joshi
5a58d3eafe [Flang][openmp][1/5] Make Allocate clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `allocate` clause part of `OmpClause`.The unparse function for
`OmpAllocateClause` is adapted since the keyword and parenthesis are issued by
the corresponding unparse function for `parser::OmpClause::Allocate`.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D93640
2020-12-22 12:53:34 +05:30
Valentin Clement
a8fe3856d0 [openacc] Use TableGen enum for default clause value
Use the TableGen feature to have enum values for clauses.
Next step will be to extend the MLIR part used currently by OpenMP
to use the same enum on the dialect side.

This patch also add function that convert the enum to StringRef to be
used on the dump-parse-tree from flang.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D93576
2020-12-21 15:07:27 -05:00
Valentin Clement
328670a855 [openmp] Remove clause from OMPKinds.def and use OMP.td info
Remove the OpenMP clause information from the OMPKinds.def file and use the
information from the new OMP.td file. There is now a single source of truth for the
directives and clauses.

To avoid generate lots of specific small code from tablegen, the macros previously
used in OMPKinds.def are generated almost as identical. This can be polished and
possibly removed in a further patch.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D92955
2020-12-17 14:08:12 -05:00
Valentin Clement
d6763a4688 [flang][openacc] Enforce restriction on routine directive and clauses
This patch add some checks for the restriction on the routine directive
and fix several issue at the same time.

Validity tests have been added in a separate file than acc-clause-validity.f90 since this one
became quite large. I plan to split the larger file once on-going review are done.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D92672
2020-12-17 11:33:34 -05:00
Valentin Clement
03ce68ffad [flang][openacc] Update serial construct clauses for OpenACC 3.1
Update the allowed clauses for the SERIAL construct for the new OpenACC 3.1
specification.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D92123
2020-12-17 10:50:47 -05:00
Johannes Doerfert
62ee447a70 [OpenMP] Add initial support for omp [begin/end] assumes
The `assumes` directive is an OpenMP 5.1 feature that allows the user to
provide assumptions to the optimizer. Assumptions can refer to
directives (`absent` and `contains` clauses), expressions (`holds`
clause), or generic properties (`no_openmp_routines`, `ext_ABCD`, ...).

The `assumes` spelling is used for assumptions in the global scope while
`assume` is used for executable contexts with an associated structured
block.

This patch only implements the global spellings. While clauses with
arguments are "accepted" by the parser, they will simply be ignored for
now. The implementation lowers the assumptions directly to the
`AssumptionAttr`.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D91980
2020-12-16 20:02:49 -06:00
Johannes Doerfert
05f471417e Revert "[OpenMP] Add initial support for omp [begin/end] assumes"
There is a build error with gcc-5 [0], investigating now.

[0] https://reviews.llvm.org/D91980#2456526

This reverts commit a5a14cbe7f87e01882ecaa14df5d596cbf38823a.
2020-12-15 18:03:10 -06:00
Johannes Doerfert
d6a9ea03f5 [OpenMP] Add initial support for omp [begin/end] assumes
The `assumes` directive is an OpenMP 5.1 feature that allows the user to
provide assumptions to the optimizer. Assumptions can refer to
directives (`absent` and `contains` clauses), expressions (`holds`
clause), or generic properties (`no_openmp_routines`, `ext_ABCD`, ...).

The `assumes` spelling is used for assumptions in the global scope while
`assume` is used for executable contexts with an associated structured
block.

This patch only implements the global spellings. While clauses with
arguments are "accepted" by the parser, they will simply be ignored for
now. The implementation lowers the assumptions directly to the
`AssumptionAttr`.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D91980
2020-12-15 16:51:34 -06:00
sameeran joshi
53796ac006 [Flang][OpenMP-5.0] Semantic checks for flush construct.
From OMP 5.0 [2.17.8]
Restriction:
If memory-order-clause is release,acquire, or acq_rel, list items must not be specified on the flush directive.

Reviewed By: kiranchandramohan, clementval

Differential Revision: https://reviews.llvm.org/D89879
2020-12-14 13:30:48 +05:30
sameeran joshi
ab2dc4d459 [Flang][OpenMP] Semantic checks for Atomic construct.
Patch implements restrictions from 2.17.7  of OpenMP 5.0 standard for atomic Construct. Tests for the same are added.

One of the restriction
`OpenMP constructs may not be encountered during execution of an atomic region.`
Is mentioned in 5.0 standard to be a semantic restriction, but given the stricter nature of parser in F18 it's caught at parsing itself.

This patch is a next patch in series from D88965.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D89583
2020-12-14 13:03:57 +05:30
Michael Kruse
15b1228eb3 [OpenMPIRBuilder] Various changes required for tileLoops.
Extract some changes not directly related to tileLoops out of D92974:
 * Refactor `createLoopSkeleton` out of `createCanonicalLoop`.
 * Introduce `ComputeIP` parameter to the `createCanonicalLoop` overload inserts instructions to compute the trip count. Specifying the location is necessary to make these instructions appear before the outermost loop of a loop nest that is tiled.
 * Introduce `Name` parameter to `createCanonicalLoop`. This can help better understanding the origin of values of basic blocks with many loops. The default value is "loop" instead of "for" which could be confused with the "for directive" (aka worksharing-loop) and does not apply to Fortran.
 * Remove `CanonicalLoopInfo::eraseFromParent` which is currently unused and untested and was added in anticipation to be used by `tileLoops`. `eraseFromParent` has shown to be insufficient when more than a single loop is involved and is replaced by `removeUnusedBlocksFromParent` in D92974.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D93088
2020-12-11 11:37:45 -06:00
Michael Kruse
16ca9addca [OpenMPIRBuilder] Fix typo. NFC. 2020-12-11 00:15:23 -06:00
Irina Dobrescu
1f92697f11 [flang]Add Parser Support for Allocate Directive
Differential Revision: https://reviews.llvm.org/D89562
2020-12-10 16:21:19 +00:00
clementval
a38956acf7 Revert "[openmp] Remove clause from OMPKinds.def and use OMP.td info"
This reverts commit a7b2847216b4f7a84ef75461fd47a5adfbb63e27.

failing buildbot on warnings
2020-12-10 10:34:59 -05:00
Valentin Clement
643cb4d428 [openmp] Remove clause from OMPKinds.def and use OMP.td info
Remove the OpenMP clause information from the OMPKinds.def file and use the
information from the new OMP.td file. There is now a single source of truth for the
directives and clauses.

To avoid generate lots of specific small code from tablegen, the macros previously
used in OMPKinds.def are generated almost as identical. This can be polished and
possibly removed in a further patch.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D92955
2020-12-10 10:19:09 -05:00
Valentin Clement
293f1b3438 [flang][openacc] Update reference to OpenACC 3.1 specification
Update all reference from the specification to the new OpenACC 3.1
document.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D92120
2020-12-08 14:36:38 -05:00
Valentin Clement
1b85a31007 [flang][openacc] Add clause validity tests for the update directive
Add couple of clause validity tests for the update directive and check for
the restriction where at least self, host or device clause must appear on the directive.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D92447
2020-12-08 10:47:06 -05:00
Alex Zinenko
3d570da2a1 [OpenMPIRBuilder] introduce createStaticWorkshareLoop
Introduce a function that creates a statically-scheduled workshare loop
out of a canonical loop created earlier by the OpenMPIRBuilder. This
basically amounts to injecting runtime calls to the preheader and the
after block and updating the trip count. Static scheduling kind is
currently hardcoded and needs to be extracted from the runtime library
into common TableGen definitions.

Differential Revision: https://reviews.llvm.org/D92476
2020-12-07 22:30:59 +01:00
Valentin Clement
c5506c705e [flang][openacc] Add clause validity tests for the kernels directive
Add some clause validity tests for the kernels directive

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D91873
2020-12-07 14:27:18 -05:00
Valentin Clement
a4300fb039 [flang][openacc] Add clause validaty tests for data construct + fix default restriction
Add clause validity tests for the data construct. The default clause can appear only once
and this was not enforce in the ACC.td.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D91888
2020-12-04 15:12:15 -05:00
Alex Zinenko
0085eeb3aa [OpenMPIRBuilder] forward arguments as pointers to outlined function
OpenMPIRBuilder::createParallel outlines the body region of the parallel
construct into a new function that accepts any value previously defined outside
the region as a function argument. This function is called back by OpenMP
runtime function __kmpc_fork_call, which expects trailing arguments to be
pointers. If the region uses a value that is not of a pointer type, e.g. a
struct, the produced code would be invalid. In such cases, make createParallel
emit IR that stores the value on stack and pass the pointer to the outlined
function instead. The outlined function then loads the value back and uses as
normal.

Reviewed By: jdoerfert, llitchev

Differential Revision: https://reviews.llvm.org/D92189
2020-12-02 14:59:41 +01:00
sameeran joshi
2ce817a34c [Flang][OpenMP][NFC][2/2] Reorder OmpStructureChecker and simplify it.
`OmpStructureChecker` has too much boilerplate code in source file.

This patch:
  1. Use helpers from `check-directive-structure.h` and reduces the boilerplate.
  2. Use TableGen infrastructure as much as possible.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D90834
2020-11-21 22:37:35 +05:30
sameeran joshi
739932e963 [flang][openmp] Fix bug in OmpClause::Hint clause which was missing to generate inside in OMP.cpp.inc file.
Before this patch "Hint" isn't found inside the generated file.
./bin/llvm-tblgen --gen-directive-gen ../llvm-project/llvm/include/llvm/Frontend/OpenMP/OMP.td -I ../llvm-project/llvm/include/ > OMP.cpp.in

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D91909
2020-11-21 19:02:34 +05:30
Joseph Huber
c0b5fdf2f0 [OpenMP] Add Location Fields to Libomptarget Runtime for Debugging
Summary:
Add support for passing source locations to libomptarget runtime functions using the ident_t struct present in the rest of the libomp API. This will allow the runtime system to give much more insightful error messages and debugging values.

Reviewers: jdoerfert grokos

Differential Revision: https://reviews.llvm.org/D87946
2020-11-19 12:01:53 -05:00
Joseph Huber
93f603ff82 [OpenMP] Add Passing in Original Declaration Names To Mapper API
Summary:
This patch adds support for passing in the original delcaration name in the source file to the libomptarget runtime. This will allow the runtime to provide more intelligent debugging messages. This patch takes the original expression parsed from the OpenMP map / update clause and provides a textual representation if it was explicitly mapped, otherwise it takes the name of the variable declaration as a fallback. The information in passed to the runtime in a global array of strings that matches the existing ident_t source location strings using ";name;filename;column;row;;"

Reviewers: jdoerfert

Differential Revision: https://reviews.llvm.org/D89802
2020-11-18 15:28:39 -05:00
David Truby
d3b4fcad51 [MLIR][OpenMP] Add omp.wsloop operation
This adds a simple definition of a "workshare loop" operation for
the OpenMP MLIR dialect, excluding the "reduction" and "allocate"
clauses and without a custom parser and pretty printer.

The schedule clause also does not yet accept the modifiers that are
permitted in OpenMP 5.0.

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>

Reviewed By: ftynse, clementval

Differential Revision: https://reviews.llvm.org/D86071
2020-11-16 15:24:57 +00:00
Paul C. Anagnostopoulos
f82f4bca37 [TableGen] Clean up more .td files
Differential Revision: https://reviews.llvm.org/D91431
2020-11-14 07:32:25 -05:00
Michael Kruse
77d0891b19 [OMPIRBuilder] Start 'Create' methods with lower case. NFC.
For consistency with the IRBuilder, OpenMPIRBuilder has method names starting with 'Create'. However, the LLVM coding style has methods names starting with lower case letters, as all other OpenMPIRBuilder already methods do. The clang-tidy configuration used by Phabricator also warns about the naming violation, adding noise to the reviews.

This patch renames all `OpenMPIRBuilder::CreateXYZ` methods to `OpenMPIRBuilder::createXYZ`, and updates all in-tree callers.

I tested check-llvm, check-clang, check-mlir and check-flang to ensure that I did not miss a caller.

Reviewed By: mehdi_amini, fghanim

Differential Revision: https://reviews.llvm.org/D91109
2020-11-09 19:35:11 -06:00
Michael Kruse
f232c75847 [OpenMPIRBuilder] Implement CreateCanonicalLoop.
CreateCanonicalLoop generates a standardized control flow structure for OpenMP canonical for loops. The structure can be consumed by loop-associated directives such as worksharing-loop, distribute, simd etc. as well as loop transformations such as tile and unroll.

This is a first design without considering all complexities yet. The control-flow emits more basic block than strictly necessary, but these will be optimized by CFGSimplify anyway, provide a nice separation of concerns and might later be useful with more complex scenarios. I successfully implemented a basic tile construct using this API, which is not part of this patch.

The fundamental building block is the CreateCanonicalLoop that only takes the loop trip count and operates on the logical iteration spaces only. An overloaded CreateCanonicalLoop for using LB, UB, Increment is provided as well, but at least for C++, Clang will need to implement a loop counter to logical induction variable mapping anyway, since iterator overload resolution cannot be done in LLVMFrontend.

As there currently is no user for CreateCanonicalLoop, it is only called from unittests. Similarly, CanonicalLoopInfo::eraseFromParent() is used in my file implementation and might be generally useful for implementing loop-associated constructs, but is not used in this patch itself.

The following non-exhaustive list describes not yet covered items:
 * collapse clause (including non-rectangular and non-perfectly nested); idea is to provide a OpenMPIRBuilder::collapseLoopNest method consuming multiple nested loops and returning a new CanonicalLoopInfo that can be used for loop-associated directives.
 * simarly: ordered clause for DOACROSS loops
 * branch weights
 * Cancellation point (?)
 * AllocaIP
 * break statement (if needed at all)
 * Exceptions (if not completely handled in the front-end)
  * Using it in Clang; this requires implementing at least one loop-associated construct.
 * ...

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D90830
2020-11-09 15:03:32 -06:00
Valentin Clement
8c87b66158 [flang][openacc] Add parsing tests and semantic check for set directive
This patch add some parsing and clause validity tests for the set directive.
It makes use of the possibility introduces in patch D90770 to check the restriction
were one of the default_async, device_num and device_type clauses is required but also
not more than once on the set directive.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D90771
2020-11-05 22:57:58 -05:00