aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseOpenMP.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-07-25[OpenMP] Defaultmap: fixes scalar issue, adds all variable category (#99315)nicebert1-0/+1
Fixes issue with defaultmap where scalar isn't handled correctly for present modifier. Adds all variable cateogry introduced in OpenMP 5.2 and alters existing tests for error messages to check OpenMP 5.2 defaultmap messages.
2024-07-19[Clang][OpenMP] Add interchange directive (#93022)Michael Kruse1-0/+1
Add the interchange directive which will be introduced in the upcoming OpenMP 6.0 specification. A preview has been published in [Technical Report 12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf).
2024-07-18[Clang][OpenMP] Add reverse directive (#92916)Michael Kruse1-0/+1
Add the reverse directive which will be introduced in the upcoming OpenMP 6.0 specification. A preview has been published in [Technical Report 12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf). --------- Co-authored-by: Alexey Bataev <a.bataev@outlook.com>
2024-06-29[clang][OpenMP] Implement `isOpenMPExecutableDirective` (#97089)Krzysztof Parzyszek1-4/+2
What is considered "executable" in clang differs slightly from the OpenMP's "executable" category. In addition to the executable category, subsidiary directives, and OMPD_error are considered executable. Implement a function that performs that check.
2024-06-26[clang][OpenMP] Shorten directive classification in ParseOpenMP (#94691)Krzysztof Parzyszek1-314/+211
Use directive categories to simplify long lists of `case` statements in the OpenMP parser. This is a step towards avoiding dependence on explicitly specified sets of directives that can be expressed more generically. The upcoming OpenMP 6.0 will introduce many new combined directives, and the more generically we handle directives, the easier the introduction of the new standard will be. --------- Co-authored-by: Alexey Bataev <a.bataev@outlook.com>
2024-06-24[clang][OpenMP] Fix error handling of the adjust_args clause (#94696)Mike Rice1-3/+3
Static verifier noticed the current code has logically dead code parsing the clause where IsComma is assigned. Fix this and improve the error message received when a bad adjust-op is specified. This will now be handled like 'map' where a nice diagnostic is given with the correct values, then parsing continues on the next clause reducing unhelpful diagnostics.
2024-05-30[clang][OpenMP] Simplify check for repeated clauses (#93611)Krzysztof Parzyszek1-36/+24
The `FirstClauses` is a vector of pointer-bool pairs, and the pointer part of the pair is never used. Replace the vector with std::bitset, and rename it to `SeenClauses` to make the purpose of it a bit clearer.
2024-05-30[clang] Introduce target-specific `Sema` components (#93179)Vlad Serebrennikov1-2/+3
This patch introduces `SemaAMDGPU`, `SemaARM`, `SemaBPF`, `SemaHexagon`, `SemaLoongArch`, `SemaMIPS`, `SemaNVPTX`, `SemaPPC`, `SemaSystemZ`, `SemaWasm`. This continues previous efforts to split Sema up. Additional context can be found in #84184 and #92682. I decided to bundle target-specific components together because of their low impact on `Sema`. That said, their impact on `SemaChecking.cpp` is far from low, and I consider it a success. Somewhat accidentally, I also moved Wasm- and AMDGPU-specific function from `SemaDeclAttr.cpp`, because they were exposed in `Sema`. That went well, and I consider it a success, too. I'd like to move the rest of static target-specific functions out of `SemaDeclAttr.cpp` like we're doing with built-ins in `SemaChecking.cpp` .
2024-05-29[clang][OpenMP] Remove unused include of UniqueVector.h, NFCKrzysztof Parzyszek1-1/+0
2024-05-17[clang] Introduce `SemaCodeCompletion` (#92311)Vlad Serebrennikov1-4/+7
This patch continues previous efforts to split `Sema` up, this time covering code completion. Context can be found in #84184. Dropping `Code` prefix from function names in `SemaCodeCompletion` would make sense, but I think this PR has enough changes already. As usual, formatting changes are done as a separate commit. Hopefully this helps with the review.
2024-05-13Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… ↵jyu2-git1-8/+43
(#91821) … (#90885)" This reverts commit eea81aa29848361eb5b24f24d2af643fdeb9adfd.
2024-05-13[Clang][OpenMP][Tile] Allow non-constant tile sizes. (#91345)Michael Kruse1-25/+40
Allow non-constants in the `sizes` clause such as ``` #pragma omp tile sizes(a) for (int i = 0; i < n; ++i) ``` This is permitted since tile was introduced in [OpenMP 5.1](https://www.openmp.org/spec-html/5.1/openmpsu53.html#x78-860002.11.9). It is possible to sneak-in negative numbers at runtime as in ``` int a = -1; #pragma omp tile sizes(a) ``` Even though it is not well-formed, it should still result in every loop iteration to be executed exactly once, an invariant of the tile construct that we should ensure. `ParseOpenMPExprListClause` is extracted-out to be reused by the `permutation` clause of the `interchange` construct. Some care was put into ensuring correct behavior in template contexts.
2024-05-11[clang] Use StringRef::operator== instead of StringRef::equals (NFC) (#91844)Kazu Hirata1-2/+2
I'm planning to remove StringRef::equals in favor of StringRef::operator==. - StringRef::operator==/!= outnumber StringRef::equals by a factor of 24 under clang/ in terms of their usage. - The elimination of StringRef::equals brings StringRef closer to std::string_view, which has operator== but not equals. - S == "foo" is more readable than S.equals("foo"), especially for !Long.Expression.equals("str") vs Long.Expression != "str".
2024-05-08Revert "Revert "Revert "[OpenMP][TR12] change property of map-type ↵Weaver1-43/+8
modifier."… (#91141)" This reverts commit a99ce615f19fec6fbb835490b89f53cba3cf9eff. Caused test failure on following buildbot: https://lab.llvm.org/buildbot/#/builders/139/builds/65066
2024-05-07Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… ↵jyu2-git1-8/+43
(#91141) … (#90885)" This reverts commit eea81aa29848361eb5b24f24d2af643fdeb9adfd. Also change isMapType as @vitalybuka suggested. Hope this fix sanitizer build problem.
2024-05-02Fix sanitize problem. (#90800)jyu2-git1-2/+6
Currently isMapType could return OpenMPMapModifierKind. The change is to return OpenMPMapTypeKind only, if it is not MapType Kind OMPC_MAP_unknown is returned.
2024-05-02Revert "[OpenMP][TR12] change property of map-type modifier." (#90885)Vitaly Buka1-40/+4
Breaks https://lab.llvm.org/buildbot/#/builders/5/builds/43086/steps/9/logs/stdio Reverts llvm/llvm-project#90499
2024-05-01[OpenMP][TR12] change property of map-type modifier. (#90499)jyu2-git1-4/+40
map-type change to "default" instead "ultimate" from [OpenMP5.2] The change is allowed map-type to be placed any locations within map modifiers, besides the last location in the modifiers-list, also map-type can be omitted afterward.
2024-04-16[clang] Introduce `SemaOpenMP` (#88642)Vlad Serebrennikov1-112/+128
This patch moves OpenMP-related entities out of `Sema` to a newly created `SemaOpenMP` class. This is a part of the effort to split `Sema` up, and follows the recent example of CUDA, OpenACC, SYCL, HLSL. Additional context can be found in https://github.com/llvm/llvm-project/pull/82217, https://github.com/llvm/llvm-project/pull/84184, https://github.com/llvm/llvm-project/pull/87634.
2024-03-06[OpenMP] Parse and Sema support for declare target in local scope (#83223)Sandeep Kosuri1-1/+22
- adds Parse and Sema support for the `declare target` directive inside a function scope.
2024-01-31[OpenMP] atomic compare weak : Parser & AST support (#79475)SunilKuravinakop1-0/+1
This is a support for " #pragma omp atomic compare weak". It has Parser & AST support for now. --------- Authored-by: Sunil Kuravinakop <kuravina@pe28vega.us.cray.com>
2023-12-03[OpenMP] return empty stmt for `nothing` (#74042)Sandeep Kosuri1-1/+2
- `nothing` directive was effecting the `if` block structure which it should not. So return an empty statement instead of an error statement while parsing to avoid this.
2023-11-29[OpenMP] Support for `nothing` in `metadirective` (#73690)Sandeep Kosuri1-5/+7
- Removed an unnecessary check that was preventing `nothing` to work properly inside `metadirective`.
2023-11-26[OpenMP] atomic compare fail : Parser & AST supportSunil Kuravinakop1-0/+1
Diff Revision: https://reviews.llvm.org/D123235
2023-11-22[flang][OpenMP] Add semantic check for declare target (#72770)Shraiysh1-0/+1
2023-11-20Revert "[OpenMP] atomic compare fail : Parser & AST support"Krzysztof Parzyszek1-1/+0
This reverts commit edd675ac283909397880f85ba68d0d5f99dc1be2. This breaks clang build where every component is a shared library. The file clang/lib/Basic/OpenMPKinds.cpp, which is a part of libclangBasic.so, uses `getOpenMPClauseName` which isn't: /usr/bin/ld: CMakeFiles/obj.clangBasic.dir/OpenMPKinds.cpp.o: in functio n `clang ::getOpenMPSimpleClauseTypeName(llvm::omp::Clause, unsigned int )': OpenMPKinds.cpp:(.text._ZN5clang29getOpenMPSimpleClauseTypeNameEN4llvm3o mp6ClauseEj+0x9b): undefined reference to `llvm::omp::getOpenMPClauseNam e(llvm::omp::Clause)'
2023-11-20[C23] Complete support for WG14 N2508 (#71398)Aaron Ballman1-2/+2
In Clang 16, we implemented the ability to add a label at the end of a compound statement. These changes complete the implementation by allowing a label to be followed by a declaration in C. Note, this seems to have fixed an issue with some OpenMP stand-alone directives not being properly diagnosed as per: https://www.openmp.org/spec-html/5.1/openmpsu19.html#x34-330002.1.3 (The same requirement exists in OpenMP 5.2 as well.)
2023-11-20[OpenMP] atomic compare fail : Parser & AST supportSunil Kuravinakop1-0/+1
Diff Revision: https://reviews.llvm.org/D123235
2023-11-08Revert "[OpenMP] atomic compare fail : Parser & AST support"Mitch Phillips1-1/+0
This reverts commit 086b65340cca2648a2a91a0a47d28c7d9bafd1e5. Reason: Broke under -Werror. More details in https://reviews.llvm.org/D123235
2023-11-07[OpenMP] atomic compare fail : Parser & AST supportSunil Kuravinakop1-0/+1
This is a support for " #pragma omp atomic compare fail ". It has Parser & AST support for now. Reviewed By: tianshilei1992, ABataev Differential Revision: https://reviews.llvm.org/D123235
2023-10-25[OpenMP 5.2] Deprecate old syntax of linear clause (#70152)Fazlay Rabbi1-0/+4
The syntax of the linear clause that specifies its argument and linear-modifier as linear-modifier(list) was deprecated since OpenMP 5.2 and the step modifier was added for specifying the linear step. Reference: OpenMP 5.2 Spec, Page 627, Line 15
2023-10-24[OpenMP 5.2] Initial parsing and semantic analysis suppport for 'step' ↵Fazlay Rabbi1-11/+87
modifier on 'linear' clause Reference: (1) OpenMP 5.2 Specification - Seciton 5.4.6 Differential revision: https://reviews.llvm.org/D159546
2023-10-24[OpenMP 5.2] Deprecate syntax of map modifiers without comma separators (#69534)Fazlay Rabbi1-0/+9
The syntax of modifiers without comma separators in the map clause was deprecated in OpenMP 5.2. Reference: OpenMP 5.2 Spec, page 627, line 19
2023-10-05Introduce the initial support for OpenMP kernel language (#66844)Shilei Tian1-0/+11
This patch starts the support for OpenMP kernel language, basically to write OpenMP target region in SIMT style, similar to kernel languages such as CUDA. What included in this first patch is the `ompx_bare` clause for `target teams` directive. When `ompx_bare` exists, globalization is disabled such that local variables will not be globalized. The runtime init/deinit function calls will not be emitted. That being said, almost all OpenMP executable directives are not supported in the region, such as parallel, task. This patch doesn't include the Sema checks for that, so the use of them is UB. Simple directives, such as atomic, can be used. We provide a set of APIs (for C, they are prefix with `ompx_`; for C++, they are in `ompx` namespace) to get thread id, block id, etc. Please refer to https://tianshilei.me/wp-content/uploads/llvm-hpc-2023.pdf for more details.
2023-09-29Revert "[OpenMP] Introduce the initial support for OpenMP kernel language ↵JP Lehr1-11/+0
(#66844)" This reverts commit e997dca3333823ffe2ea3aea288299f551532dcd.
2023-09-29[OpenMP] Introduce the initial support for OpenMP kernel language (#66844)Shilei Tian1-0/+11
This patch starts the support for OpenMP kernel language, basically to write OpenMP target region in SIMT style, similar to kernel languages such as CUDA. What included in this first patch is the `ompx_bare` clause for `target teams` directive. When `ompx_bare` exists, globalization is disabled such that local variables will not be globalized. The runtime init/deinit function calls will not be emitted. That being said, almost all OpenMP executable directives are not supported in the region, such as parallel, task. This patch doesn't include the Sema checks for that, so the use of them is UB. Simple directives, such as atomic, can be used. We provide a set of APIs (for C, they are prefix with `ompx_`; for C++, they are in `ompx` namespace) to get thread id, block id, etc. For more details, you can refer to https://tianshilei.me/wp-content/uploads/llvm-hpc-2023.pdf.
2023-09-29Reland [NVPTX] Add support for maxclusterrank in launch_bounds (#66496) (#67667)Jakub Chlanda1-1/+2
This reverts commit 0afbcb20fd908f8bf9073697423da097be7db592.
2023-09-27Revert "[NVPTX] Add support for maxclusterrank in launch_bounds (#66496)"Sam McCall1-2/+1
This reverts commit dfab31b41b4988b6dc8129840eba68f0c36c0f13. SemaDeclAttr.cpp cannot depend on Basic's private headers (lib/Basic/Targets/NVPTX.h)
2023-09-27[NVPTX] Add support for maxclusterrank in launch_bounds (#66496)Jakub Chlanda1-1/+2
Since SM_90 CUDA supports specifying additional argument to the launch_bounds attribute: maxBlocksPerCluster, to express the maximum number of CTAs that can be part of the cluster. See: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#cluster-dimension-directives-maxclusterrank and https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#launch-bounds for details.
2023-08-24[OpenMP 5.1] Parsing and Sema support for `scope` directiveFazlay Rabbi1-0/+2
structured-block where clause is one of the following: private(list) reduction([reduction-modifier ,] reduction-identifier : list) nowait Differential Revision: https://reviews.llvm.org/D157933
2023-07-25Reapply "[OpenMP] Add the `ompx_attribute` clause for target directives"Johannes Doerfert1-0/+59
This reverts commit 0d12683046ca75fb08e285f4622f2af5c82609dc and reapplies ef9ec4bbcca2fa4f64df47bc426f1d1c59ea47e2 with an extension to fix the Flang build. Differential Revision: https://reviews.llvm.org/D156184
2023-07-25Revert "[OpenMP] Add the `ompx_attribute` clause for target directives"Aaron Ballman1-59/+0
This reverts commit ef9ec4bbcca2fa4f64df47bc426f1d1c59ea47e2. The changes broke several bots: https://lab.llvm.org/buildbot/#/builders/176/builds/3408 https://lab.llvm.org/buildbot/#/builders/198/builds/4028 https://lab.llvm.org/buildbot/#/builders/197/builds/8491 https://lab.llvm.org/buildbot/#/builders/197/builds/8491
2023-07-24[OpenMP] Add the `ompx_attribute` clause for target directivesJohannes Doerfert1-0/+59
CUDA and HIP have kernel attributes to tune the code generation (in the backend). To reuse this functionality for OpenMP target regions we introduce the `ompx_attribute` clause that takes these kernel attributes and emits code as if they had been attached to the kernel fuction (which is implicitly generated). To limit the impact, we only support three kernel attributes: `amdgpu_waves_per_eu`, for AMDGPU `amdgpu_flat_work_group_size`, for AMDGPU `launch_bounds`, for NVPTX The existing implementations of those attributes are used for error checking and code generation. `ompx_attribute` can be attached to any executable target region and it can hold more than one kernel attribute. Differential Revision: https://reviews.llvm.org/D156184
2023-07-07[OPENMP52] Deprecation of 'depend' clause in ordered directive.Jennifer Yu1-0/+3
BTW, I need change test ordered_doacross_codegen.c since I can not use macro _OPENMP >= 202111 due to use of -fopenmp-simd. Differential Revision: https://reviews.llvm.org/D154672
2023-07-06[OPENMP52] Support Support omp_cur_iteration modifier for doacrossJennifer Yu1-6/+45
clause. This is just syntax to make it easier for the user. It doesn't add any new functionality. for doacross(sink: omp_cur_iteration - 1) Equivalent to doacross(sink: ConterVar - 1, ...) doacross(source: omp_cur_iteration) Equivalent to doacross(source) And restriction is: OMP5.2 p.327 If vector is specified with the omp_cur_iteration keyword and with sink as the dependence-type then it must be omp_cur_iteration - 1. If vector is specified with source as the dependence-type then it must be omp_cur_iteration. Differential Revision: https://reviews.llvm.org/D154556
2023-06-29[OMP5.2] Initial support for doacross clause.Jennifer Yu1-16/+32
2023-05-26Fix wrong error message when compiling C souce code:Jennifer Yu1-1/+6
Currently emit error for uses_allocators(alloc(traits)): called object type 'omp_allocator_handle_t' (aka 'enum omp_allocator_handle_t') is not a function or function pointer To fix this, since "alloc" is Id expresison(spce 5.2), during the parser (in ParseOpenMP.cpp), using tryParseCXXIdExpression instead of ParseExpression for C. Differential Revision: https://reviews.llvm.org/D151517
2023-05-04[clang][Sema][NFC] Move `EnterExpressionEvaluationContext` to its own fileDavid Stone1-0/+1
Sema.h is huge. This makes a small reduction to it by moving EnterExpressionEvaluationContext into a new header, since it is an independent component. Differential Revision: https://reviews.llvm.org/D149796
2023-04-03[OpenMP][5.1] Fix parallel masked is ignored #59939Rafael A. Herrera Guaitero1-2/+2
Code generation support for 'parallel masked' directive. The `EmitOMPParallelMaskedDirective` was implemented. In addition, the appropiate device functions were added. Fix #59939. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D143527
2023-01-21[OpenMP] Introduce the `ompx_dyn_cgroup_mem(<N>)` clauseJohannes Doerfert1-0/+1
Dynamic memory allows users to allocate fast shared memory when a kernel is launched. We support a single size for all kernels via the `LIBOMPTARGET_SHARED_MEMORY_SIZE` environment variable but now we can control it per kernel invocation, hence allow computed values. Note: Only the nextgen plugins will allocate memory based on the clause, the old plugins will silently miscompile. Differential Revision: https://reviews.llvm.org/D141233