[PATCH] D39817: [CUDA] Fix std::min on device side to return the min, not the max.

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 13:55:17 PST 2017


jlebar created this revision.
Herald added a subscriber: sanjoy.

How embarrassing.

This is tested in the test-suite -- fix to come there in a separate
patch.


https://reviews.llvm.org/D39817

Files:
  clang/lib/Headers/cuda_wrappers/algorithm


Index: clang/lib/Headers/cuda_wrappers/algorithm
===================================================================
--- clang/lib/Headers/cuda_wrappers/algorithm
+++ clang/lib/Headers/cuda_wrappers/algorithm
@@ -80,7 +80,7 @@
 template <class __T>
 inline __device__ const __T &
 min(const __T &__a, const __T &__b) {
-  return __a < __b ? __b : __a;
+  return __a < __b ? __a : __b;
 }
 
 #ifdef _LIBCPP_END_NAMESPACE_STD


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39817.122151.patch
Type: text/x-patch
Size: 424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171108/2aed69ca/attachment.bin>


More information about the cfe-commits mailing list