llvm-project/clang/lib
Samuel Antao d06239d359 [CUDA][OpenMP] Create generic offload action
Summary:
This patch replaces the CUDA specific action by a generic offload action. The offload action may have multiple dependences classier in “host” and “device”. The way this generic offloading action is used is very similar to what is done today by the CUDA implementation: it is used to set a specific toolchain and architecture to its dependences during the generation of jobs.

This patch also proposes propagating the offloading information through the action graph so that that information can be easily retrieved at any time during the generation of commands. This allows e.g. the "clang tool” to evaluate whether CUDA should be supported for the device or host and ptas to easily retrieve the target architecture.

This is an example of how the action graphs would look like (compilation of a single CUDA file with two GPU architectures)
```
0: input, "cudatests.cu", cuda, (host-cuda)
1: preprocessor, {0}, cuda-cpp-output, (host-cuda)
2: compiler, {1}, ir, (host-cuda)
3: input, "cudatests.cu", cuda, (device-cuda, sm_35)
4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_35)
5: compiler, {4}, ir, (device-cuda, sm_35)
6: backend, {5}, assembler, (device-cuda, sm_35)
7: assembler, {6}, object, (device-cuda, sm_35)
8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {7}, object
9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {6}, assembler
10: input, "cudatests.cu", cuda, (device-cuda, sm_37)
11: preprocessor, {10}, cuda-cpp-output, (device-cuda, sm_37)
12: compiler, {11}, ir, (device-cuda, sm_37)
13: backend, {12}, assembler, (device-cuda, sm_37)
14: assembler, {13}, object, (device-cuda, sm_37)
15: offload, "device-cuda (nvptx64-nvidia-cuda:sm_37)" {14}, object
16: offload, "device-cuda (nvptx64-nvidia-cuda:sm_37)" {13}, assembler
17: linker, {8, 9, 15, 16}, cuda-fatbin, (device-cuda)
18: offload, "host-cuda (powerpc64le-unknown-linux-gnu)" {2}, "device-cuda (nvptx64-nvidia-cuda)" {17}, ir
19: backend, {18}, assembler
20: assembler, {19}, object
21: input, "cuda", object
22: input, "cudart", object
23: linker, {20, 21, 22}, image
```
The changes in this patch pass the existent regression tests (keeps the existent functionality) and resulting binaries execute correctly in a Power8+K40 machine.

Reviewers: echristo, hfinkel, jlebar, ABataev, tra

Subscribers: guansong, andreybokhanko, tcramer, mkuron, cfe-commits, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 275645
2016-07-15 23:13:27 +00:00
..
ARCMigrate [objcmt] Fix a buffer overflow crash than can occur while modernizing enums. 2016-07-15 19:22:34 +00:00
AST [AST] Keep track of the left brace source location of a tag decl. 2016-07-15 18:11:33 +00:00
ASTMatchers [ASTMatchers] isSignedInteger() and isUnsignedInteger() 2016-07-12 06:36:00 +00:00
Analysis P0305R0: Semantic analysis and code generation for C++17 init-statement for 'if' and 'switch': 2016-07-14 00:11:03 +00:00
Basic [OpenMP] Sema and parsing for 'target parallel for simd' pragma 2016-07-14 02:54:56 +00:00
CodeGen AMDGPU: Remove legacy ldexp builtin 2016-07-15 21:33:06 +00:00
Driver [CUDA][OpenMP] Create generic offload action 2016-07-15 23:13:27 +00:00
Edit Remove autoconf support 2016-01-26 21:30:40 +00:00
Format clang-format: [JS] Allow top-level conditionals again. 2016-07-12 15:45:53 +00:00
Frontend [CUDA][OpenMP] Create generic offload action 2016-07-15 23:13:27 +00:00
FrontendTool Make it possible for AST plugins to enable themselves by default 2016-03-15 12:51:40 +00:00
Headers [X86][AVX512F] minor fix of the parameter names 2016-07-14 08:40:30 +00:00
Index [index] Create different USR if a property is a class property. 2016-07-15 22:18:19 +00:00
Lex [Lex] Speed up updateConsecutiveMacroArgTokens (NFC) 2016-07-07 22:38:29 +00:00
Parse [AST] Keep track of the left brace source location of a tag decl. 2016-07-15 18:11:33 +00:00
Rewrite Remove use of builtin comma operator. 2016-02-18 22:34:54 +00:00
Sema Push alias-declarations and alias-template declarations into scope even if 2016-07-15 20:53:25 +00:00
Serialization Revert r275481, r275490. This broke modules bootstrap. 2016-07-15 21:33:46 +00:00
StaticAnalyzer [OpenMP] Sema and parsing for 'target parallel for simd' pragma 2016-07-14 02:54:56 +00:00
Tooling Make tooling::applyAllReplacements return llvm::Expected<string> instead of empty string to indicate potential error. 2016-07-11 13:53:12 +00:00
CMakeLists.txt Fix build with various feature flag combinations 2014-07-14 22:17:22 +00:00