[test-suite] r281101 - [test-suite] Check that we can use std::shared_future from CUDA host code.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 14:36:44 PDT 2016


Author: jlebar
Date: Fri Sep  9 16:36:44 2016
New Revision: 281101

URL: http://llvm.org/viewvc/llvm-project?rev=281101&view=rev
Log:
[test-suite] Check that we can use std::shared_future from CUDA host code.

Summary: This checks for the clang bug fixed in https://reviews.llvm.org/D24407.

Reviewers: tra

Subscribers: llvm-commits, beanz

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

Added:
    test-suite/trunk/External/CUDA/future.cu
Modified:
    test-suite/trunk/External/CUDA/CMakeLists.txt

Modified: test-suite/trunk/External/CUDA/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/CMakeLists.txt?rev=281101&r1=281100&r2=281101&view=diff
==============================================================================
--- test-suite/trunk/External/CUDA/CMakeLists.txt (original)
+++ test-suite/trunk/External/CUDA/CMakeLists.txt Fri Sep  9 16:36:44 2016
@@ -46,6 +46,7 @@ endmacro()
 macro(create_local_cuda_tests VariantSuffix)
   create_one_local_test(axpy axpy.cu)
   create_one_local_test(empty empty.cu)
+  create_one_local_test(future future.cu)
 endmacro()
 
 macro(thrust_make_test_name TestName TestSourcePath)

Added: test-suite/trunk/External/CUDA/future.cu
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/future.cu?rev=281101&view=auto
==============================================================================
--- test-suite/trunk/External/CUDA/future.cu (added)
+++ test-suite/trunk/External/CUDA/future.cu Fri Sep  9 16:36:44 2016
@@ -0,0 +1,21 @@
+// Make sure that we can compile CUDA files that include <future> and use
+// std::shared_future.
+//
+// At one point in time this didn't work because clang defined different values
+// for __GCC_ATOMIC_INT_LOCK_FREE on host and device.  This caused libstdc++
+// not to define std::shared_future when compiling for device, resulting in
+// compile errors (even though we only use std::shared_future in host code).
+
+#if __cplusplus >= 201103L
+#include <future>
+
+void foo() {
+  std::shared_future<int> x;
+}
+#else
+#warning Skipping test because not compiled in C++11 mode.
+#endif
+
+int main() {
+  return 0;
+}




More information about the llvm-commits mailing list