[PATCH] D24428: [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:02:04 PDT 2016


jlebar created this revision.
jlebar added a reviewer: tra.
jlebar added a subscriber: llvm-commits.
Herald added a subscriber: beanz.

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

https://reviews.llvm.org/D24428

Files:
  External/CUDA/CMakeLists.txt
  External/CUDA/future.cu

Index: External/CUDA/future.cu
===================================================================
--- /dev/null
+++ External/CUDA/future.cu
@@ -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;
+}
Index: External/CUDA/CMakeLists.txt
===================================================================
--- External/CUDA/CMakeLists.txt
+++ External/CUDA/CMakeLists.txt
@@ -46,6 +46,7 @@
 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24428.70902.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160909/fbdfd06d/attachment.bin>


More information about the llvm-commits mailing list