aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/OpenMPKinds.cpp
AgeCommit message (Collapse)AuthorFilesLines
2022-03-24[OpenMP] Initial parsing/sema for the 'omp target parallel loop' constructMike Rice1-4/+6
Adds basic parsing/sema/serialization support for the #pragma omp target parallel loop directive. Differential Revision: https://reviews.llvm.org/D122359
2022-03-22[OpenMP] Initial parsing/sema for the 'omp parallel loop' constructMike Rice1-3/+6
Adds basic parsing/sema/serialization support for the #pragma omp parallel loop directive. Differential Revision: https://reviews.llvm.org/D122247
2022-03-18[OpenMP] Initial parsing/sema for the 'omp target teams loop' constructMike Rice1-6/+11
Adds basic parsing/sema/serialization support for the #pragma omp target teams loop directive. Differential Revision: https://reviews.llvm.org/D122028
2022-03-16[OpenMP] Initial parsing/sema for the 'omp teams loop' constructMike Rice1-3/+7
Adds basic parsing/sema/serialization support for the #pragma omp teams loop directive. Differential Revision: https://reviews.llvm.org/D121713
2022-02-08Enable inoutset dependency-type in depend clause.David Pagan1-3/+7
Done in manner similar to mutexinoutset (see https://reviews.llvm.org/D57576) Runtime support already exists in LLVM OpenMP runtime (see https://reviews.llvm.org/D97085). The value used to identify an inoutset dependency type in the LLVM OpenMP runtime is 8. Some tests updated due to change in dependency type error messages that now include new dependency type. Also updated test/OpenMP/task_codegen.cpp to verify we emit the right code.
2021-12-24[Clang][OpenMP] Add the support for atomic compare in parserShilei Tian1-0/+2
This patch adds the support for `atomic compare` in parser. The support in Sema and CodeGen will come soon. For now, it simply eimits an error when it is encountered. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D115561
2021-11-04[OpenMP] Add parsing/sema/serialization for 'bind' clause.Mike Rice1-0/+15
Differential Revision: https://reviews.llvm.org/D113154
2021-10-28[OpenMP] Initial parsing/sema for the 'omp loop' constructMike Rice1-1/+9
Adds basic parsing/sema/serialization support for the #pragma omp loop directive. Differential Revision: https://reviews.llvm.org/D112499
2021-10-25[OPENMP51]Initial parsing/sema for append_args clause for 'declare variant'Mike Rice1-0/+2
Adds initial parsing and sema for the 'append_args' clause. Note that an AST clause is not created as it instead adds its values to the OMPDeclareVariantAttr. Differential Revision: https://reviews.llvm.org/D111854
2021-10-13[OPENMP51]Initial parsing/sema for adjust_args clause for 'declare variant'Mike Rice1-0/+15
Adds initial parsing and sema for the 'adjust_args' clause. Note that an AST clause is not created as it instead adds its expressions to the OMPDeclareVariantAttr. Differential Revision: https://reviews.llvm.org/D99905
2021-09-18OpenMP 5.0 metadirectivealokmishra.besu1-0/+5
This patch supports OpenMP 5.0 metadirective features. It is implemented keeping the OpenMP 5.1 features like dynamic user condition in mind. A new function, getBestWhenMatchForContext, is defined in llvm/Frontend/OpenMP/OMPContext.h Currently this function return the index of the when clause with the highest score from the ones applicable in the Context. But this function is declared with an array which can be used in OpenMP 5.1 implementation to select all the valid when clauses which can be resolved in runtime. Currently this array is set to null by default and its implementation is left for future. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D91944
2021-09-18Revert "OpenMP 5.0 metadirective"Nico Weber1-5/+0
This reverts commit c7d7b98e5263472f05b2f3cb767b5d16e1349e9a. Breaks tests on macOS, see comment on https://reviews.llvm.org/D91944
2021-09-17OpenMP 5.0 metadirectivealokmishra.besu1-0/+5
This patch supports OpenMP 5.0 metadirective features. It is implemented keeping the OpenMP 5.1 features like dynamic user condition in mind. A new function, getBestWhenMatchForContext, is defined in llvm/Frontend/OpenMP/OMPContext.h Currently this function return the index of the when clause with the highest score from the ones applicable in the Context. But this function is declared with an array which can be used in OpenMP 5.1 implementation to select all the valid when clauses which can be resolved in runtime. Currently this array is set to null by default and its implementation is left for future. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D91944
2021-09-17Revert "OpenMP 5.0 metadirective"cchen1-5/+0
This reverts commit c7d7b98e5263472f05b2f3cb767b5d16e1349e9a.
2021-09-17OpenMP 5.0 metadirectivecchen1-0/+5
This patch supports OpenMP 5.0 metadirective features. It is implemented keeping the OpenMP 5.1 features like dynamic user condition in mind. A new function, getBestWhenMatchForContext, is defined in llvm/Frontend/OpenMP/OMPContext.h Currently this function return the index of the when clause with the highest score from the ones applicable in the Context. But this function is declared with an array which can be used in OpenMP 5.1 implementation to select all the valid when clauses which can be resolved in runtime. Currently this array is set to null by default and its implementation is left for future. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D91944
2021-08-31[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang ↵Joel E. Denny1-3/+5
(1/2) This patch implements Clang support for an original OpenMP extension we have developed to support OpenACC: the `ompx_hold` map type modifier. The next patch in this series, D106510, implements OpenMP runtime support. Consider the following example: ``` #pragma omp target data map(ompx_hold, tofrom: x) // holds onto mapping of x { foo(); // might have map(delete: x) #pragma omp target map(present, alloc: x) // x is guaranteed to be present printf("%d\n", x); } ``` The `ompx_hold` map type modifier above specifies that the `target data` directive holds onto the mapping for `x` throughout the associated region regardless of any `target exit data` directives executed during the call to `foo`. Thus, the presence assertion for `x` at the enclosed `target` construct cannot fail. (As usual, the standard OpenMP reference count for `x` must also reach zero before the data is unmapped.) Justification for inclusion in Clang and LLVM's OpenMP runtime: * The `ompx_hold` modifier supports OpenACC functionality (structured reference count) that cannot be achieved in standard OpenMP, as of 5.1. * The runtime implementation for `ompx_hold` (next patch) will thus be used by Flang's OpenACC support. * The Clang implementation for `ompx_hold` (this patch) as well as the runtime implementation are required for the Clang OpenACC support being developed as part of the ECP Clacc project, which translates OpenACC to OpenMP at the directive AST level. These patches are the first step in upstreaming OpenACC functionality from Clacc. * The Clang implementation for `ompx_hold` is also used by the tests in the runtime implementation. That syntactic support makes the tests more readable than low-level runtime calls can. Moreover, upstream Flang and Clang do not yet support OpenACC syntax sufficiently for writing the tests. * More generally, the Clang implementation enables a clean separation of concerns between OpenACC and OpenMP development in LLVM. That is, LLVM's OpenMP developers can discuss, modify, and debug LLVM's extended OpenMP implementation and test suite without directly considering OpenACC's language and execution model, which can be handled by LLVM's OpenACC developers. * OpenMP users might find the `ompx_hold` modifier useful, as in the above example. See new documentation introduced by this patch in `openmp/docs` for more detail on the functionality of this extension and its relationship with OpenACC. For example, it explains how the runtime must support two reference counts, as specified by OpenACC. Clang recognizes `ompx_hold` unless `-fno-openmp-extensions`, a new command-line option introduced by this patch, is specified. Reviewed By: ABataev, jdoerfert, protze.joachim, grokos Differential Revision: https://reviews.llvm.org/D106509
2021-06-10[OpenMP] Implement '#pragma omp unroll'.Michael Kruse1-2/+4
Implementation of the unroll directive introduced in OpenMP 5.1. Follows the approach from D76342 for the tile directive (i.e. AST-based, not using the OpenMPIRBuilder). Tries to use `llvm.loop.unroll.*` metadata where possible, but has to fall back to an AST representation of the outer loop if the partially unrolled generated loop is associated with another directive (because it needs to compute the number of iterations). Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D99459
2021-04-05[OPENMP51]Initial support for nocontext clause.Jennifer Yu1-0/+2
Added basic parsing/sema/serialization support for the 'nocontext' clause. Differential Revision: https://reviews.llvm.org/D99848
2021-04-02[OPENMP5.1]Initial support for novariants clause.Jennifer Yu1-0/+2
Added basic parsing/sema/serialization support for the 'novariants' clause.
2021-03-30[OPENMP51]Initial support for the dispatch directive.Mike Rice1-0/+1
Added basic parsing/sema/serialization support for dispatch directive. Differential Revision: https://reviews.llvm.org/D99537
2021-02-16[OpenMP] Implement '#pragma omp tile', by Michael Kruse (@Meinersbur).Michael Kruse1-1/+10
The tile directive is in OpenMP's Technical Report 8 and foreseeably will be part of the upcoming OpenMP 5.1 standard. This implementation is based on an AST transformation providing a de-sugared loop nest. This makes it simple to forward the de-sugared transformation to loop associated directives taking the tiled loops. In contrast to other loop associated directives, the OMPTileDirective does not use CapturedStmts. Letting loop associated directives consume loops from different capture context would be difficult. A significant amount of code generation logic is taking place in the Sema class. Eventually, I would prefer if these would move into the CodeGen component such that we could make use of the OpenMPIRBuilder, together with flang. Only expressions converting between the language's iteration variable and the logical iteration space need to take place in the semantic analyzer: Getting the of iterations (e.g. the overload resolution of `std::distance`) and converting the logical iteration number to the iteration variable (e.g. overload resolution of `iteration + .omp.iv`). In clang, only CXXForRangeStmt is also represented by its de-sugared components. However, OpenMP loop are not defined as syntatic sugar. Starting with an AST-based approach allows us to gradually move generated AST statements into CodeGen, instead all at once. I would also like to refactor `checkOpenMPLoop` into its functionalities in a follow-up. In this patch it is used twice. Once for checking proper nesting and emitting diagnostics, and additionally for deriving the logical iteration space per-loop (instead of for the loop nest). Differential Revision: https://reviews.llvm.org/D76342
2020-07-29[OpenMP] Implement TR8 `present` motion modifier in Clang (1/2)Joel E. Denny1-2/+6
This patch implements Clang front end support for the OpenMP TR8 `present` motion modifier for `omp target update` directives. The next patch in this series implements OpenMP runtime support. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D84711
2020-07-28Revert "[OpenMP] Implement TR8 `present` motion modifier in Clang (1/2)"Joel E. Denny1-6/+2
This reverts commit 3c3faae497046be706df29e16c9fbccb7e1fce09. It breaks a number of bots.
2020-07-28[OpenMP] Implement TR8 `present` motion modifier in Clang (1/2)Joel E. Denny1-2/+6
This patch implements Clang front end support for the OpenMP TR8 `present` motion modifier for `omp target update` directives. The next patch in this series implements OpenMP runtime support. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D84711
2020-07-28[OpenMP][NFC] Consolidate `to` and `from` clause modifiersJoel E. Denny1-23/+7
`to` and `from` clauses take the same modifiers, which are called "motion modifiers" in TR8, so implement handling of their modifiers once not twice. This will make it easier to implement additional motion modifiers in the future. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D84710
2020-07-22[OpenMP] Implement TR8 `present` map type modifier in Clang (1/2)Joel E. Denny1-4/+8
This patch implements Clang front end support for the OpenMP TR8 `present` map type modifier. The next patch in this series implements OpenMP runtime support. This patch does not attempt to implement TR8 sec. 2.22.7.1 "map Clause", p. 319, L14-16: > If a map clause with a present map-type-modifier is present in a map > clause, then the effect of the clause is ordered before all other > map clauses that do not have the present modifier. Compare to L10-11, which Clang does not appear to implement yet: > For a given construct, the effect of a map clause with the to, from, > or tofrom map-type is ordered before the effect of a map clause with > the alloc, release, or delete map-type. This patch also does not implement the `present` implicit-behavior for `defaultmap` or the `present` motion-modifier for `target update`. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D83061
2020-07-01[flang][openmp] Use common Directive and Clause enum from llvm/FrontendValentin Clement1-0/+5
Summary: This patch is removing the custom enumeration for OpenMP Directives and Clauses and replace them with the newly tablegen generated one from llvm/Frontend. This is a first patch and some will follow to share the same infrastructure where possible. The next patch should use the clauses allowance defined in the tablegen file. Reviewers: jdoerfert, DavidTruby, sscalpone, kiranchandramohan, ichoyjx Reviewed By: DavidTruby, ichoyjx Subscribers: jholewinski, cfe-commits, dblaikie, MaskRay, ymandel, ichoyjx, mgorny, yaxunl, guansong, jfb, sstefan1, aaron.ballman, llvm-commits Tags: #llvm, #flang, #clang Differential Revision: https://reviews.llvm.org/D82906
2020-06-25[openmp] Use Directive_enumSize instead of OMPD_unknown positionValentin Clement1-1/+1
Summary: Previously OMPD_unknown was last item in the Directive enumeration and its position was used in various comparison and assertion. With the new Directive enumeration, this should be change with llvm::omp::Directive_enumSize. This patch fix two place where it was not done in D81736. Reviewers: vdmitrie, jdoerfert, jdenny Reviewed By: jdoerfert Subscribers: yaxunl, guansong, sstefan1, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D82518
2020-05-27[OPENMP50]Initial support for use_device_addr clause.Alexey Bataev1-0/+2
Summary: Added parsing/sema analysis/serialization support for use_device_addr clauses. Reviewers: jdoerfert Subscribers: yaxunl, guansong, arphaman, sstefan1, llvm-commits, cfe-commits, caomhin Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D80404
2020-05-19[OPENMP50]Add initial support for 'affinity' clause.Alexey Bataev1-0/+2
Summary: Added parsing/sema/serialization support for affinity clause in task directives. Reviewers: jdoerfert Subscribers: yaxunl, guansong, arphaman, llvm-commits, cfe-commits, caomhin Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D80148
2020-04-30[OPENMP50]Basic support for uses_allocators clause.Alexey Bataev1-0/+2
Summary: Added parsing/sema/serialization supoprt for uses_allocators clause. Reviewers: jdoerfert Subscribers: yaxunl, guansong, arphaman, cfe-commits, caomhin Tags: #clang Differential Revision: https://reviews.llvm.org/D78577
2020-04-06[OpenMP][NFC] Move and simplify directive -> allowed clause mappingJohannes Doerfert1-575/+0
Move the listing of allowed clauses per OpenMP directive to the new macro file in `llvm/Frontend/OpenMP`. Also, use a single generic macro that specifies the directive and one allowed clause explicitly instead of a dedicated macro per directive. We save 800 loc and boilerplate for all new directives/clauses with no functional change. We also need to include the macro file only once and not once per directive. Depends on D77112. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D77113
2020-04-05[OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`Johannes Doerfert1-44/+0
This is a cleanup and normalization patch that also enables reuse with Flang later on. A follow up will clean up and move the directive -> clauses mapping. Reviewed By: fghanim Differential Revision: https://reviews.llvm.org/D77112
2020-04-02Revert "[OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`"Johannes Doerfert1-0/+44
This reverts commit c18d55998b3352e6ec92ccb8a3240a16a57c61e6. Bots have reported uses that need changing, e.g., clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cp as reported by http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/46591
2020-04-02[OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`Johannes Doerfert1-44/+0
This is a cleanup and normalization patch that also enables reuse with Flang later on. A follow up will clean up and move the directive -> clauses mapping. Differential Revision: https://reviews.llvm.org/D77112
2020-03-27[OpenMP] `omp begin/end declare variant` - part 1, parsingJohannes Doerfert1-0/+4
This is the first part extracted from D71179 and cleaned up. This patch provides parsing support for `omp begin/end declare variant`, as defined in OpenMP technical report 8 (TR8) [0]. A major purpose of this patch is to provide proper math.h/cmath support for OpenMP target offloading. See PR42061, PR42798, PR42799. The current code was developed with this feature in mind, see [1]. [0] https://www.openmp.org/wp-content/uploads/openmp-TR8.pdf [1] https://reviews.llvm.org/D61399#change-496lQkg0mhRN Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D74941
2020-03-23[OPENMP50]Add 'default' modifier in reduction clauses.Alexey Bataev1-2/+15
Added full support for 'default' modifier in the reduction clauses.
2020-03-23[OPENMP50]Bassic support for exclusive clause.Alexey Bataev1-0/+2
Added basic support (parsing/sema/serialization) for exclusive clause in scan directives.
2020-03-20[OPENMP50]Initial support for inclusive clause.Alexey Bataev1-0/+2
Added parsing/sema/serialization support for inclusive clause in scan directive.
2020-03-20[OPENMP50]Initial support for scan directive.Alexey Bataev1-0/+13
Addedi basic parsing/sema/serialization support for scan directive.
2020-03-18[OPENMP50]Add support for extended device clause in target directives.Alexey Bataev1-2/+15
Added parsing/sema/serialization support for extended device clause in executable target directives.
2020-03-17[OPENMP50]Initial support for detach clause in task directive.Alexey Bataev1-0/+4
Added parsing/sema/serialization support for detach clause.
2020-03-03[OPENMP50]Support 'update' clause for 'depobj' directive.Alexey Bataev1-2/+15
Added basic support (parsing/sema/serialization) for 'update' clause in 'depobj' directive.
2020-03-02[OPENMP50]Support 'destroy' clause on 'depobj' directives.Alexey Bataev1-0/+2
Added basic support (parsing/sema/serialization) for 'destroy' clause in depobj directives.
2020-03-02[OPENMP50]Add basic support for depobj construct.Alexey Bataev1-1/+25
Added basic parsing/sema/serialization support for depobj directive.
2020-02-15[OpenMP][NFCI] Use the libFrontend DefaultKind in ClangAtmn Patel1-11/+9
This swaps out the OpenMPDefaultClauseKind enum with a llvm::omp::DefaultKind enum which is stored in OMPConstants.h. This should not change any functionality. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D74513
2020-02-14[OpenMP][Part 2] Use reusable OpenMP context/traits handlingJohannes Doerfert1-43/+0
This patch implements an almost complete handling of OpenMP contexts/traits such that we can reuse most of the logic in Flang through the OMPContext.{h,cpp} in llvm/Frontend/OpenMP. All but construct SIMD specifiers, e.g., inbranch, and the device ISA selector are define in `llvm/lib/Frontend/OpenMP/OMPKinds.def`. From these definitions we generate the enum classes `TraitSet`, `TraitSelector`, and `TraitProperty` as well as conversion and helper functions in `llvm/lib/Frontend/OpenMP/OMPContext.{h,cpp}`. The above enum classes are used in the parser, sema, and the AST attribute. The latter is not a collection of multiple primitive variant arguments that contain encodings via numbers and strings but instead a tree that mirrors the `match` clause (see `struct OpenMPTraitInfo`). The changes to the parser make it more forgiving when wrong syntax is read and they also resulted in more specialized diagnostics. The tests are updated and the core issues are detected as before. Here and elsewhere this patch tries to be generic, thus we do not distinguish what selector set, selector, or property is parsed except if they do behave exceptionally, as for example `user={condition(EXPR)}` does. The sema logic changed in two ways: First, the OMPDeclareVariantAttr representation changed, as mentioned above, and the sema was adjusted to work with the new `OpenMPTraitInfo`. Second, the matching and scoring logic moved into `OMPContext.{h,cpp}`. It is implemented on a flat representation of the `match` clause that is not tied to clang. `OpenMPTraitInfo` provides a method to generate this flat structure (see `struct VariantMatchInfo`) by computing integer score values and boolean user conditions from the `clang::Expr` we keep for them. The OpenMP context is now an explicit object (see `struct OMPContext`). This is in anticipation of construct traits that need to be tracked. The OpenMP context, as well as the `VariantMatchInfo`, are basically made up of a set of active or respectively required traits, e.g., 'host', and an ordered container of constructs which allows duplication. Matching and scoring is kept as generic as possible to allow easy extension in the future. --- Test changes: The messages checked in `OpenMP/declare_variant_messages.{c,cpp}` have been auto generated to match the new warnings and notes of the parser. The "subset" checks were reversed causing the wrong version to be picked. The tests have been adjusted to correct this. We do not print scores if the user did not provide one. We print spaces to make lists in the `match` clause more legible. Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim Subscribers: merge_guards_bot, rampitec, mgorny, hiraditya, aheejin, fedor.sergeev, simoncook, bollu, guansong, dexonsmith, jfb, s.egerton, llvm-commits, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71830
2020-02-13[OPENMP50]Add support for hint clause in atomic directive.Alexey Bataev1-2/+3
According to OpenMP 5.0, hint clause is alowed to be used in atomic directives.
2020-02-11[OPENMP50]Add support for relaxed clause in atomic directive.Alexey Bataev1-1/+3
Added full support for relaxed clause.
2020-02-10[OPENMP50]Add support for 'release' clause.Alexey Bataev1-1/+4
Added full support for 'release' clause in flush|atomic directives.