diff options
| author | Artem Belevich <tra@google.com> | 2015-07-13 20:21:06 +0000 |
|---|---|---|
| committer | Artem Belevich <tra@google.com> | 2015-07-13 20:21:06 +0000 |
| commit | cd42e7f77a788969bc9365b8b0b2f21e2308e04e (patch) | |
| tree | 454855373f13ce3944547ca616219084bb0f4bbe /clang/test/Index | |
| parent | 6145ad2d3654350110e25460d0fcd9656a46e36c (diff) | |
| download | bcm5719-llvm-cd42e7f77a788969bc9365b8b0b2f21e2308e04e.tar.gz bcm5719-llvm-cd42e7f77a788969bc9365b8b0b2f21e2308e04e.zip | |
[cuda] Driver changes to compile and stitch together host and device-side CUDA code.
- Changed driver pipeline to compile host and device side of CUDA
files and incorporate results of device-side compilation into host
object file.
- Added a test for cuda pipeline creation in clang driver.
New clang options:
--cuda-host-only - Do host-side compilation only.
--cuda-device-only - Do device-side compilation only.
--cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
than once in which case one device-compilation will be done per
unique specified GPU architecture.
Differential Revision: http://reviews.llvm.org/D9509
llvm-svn: 242058
Diffstat (limited to 'clang/test/Index')
| -rw-r--r-- | clang/test/Index/attributes-cuda.cu | 22 | ||||
| -rw-r--r-- | clang/test/Index/index-file.cu | 9 |
2 files changed, 21 insertions, 10 deletions
diff --git a/clang/test/Index/attributes-cuda.cu b/clang/test/Index/attributes-cuda.cu index 824bdb4c883..51f4aedd198 100644 --- a/clang/test/Index/attributes-cuda.cu +++ b/clang/test/Index/attributes-cuda.cu @@ -1,4 +1,6 @@ // RUN: c-index-test -test-load-source all -x cuda %s | FileCheck %s +// RUN: c-index-test -test-load-source all -x cuda --cuda-host-only %s | FileCheck %s +// RUN: c-index-test -test-load-source all -x cuda --cuda-device-only %s | FileCheck %s __attribute__((device)) void f_device(); __attribute__((global)) void f_global(); @@ -6,13 +8,13 @@ __attribute__((constant)) int* g_constant; __attribute__((shared)) float *g_shared; __attribute__((host)) void f_host(); -// CHECK: attributes-cuda.cu:3:30: FunctionDecl=f_device:3:30 -// CHECK-NEXT: attributes-cuda.cu:3:16: attribute(device) -// CHECK: attributes-cuda.cu:4:30: FunctionDecl=f_global:4:30 -// CHECK-NEXT: attributes-cuda.cu:4:16: attribute(global) -// CHECK: attributes-cuda.cu:5:32: VarDecl=g_constant:5:32 (Definition) -// CHECK-NEXT: attributes-cuda.cu:5:16: attribute(constant) -// CHECK: attributes-cuda.cu:6:32: VarDecl=g_shared:6:32 (Definition) -// CHECK-NEXT: attributes-cuda.cu:6:16: attribute(shared) -// CHECK: attributes-cuda.cu:7:28: FunctionDecl=f_host:7:28 -// CHECK-NEXT: attributes-cuda.cu:7:16: attribute(host) +// CHECK: attributes-cuda.cu:5:30: FunctionDecl=f_device:5:30 +// CHECK-NEXT: attributes-cuda.cu:5:16: attribute(device) +// CHECK: attributes-cuda.cu:6:30: FunctionDecl=f_global:6:30 +// CHECK-NEXT: attributes-cuda.cu:6:16: attribute(global) +// CHECK: attributes-cuda.cu:7:32: VarDecl=g_constant:7:32 (Definition) +// CHECK-NEXT: attributes-cuda.cu:7:16: attribute(constant) +// CHECK: attributes-cuda.cu:8:32: VarDecl=g_shared:8:32 (Definition) +// CHECK-NEXT: attributes-cuda.cu:8:16: attribute(shared) +// CHECK: attributes-cuda.cu:9:28: FunctionDecl=f_host:9:28 +// CHECK-NEXT: attributes-cuda.cu:9:16: attribute(host) diff --git a/clang/test/Index/index-file.cu b/clang/test/Index/index-file.cu new file mode 100644 index 00000000000..26b93f06945 --- /dev/null +++ b/clang/test/Index/index-file.cu @@ -0,0 +1,9 @@ +// Make sure we can process CUDA file even if driver creates multiple jobs +// RUN: c-index-test -test-load-source all %s | FileCheck %s -check-prefix=CHECK-ANY +// Make sure we process correct side of cuda compilation +// RUN: c-index-test -test-load-source all --cuda-host-only %s | FileCheck %s -check-prefix=CHECK-HOST +// RUN: c-index-test -test-load-source all --cuda-device-only %s | FileCheck %s -check-prefix=CHECK-DEVICE + +// CHECK-ANY: macro definition=__cplusplus +// CHECK-HOST-NOT: macro definition=__CUDA_ARCH__ +// CHECK-DEVICE: macro definition=__CUDA_ARCH__ |

