summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGOpenMPRuntime.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [OPENMP]Simplify processing of context selectors, NFC.Alexey Bataev2019-11-221-49/+27
|
* [OPENMP]Remove unused template parameter, NFC.Alexey Bataev2019-11-211-1/+1
|
* [OPENMP50]Add device/kind context selector support.Alexey Bataev2019-11-211-23/+170
| | | | | | | | | | | | Summary: Added basic parsing/sema support for device/kind context selector. Reviewers: jdoerfert Subscribers: rampitec, aheejin, fedor.sergeev, simoncook, guansong, s.egerton, hfinkel, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70245
* [OPENMP]Rename function, NFC.Alexey Bataev2019-11-191-12/+12
| | | | Change the name of the CGOpenMPRuntime::emitOMPIfClause to CGOpenMPRuntime::emitIfClause.
* [OPENMP50]Fix PR44024: runtime assert in distribute construct.Alexey Bataev2019-11-181-1/+3
| | | | | If the code is emitted for distribute construct, the nonmonotonic modifier should not be added.
* [OpenMP] Use an explicit copy in a range-based forMark de Wever2019-11-121-7/+7
| | | | | | | | | | The std::pair<const clang::ValueDecl *, llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>> type will be copied in a range-based for loop. Make the copy explicit to avoid the -Wrange-loop-analysis warning. This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D70046
* [OPENMP50]Generalize handling of context matching/scoring.Alexey Bataev2019-11-111-36/+97
| | | | | | | | | | | | | | Summary: Untie context matching/scoring from the attribute for declare variant directive to simplify future uses in other context-dependent directives. Reviewers: jdoerfert Subscribers: guansong, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69952
* [OPENMP50]Simplify processing of context selector scores.Alexey Bataev2019-11-051-37/+1
| | | | | | If the context selector score was not specified, its value must be set to 0. Simplify the processing of unspecified scores + save memory in attribute representation.
* [OPENMP50]Add support for parallel master taskloop simd directive.Alexey Bataev2019-10-301-0/+5
| | | | Added full support for parallel master taskloop simd directive.
* [OPENMP50]Add support for master taskloop simd.Alexey Bataev2019-10-181-0/+5
| | | | | | Added trsing/semantics/codegen for combined construct master taskloop simd. llvm-svn: 375255
* [OPENMP]Improve use of the global tid parameter.Alexey Bataev2019-10-171-9/+14
| | | | | | | | If we can determined, that the global tid parameter can be used in the function, better to use it rather than calling __kmpc_global_thread_num function. llvm-svn: 375134
* [OPENMP]Fix thread id passed to outlined region in sequential parallelAlexey Bataev2019-10-171-5/+3
| | | | | | | | | regions. The real global thread id must be passed to the outlined region instead of the zero thread id. llvm-svn: 375119
* [OPENMP]Use different addresses for zeroed thread_id/bound_id.Alexey Bataev2019-10-161-3/+7
| | | | | | | | When the parallel region is called directly in the sequential region, the zeroed tid/bound id are used. But they must point to the different memory locations as the parameters are marked as noalias. llvm-svn: 375017
* [Clang][OpenMP Offload] Move offload registration code to the wrapperSergey Dmitriev2019-10-151-168/+3
| | | | | | | | | | The final list of OpenMP offload targets becomes known only at the link time and since offload registration code depends on the targets list it makes sense to delay offload registration code generation to the link time instead of adding it to the host part of every fat object. This patch moves offload registration code generation from clang to the offload wrapper tool. This is the last part of the OpenMP linker script elimination patch https://reviews.llvm.org/D64943 Differential Revision: https://reviews.llvm.org/D68746 llvm-svn: 374937
* [OPENMP50]Add support for 'parallel master taskloop' construct.Alexey Bataev2019-10-141-0/+5
| | | | | | | | | Added parsing/sema/codegen support for 'parallel master taskloop' constructs. Some of the clauses, like 'grainsize', 'num_tasks', 'final' and 'priority' are not supported in full, only constant expressions can be used currently in these clauses. llvm-svn: 374791
* [OPENMP50]Support for 'master taskloop' directive.Alexey Bataev2019-10-101-0/+5
| | | | | | Added full support for master taskloop directive. llvm-svn: 374437
* [OPENMP50]Support for declare variant directive for NVPTX target.Alexey Bataev2019-10-101-6/+7
| | | | | | | NVPTX does not support global aliases. Instead, we have to copy the full body of the variant function for the original function. llvm-svn: 374387
* [OPENMP50]Fix scoring of contexts with and without user provided scores.Alexey Bataev2019-10-091-2/+2
| | | | | | | The context selector with user provided score must have higher score than the context selector without user provided score. llvm-svn: 374224
* [OPENMP50]Multiple vendors in vendor context must be treated as logicalAlexey Bataev2019-10-081-1/+2
| | | | | | | | | | | | | and of vendors, not or. If several vendors are provided in the same vendor context trait, the context shall match only if all vendors are matching, not one of them. This is per OpenMP 5.0, 2.3.3 Matching and Scoring Context Selectors, all selectors in the construct, device, and implementation sets of the context selector appear in the corresponding trait set of the OpenMP context. llvm-svn: 374107
* Properly handle instantiation-dependent array bounds.Richard Smith2019-10-041-14/+14
| | | | | | | | | We previously failed to treat an array with an instantiation-dependent but not value-dependent bound as being an instantiation-dependent type. We now track the array bound expression as part of a constant array type if it's an instantiation-dependent expression. llvm-svn: 373685
* [OPENMP50]Codegen support for scores in context selectors.Alexey Bataev2019-10-031-10/+60
| | | | | | | | If the context selector has associated score and several contexts selectors matches current context, the function with the highest score must be selected. llvm-svn: 373661
* [OPENMP]Fix emission of the declare target variables in device mode.Alexey Bataev2019-10-031-2/+4
| | | | | | | Declare target variables must be emitted in device mode, target triples can be empty in this case. llvm-svn: 373624
* [OPENMP]Improve diagnostics for not found declare target entries.Alexey Bataev2019-10-031-16/+31
| | | | | | | We can point to the target region + emit parent functions names/real var names if they were not found in host module during device codegen. llvm-svn: 373620
* Fix unused variable warning. NFCI.Michael Liao2019-10-021-4/+4
| | | | llvm-svn: 373410
* [OPENMP50]Initial codegen for declare variant implementation vendor.Alexey Bataev2019-10-011-0/+127
| | | | | | | Initial implementation of global aliases emission for the declare variant pragma with implementation vendor context selector set. llvm-svn: 373387
* [OPENMP]Fix PR43330: OpenMP target: Mapping of partial arrays fails.Alexey Bataev2019-10-011-8/+27
| | | | | | Fixed calculation the size of the array sections. llvm-svn: 373374
* [Clang][OpenMP Offload] Create start/end symbols for the offloading entry ↵Sergey Dmitriev2019-09-271-9/+8
| | | | | | | | | | | | table with a help of a linker Linker automatically provides __start_<section name> and __stop_<section name> symbols to satisfy unresolved references if <section name> is representable as a C identifier (see https://sourceware.org/binutils/docs/ld/Input-Section-Example.html for details). These symbols indicate the start address and end address of the output section respectively. Therefore, renaming OpenMP offload entries section name from ".omp.offloading_entries" to "omp_offloading_entries" to use this feature. This is the first part of the patch for eliminating OpenMP linker script (please see https://reviews.llvm.org/D64943). Differential Revision: https://reviews.llvm.org/D68070 llvm-svn: 373118
* [OPENMP]Fix PR43355: DO not emit target calls if only -fopenmp-targetsAlexey Bataev2019-09-231-0/+4
| | | | | | | | | is not provided. We should not emit any target-dependent code if only -fopenmp flag is used and device targets are not provided to prevent compiler crash. llvm-svn: 372623
* [OPENMP]Call __kmpc_push_tripcount in task context.Alexey Bataev2019-09-231-30/+30
| | | | | | | | | Runtime function __kmpc_push_tripcount better to call inside of the task context for target regions. Otherwise, the libomptarget is unable to link the provided tripcount value for nowait target regions and completely looses this information. llvm-svn: 372609
* [OPENMP5.0]Add basic support for declare variant directive.Alexey Bataev2019-09-131-0/+5
| | | | | | | Added basic support for declare variant directive and its match clause with user context selector. llvm-svn: 371892
* [OPENMP5]Use nonmonotonic modifier by default for non-static andAlexey Bataev2019-08-231-8/+21
| | | | | | | | | | non-ordered loops. According to OpenMP 5.0, 2.9.2 Worksharing-Loop Construct, Desription, If the static schedule kind is specified or if the ordered clause is specified, and if the nonmonotonic modifier is not specified, the effect is as if the monotonic modifier is specified. Otherwise, unless the monotonic modifier is specified, the effect is as if the nonmonotonic modifier is specified. The first part of this requirement is implemented in runtime. Patch adds support for the second, nonmonotonic, part of this requirement. llvm-svn: 369801
* [OPENMP5.0]Add support for device_type clause in declare targetAlexey Bataev2019-08-231-2/+16
| | | | | | | | | | construct. OpenMP 5.0 introduced new clause for declare target directive, device_type clause, which may accept values host, nohost, and any. Host means that the function must be emitted only for the host, nohost - only for the device, and any - for both, device and the host. llvm-svn: 369775
* [OpenMP] Add support for close map modifier in ClangGheorghe-Teodor Bercea2019-08-091-2/+8
| | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support for the close map modifier in Clang. This ensures that the new map type is marked and passed to the OpenMP runtime appropriately. Additional regression tests have been merged from patch D55892 (author @saghir). Reviewers: ABataev, caomhin, jdoerfert, kkwli0 Reviewed By: ABataev Subscribers: kkwli0, Hahnfeld, saghir, guansong, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65341 llvm-svn: 368491
* [OpenMP 5.0] Codegen support for user-defined mappers.Michael Kruse2019-08-051-23/+476
| | | | | | | | | | | | | | | | | | | This patch implements the code generation for OpenMP 5.0 declare mapper (user-defined mapper) constructs. For each declare mapper, a mapper function is generated. These mapper functions will be called by the runtime and/or other mapper functions to achieve user defined mapping. The design slides can be found at https://github.com/lingda-li/public-sharing/blob/master/mapper_runtime_design.pptx Re-commit after revert in r367773 because r367755 changed the LLVM-IR output such that a CHECK line failed. Patch by Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D59474 llvm-svn: 367905
* Revert "[OpenMP 5.0] Codegen support for user-defined mappers."Michael Kruse2019-08-041-476/+23
| | | | | | | This reverts commit r367773. The test case OpenMP/declare_mapper_codegen.cpp is failing. llvm-svn: 367774
* [OpenMP 5.0] Codegen support for user-defined mappers.Michael Kruse2019-08-041-23/+476
| | | | | | | | | | | | | | | | This patch implements the code generation for OpenMP 5.0 declare mapper (user-defined mapper) constructs. For each declare mapper, a mapper function is generated. These mapper functions will be called by the runtime and/or other mapper functions to achieve user defined mapping. The design slides can be found at https://github.com/lingda-li/public-sharing/blob/master/mapper_runtime_design.pptx Patch by Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D59474 llvm-svn: 367773
* [OpenMP] Fix declare target link implementationGheorghe-Teodor Bercea2019-08-011-32/+40
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes the case where variables in different compilation units or the same compilation unit are under the declare target link clause AND have the same name. This also fixes the name clash error that occurs when unified memory is activated. The changes in this patch include: - Pointers to internal variables are given unique names. - Externally visible variables are given the same name as before. - All pointer variables (external or internal) are weakly linked. Reviewers: ABataev, jdoerfert, caomhin Reviewed By: ABataev Subscribers: lebedev.ri, guansong, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64592 llvm-svn: 367613
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-161-13/+13
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} llvm-svn: 366177
* Added mapping for pointers captured in Lambdas in OpenMP target regions,Alexey Bataev2019-07-111-9/+19
| | | | | | | | | | | | | | | | | | | by David Truby. Summary: This adds a zero length array section mapping for each pointer captured by a lambda that is used in a target region, as per section 2.19.7.1 of the OpenMP 5 specification. Reviewers: ABataev Reviewed By: ABataev Subscribers: guansong, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64558 llvm-svn: 365777
* [OPENMP]Generate correctly implicit flags for mapped data.Alexey Bataev2019-06-271-7/+19
| | | | | | | Implicit flag must not be emitted for explicitly specified firstprivate variables, but for implicitly captured sizes of the VLAs. llvm-svn: 364575
* [OPENMP]Fix PR41966: type mismatch in runtime functions.Alexey Bataev2019-06-251-53/+69
| | | | | | | Target-based runtime functions use int64_t type for sizes, while the compiler uses size_t type. It leads to miscompilation in 32 bit mode. llvm-svn: 364327
* P0840R2: support for [[no_unique_address]] attributeRichard Smith2019-06-201-1/+1
| | | | | | | | | | | | | | | | | Summary: Add support for the C++2a [[no_unique_address]] attribute for targets using the Itanium C++ ABI. This depends on D63371. Reviewers: rjmccall, aaron.ballman Subscribers: dschuff, aheejin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63451 llvm-svn: 363976
* [OpenMP] Add support for handling declare target to clause when unified ↵Gheorghe-Teodor Bercea2019-06-201-23/+50
| | | | | | | | | | | | | | | | | | | | | memory is required Summary: This patch adds support for the handling of the variables under the declare target to clause. The variables in this case are handled like link variables are. A pointer is created on the host and then mapped to the device. The runtime will then copy the address of the host variable in the device pointer. Reviewers: ABataev, AlexEichenberger, caomhin Reviewed By: ABataev Subscribers: guansong, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63108 llvm-svn: 363959
* [OpenMP] Add target task alloc function with device IDGheorghe-Teodor Bercea2019-06-141-12/+49
| | | | | | | | | | | | | | | | Summary: Add a new call to Clang to perform task allocation for the target. Reviewers: ABataev, AlexEichenberger, caomhin Reviewed By: ABataev, AlexEichenberger Subscribers: openmp-commits, Hahnfeld, guansong, jdoerfert, cfe-commits Tags: #clang, #openmp Differential Revision: https://reviews.llvm.org/D63009 llvm-svn: 363451
* [OpenMP] Avoid emitting maps for target link variables when unified memory ↵Gheorghe-Teodor Bercea2019-06-141-1/+6
| | | | | | | | | | | | | | | | | | is used Summary: This patch avoids the emission of maps for target link variables when unified memory is present. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: guansong, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60883 llvm-svn: 363435
* [CGOpenMPRuntime] emitX86DeclareSimdFunction - assert simdlen/cdtsize is not ↵Simon Pilgrim2019-05-221-2/+3
| | | | | | | | zero. NFCI. Fixes scan-build division by zero warning. llvm-svn: 361379
* [OpenMP] Add support for registering requires directives with the runtimeGheorghe-Teodor Bercea2019-05-211-1/+89
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support for the registration of the requires directives with the runtime. Each requires directive clause will enable a particular flag to be set. The set of flags is passed to the runtime to be checked for compatibility with other such flags coming from other object files. The registration function is called whenever OpenMP is present even if a requires directive is not present. This helps detect cases in which requires directives are used inconsistently. Reviewers: ABataev, AlexEichenberger, caomhin Reviewed By: ABataev, AlexEichenberger Subscribers: jholewinski, guansong, jfb, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60568 llvm-svn: 361298
* [OPENMP][NVPTX]Mark more functions as always_inline for betterAlexey Bataev2019-05-211-6/+10
| | | | | | | | | | | performance. Internally generated functions must be marked as always_inlines in most cases. Patch marks some extra reduction function + outlined parallel functions as always_inline for better performance, but only if the optimization is requested. llvm-svn: 361269
* Use llvm::stable_sortFangrui Song2019-04-241-6/+3
| | | | llvm-svn: 359098
* [OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.Alexey Bataev2019-04-171-18/+92
| | | | | | | | All target-parallel-based constructs can be run in SPMD mode from now on. Even if num_threads clauses or if clauses are used, such constructs can be executed in SPMD mode. llvm-svn: 358595
OpenPOWER on IntegriCloud