summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGOpenMPRuntime.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* [AArch64] Implement Vector Funtion ABI name mangling.Alexey Bataev2019-04-161-3/+318
| | | | | | | | | | | | | | | | | | | Summary: The name mangling scheme is defined in section 3.5 of the "Vector function application binary interface specification for AArch64" [1]. [1] https://developer.arm.com/products/software-development-tools/hpc/arm-compiler-for-hpc/vector-function-abi Reviewers: rengolin, ABataev Reviewed By: ABataev Subscribers: sdesmalen, javed.absar, kristof.beyls, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60583 llvm-svn: 358490
* [OPENMP]Improve detection of number of teams, threads in targetAlexey Bataev2019-04-101-189/+365
| | | | | | | | | | regions. Added more complex analysis for number of teams and number of threads in the target regions, also merged related common code between CGOpenMPRuntime and CGOpenMPRuntimeNVPTX classes. llvm-svn: 358126
* [OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.Alexey Bataev2019-04-081-10/+15
| | | | | | | Functions __kmpc_alloc/__kmpc_free are updated with the new interfaces. Patch synchronizes the compiler with the runtime. llvm-svn: 357933
* [OPENMP]Add codegen for firstprivate vars with allocate clause.Alexey Bataev2019-04-031-2/+5
| | | | | | | Added codegen/test for the firstprivatized variables with the allocate clause. llvm-svn: 357617
* [OPENMP]Add codegen for private vars with allocate clause.Alexey Bataev2019-04-021-6/+2
| | | | | | | Added codegen/test for the privatized variables with the allocate clause. llvm-svn: 357514
* [OPENMP]Fix mapping of the pointers captured by reference.Alexey Bataev2019-04-021-3/+12
| | | | | | | | If the pointer is captured by reference, it must be mapped as _PTR_AND_OBJ kind of mapping to correctly translate the pointer address on the device. llvm-svn: 357488
* [OPENMP] Simplify codegen for allocate directive on local variables.Alexey Bataev2019-03-211-45/+41
| | | | | | | Simplified codegen for the allocate directive for local variables, initial implementation of the codegen for NVPTX target. llvm-svn: 356710
* [OPENMP]Codegen support for allocate directive on global variables.Alexey Bataev2019-03-211-0/+24
| | | | | | | | | For the global variables the allocate directive must specify only the predefined allocator. This allocator must be translated into the correct form of the address space for the targets that support different address spaces. llvm-svn: 356702
* Fix unused variable warning. NFCI.Simon Pilgrim2019-03-191-1/+1
| | | | llvm-svn: 356497
* [OPENMP]Remove unused parameter, NFC.Alexey Bataev2019-03-191-5/+5
| | | | | | | Parameter CodeGenModule &CGM is not required for CGOpenMPRuntime member functions, since class holds the reference to the CGM. llvm-svn: 356480
* [OPENMP] Codegen for local variables with the allocate pragma.Alexey Bataev2019-03-191-0/+97
| | | | | | | | Added initial codegen for the local variables with the #pragma omp allocate directive. Instead of allocating the variables on the stack, __kmpc_alloc|__kmpc_free functions are used for memory (de-)allocation. llvm-svn: 356472
* [OPENMP] Set scheduling for doacross loops as schedule, 1.Alexey Bataev2019-03-181-0/+18
| | | | | | | The default scheduling for doacross loops is changed from static to static, 1. llvm-svn: 356388
* [OPENMP]Fix PR37283: Assertion failure on openmp task with by referenceAlexey Bataev2019-03-131-1/+1
| | | | | | | | | | array. If the firstprivate variable is a reference, we may incorrectly classify the kind of the private copy. Use the type of the private copy instead of the original shared variable. llvm-svn: 356098
* [OPENMP]Allow to redefine entry for the variables definitions.Alexey Bataev2019-03-121-3/+18
| | | | | | | | | | | If the variable was declared and marked as declare target, a new offload entry with size 0 is created. But if later a definition is created and marked as declare target, this definition is not added to the entry set and the definition remains not mapped to the target. Patch fixes this problem allowing to redefine the size and linkage for previously registered declaration. llvm-svn: 355960
* [OPENMP 5.0]Add initial support for 'allocate' directive.Alexey Bataev2019-03-071-0/+3
| | | | | | | Added parsing/sema analysis/serialization/deserialization support for 'allocate' directive. llvm-svn: 355614
* [OPENMP]Target region: emit const firstprivates as globals with constantAlexey Bataev2019-03-051-8/+62
| | | | | | | | | | | | memory. If the variable with the constant non-scalar type is firstprivatized in the target region, the local copy is created with the data copying. Instead, we allocate the copy in the constant memory and avoid extra copying in the outlined target regions. This global copy is used in the target regions without loss of the performance. llvm-svn: 355418
* [opaque pointer types] Cleanup CGBuilder's Create*GEP.James Y Knight2019-02-091-33/+15
| | | | | | | | | | | | | | The various EltSize, Offset, DataLayout, and StructLayout arguments are all computable from the Address's element type and the DataLayout which the CGBuilder already has access to. After having previously asserted that the computed values are the same as those passed in, now remove the redundant arguments from CGBuilder's Create*GEP functions. Differential Revision: https://reviews.llvm.org/D57767 llvm-svn: 353629
* [opaque pointer types] Cleanup CGBuilder's Create*GEP.James Y Knight2019-02-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Some of these functions take some extraneous arguments, e.g. EltSize, Offset, which are computable from the Type and DataLayout. Add some asserts to ensure that the computed values are consistent with the passed-in values, in preparation for eliminating the extraneous arguments. This also asserts that the Type is an Array for the calls named "Array" and a Struct for the calls named "Struct". Then, correct a couple of errors: 1. Using CreateStructGEP on an array type. (this causes the majority of the test differences, as struct GEPs are created with i32 indices, while array GEPs are created with i64 indices) 2. Passing the wrong Offset to CreateStructGEP in TargetInfo.cpp on x86-64 NACL (which uses 32-bit pointers). Differential Revision: https://reviews.llvm.org/D57766 llvm-svn: 353529
* [opaque pointer types] Pass function types for runtime function calls.James Y Knight2019-02-051-58/+63
| | | | | | | | | | | | | Emit{Nounwind,}RuntimeCall{,OrInvoke} have been modified to take a FunctionCallee as an argument, and CreateRuntimeFunction has been modified to return a FunctionCallee. All callers have been updated. Additionally, CreateBuiltinFunction is removed, as it was redundant with CreateRuntimeFunction after some previous changes. Differential Revision: https://reviews.llvm.org/D57668 llvm-svn: 353184
* [OpenMP] Adding support to the mutexinoutset dep-typeSergi Mateo Bellido2019-02-041-1/+4
| | | | | | | | | | | Summary: this commit adds support to a new dependence type introduced in OpenMP 5.0. The LLVM OpenMP RTL already supports this feature, so we only need to modify CLANG to take advantage of them. Differential Revision: https://reviews.llvm.org/D57576 llvm-svn: 353018
* [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.Michael Kruse2019-02-011-0/+3
| | | | | | | | | | | | | | | | | This patch implements parsing and sema for "omp declare mapper" directive. User defined mapper, i.e., declare mapper directive, is a new feature in OpenMP 5.0. It is introduced to extend existing map clauses for the purpose of simplifying the copy of complex data structures between host and device (i.e., deep copy). An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper. Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D56326 llvm-svn: 352906
* Cleanup: replace uses of CallSite with CallBase.James Y Knight2019-01-301-1/+0
| | | | llvm-svn: 352595
* Adjust documentation for git migration.James Y Knight2019-01-291-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes most references to the paths: llvm.org/svn/ llvm.org/git/ llvm.org/viewvc/ github.com/llvm-mirror/ github.com/llvm-project/ reviews.llvm.org/diffusion/ to instead point to https://github.com/llvm/llvm-project. This is *not* a trivial substitution, because additionally, all the checkout instructions had to be migrated to instruct users on how to use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of checking out various projects into various subdirectories. I've attempted to not change any scripts here, only documentation. The scripts will have to be addressed separately. Additionally, I've deleted one document which appeared to be outdated and unneeded: lldb/docs/building-with-debug-llvm.txt Differential Revision: https://reviews.llvm.org/D57330 llvm-svn: 352514
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Emit !callback metadata and introduce the callback attributeJohannes Doerfert2019-01-191-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | With commit r351627, LLVM gained the ability to apply (existing) IPO optimizations on indirections through callbacks, or transitive calls. The general idea is that we use an abstraction to hide the middle man and represent the callback call in the context of the initial caller. It is described in more detail in the commit message of the LLVM patch r351627, the llvm::AbstractCallSite class description, and the language reference section on callback-metadata. This commit enables clang to emit !callback metadata that is understood by LLVM. It does so in three different cases: 1) For known broker functions declarations that are directly generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel. 2) For known broker functions that are identified by their name and source location through the builtin detection, e.g., pthread_create from the POSIX thread API. 3) For user annotated functions that carry the "callback(callee, ...)" attribute. The attribute has to include the name, or index, of the callback callee and how the passed arguments can be identified (as many as the callback callee has). See the callback attribute documentation for detailed information. Differential Revision: https://reviews.llvm.org/D55483 llvm-svn: 351629
* [OPENMP]Add call to __kmpc_push_target_tripcount() function.Alexey Bataev2019-01-071-0/+189
| | | | | | | | | | Each we create the target regions with the teams distribute inner region, we can better estimate number of the teams required to execute the target region. Function __kmpc_push_target_tripcount() is used for purpose, which accepts device_id and the number of the iterations, performed by the associated loop. llvm-svn: 350571
* [OpenMP] Added support for explicit mapping of classes using 'this' pointer. ↵Patrick Lyster2019-01-021-2/+9
| | | | | | Differential revision: https://reviews.llvm.org/D55982 llvm-svn: 350252
* [AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.Bruno Ricci2018-12-211-1/+1
| | | | | | | | | All of the other constructors already take a reference to the AST context. This avoids calling Decl::getASTContext in most cases. Additionally move the definition of the constructor from Expr.h to Expr.cpp since it is calling DeclRefExpr::computeDependence. NFC. llvm-svn: 349901
OpenPOWER on IntegriCloud