Cutlass
CUDA Templates for Linear Algebra Subroutines and Solvers
platform.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  **************************************************************************************************/
25 
26 #pragma once
27 
94 //-----------------------------------------------------------------------------
95 // Dependencies
96 //-----------------------------------------------------------------------------
97 
98 #include <stdint.h>
99 
100 #if !defined(__CUDACC_RTC__)
101 //-----------------------------------------------------------------------------
102 // Include STL files that platform provides functionality for
103 //-----------------------------------------------------------------------------
104 
105 #include <algorithm> // Minimum/maximum operations
106 #include <cstddef> // nullptr_t
107 #include <functional> // Arithmetic operations
108 #include <utility> // For methods on std::pair
109 #if (!defined(_MSC_VER) && (__cplusplus >= 201103L)) || (defined(_MSC_VER) && (_MS_VER >= 1500))
110 #include <type_traits> // For integral constants, conditional metaprogramming, and type traits
111 #endif
112 
113 #include <cutlass/cutlass.h>
114 
115 #endif
116 /******************************************************************************
117  * Macros
118  ******************************************************************************/
119 //-----------------------------------------------------------------------------
120 // Keywords
121 //-----------------------------------------------------------------------------
122 
124 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1900))
125 #ifndef noexcept
126 #define noexcept
127 #endif
128 #ifndef constexpr
129 #define constexpr
130 #endif
131 #endif
132 
134 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1310))
135 #ifndef nullptr
136 #define nullptr 0
137 #endif
138 #endif
139 
141 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1600))
142 #ifndef static_assert
143 #define __platform_cat_(a, b) a##b
144 #define __platform_cat(a, b) __platform_cat_(a, b)
145 #define static_assert(__e, __m) typedef int __platform_cat(AsSeRt, __LINE__)[(__e) ? 1 : -1]
146 #endif
147 #endif
148 
149 //-----------------------------------------------------------------------------
150 // Functions
151 //-----------------------------------------------------------------------------
152 
154 #ifndef __NV_STD_MAX
155 #define __NV_STD_MAX(a, b) (((b) > (a)) ? (b) : (a))
156 #endif
157 
159 #ifndef __NV_STD_MIN
160 #define __NV_STD_MIN(a, b) (((b) < (a)) ? (b) : (a))
161 #endif
162 
163 /******************************************************************************
164  * Re-implementations
165  ******************************************************************************/
166 namespace cutlass {
167 namespace platform {
168 
169 //-----------------------------------------------------------------------------
170 // Arithmetic operations, comparisons <functional>
171 //-----------------------------------------------------------------------------
172 
174 template <typename T>
175 struct plus {
176  CUTLASS_HOST_DEVICE constexpr T operator()(const T& lhs, const T& rhs) const { return lhs + rhs; }
177 };
178 
180 template <typename T>
181 struct less {
182  CUTLASS_HOST_DEVICE constexpr bool operator()(const T& lhs, const T& rhs) const {
183  return lhs < rhs;
184  }
185 };
186 
188 template <typename T>
189 struct greater {
190  CUTLASS_HOST_DEVICE constexpr bool operator()(const T& lhs, const T& rhs) const {
191  return lhs > rhs;
192  }
193 };
194 
195 //-----------------------------------------------------------------------------
196 // Minimum/maximum operations <algorithm>
197 //-----------------------------------------------------------------------------
198 
200 template <typename T>
201 CUTLASS_HOST_DEVICE constexpr const T& min(const T& a, const T& b) {
202  return (b < a) ? b : a;
203 }
204 
206 template <typename T>
207 CUTLASS_HOST_DEVICE constexpr const T& max(const T& a, const T& b) {
208  return (a < b) ? b : a;
209 }
210 
211 #if !defined(__CUDACC_RTC__)
212 //-----------------------------------------------------------------------------
213 // Methods on std::pair
214 //-----------------------------------------------------------------------------
215 
216 using std::pair;
217 
218 template <class T1, class T2>
219 CUTLASS_HOST_DEVICE constexpr bool operator==(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs) {
220  return (lhs.first == rhs.first) && (lhs.second == rhs.second);
221 }
222 
223 template <class T1, class T2>
224 CUTLASS_HOST_DEVICE constexpr bool operator!=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs) {
225  return (lhs.first != rhs.first) && (lhs.second != rhs.second);
226 }
227 
228 template <class T1, class T2>
229 CUTLASS_HOST_DEVICE constexpr bool operator<(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs) {
230  return (lhs.first < rhs.first) ? true : (rhs.first < lhs.first) ? false
231  : (lhs.second < rhs.second);
232 }
233 
234 template <class T1, class T2>
235 CUTLASS_HOST_DEVICE constexpr bool operator<=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs) {
236  return !(rhs < lhs);
237 }
238 
239 template <class T1, class T2>
240 CUTLASS_HOST_DEVICE constexpr bool operator>(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs) {
241  return (rhs < lhs);
242 }
243 
244 template <class T1, class T2>
245 CUTLASS_HOST_DEVICE constexpr bool operator>=(const pair<T1, T2>& lhs, const pair<T1, T2>& rhs) {
246  return !(lhs < rhs);
247 }
248 
249 template <class T1, class T2>
250 CUTLASS_HOST_DEVICE std::pair<T1, T2> make_pair(T1 t, T2 u) {
251  std::pair<T1, T2> retval;
252  retval.first = t;
253  retval.second = u;
254  return retval;
255 }
256 #endif
257 
258 } // namespace platform
259 
260 /******************************************************************************
261  * Implementations of C++ 11/14/17/... STL features
262  ******************************************************************************/
263 
264 namespace platform {
265 
266 //-----------------------------------------------------------------------------
267 // Integral constant helper types <type_traits>
268 //-----------------------------------------------------------------------------
269 
270 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1500))
271 
273 template <typename value_t, value_t V>
275 
277 template <typename value_t, value_t V>
278 struct integral_constant {
279  static const value_t value = V;
280 
281  typedef value_t value_type;
283 
284  CUTLASS_HOST_DEVICE operator value_type() const { return value; }
285 
286  CUTLASS_HOST_DEVICE const value_type operator()() const { return value; }
287 };
288 
289 #else
290 
291 using std::integral_constant;
292 using std::pair;
293 
294 #endif
295 
298 
301 
302 #if (!defined(_MSC_VER) && (__cplusplus < 201402L)) || (defined(_MSC_VER) && (_MSC_VER < 1900))
303 
305 template <bool V>
307 
308 #else
309 
310 using std::bool_constant;
311 
312 #endif
313 
314 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1700))
315 
317 struct nullptr_t {};
318 
319 #else
320 
321 using std::nullptr_t;
322 
323 #endif
324 
325 //-----------------------------------------------------------------------------
326 // Conditional metaprogramming <type_traits>
327 //-----------------------------------------------------------------------------
328 
329 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1600))
330 
332 template <bool C, typename T = void>
333 struct enable_if {
334  typedef T type;
335 };
336 
338 template <typename T>
339 struct enable_if<false, T> {};
340 
342 template <bool B, class T, class F>
343 struct conditional {
344  typedef T type;
345 };
346 
348 template <class T, class F>
349 struct conditional<false, T, F> {
350  typedef F type;
351 };
352 
353 #else
354 
355 using std::enable_if;
356 using std::conditional;
357 
358 #endif
359 
360 //-----------------------------------------------------------------------------
361 // Const/volatility specifiers <type_traits>
362 //-----------------------------------------------------------------------------
363 
364 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1500))
365 
367 template <typename T>
368 struct remove_const {
369  typedef T type;
370 };
371 
373 template <typename T>
374 struct remove_const<const T> {
375  typedef T type;
376 };
377 
379 template <typename T>
381  typedef T type;
382 };
383 
385 template <typename T>
386 struct remove_volatile<volatile T> {
387  typedef T type;
388 };
389 
391 template <typename T>
392 struct remove_cv {
394 };
395 
396 #else
397 
398 using std::remove_const;
399 using std::remove_volatile;
400 using std::remove_cv;
401 
402 #endif
403 
404 //-----------------------------------------------------------------------------
405 // Type relationships <type_traits>
406 //-----------------------------------------------------------------------------
407 
408 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1500))
409 
411 template <typename A, typename B>
412 struct is_same : false_type {};
413 
415 template <typename A>
416 struct is_same<A, A> : true_type {};
417 
419 template <typename BaseT, typename DerivedT>
421  typedef char (&yes)[1];
422  typedef char (&no)[2];
423 
424  template <typename B, typename D>
425  struct dummy {
426  CUTLASS_HOST_DEVICE operator B*() const;
427  CUTLASS_HOST_DEVICE operator D*();
428  };
429 
430  template <typename T>
431  CUTLASS_HOST_DEVICE static yes check(DerivedT*, T);
432 
433  CUTLASS_HOST_DEVICE static no check(BaseT*, int);
434 
435  static const bool value = sizeof(check(dummy<BaseT, DerivedT>(), int())) == sizeof(yes);
436 };
437 
439 template <typename BaseT, typename DerivedT>
441  : integral_constant<bool,
442  (is_base_of_helper<typename remove_cv<BaseT>::type,
443  typename remove_cv<DerivedT>::type>::value) ||
444  (is_same<typename remove_cv<BaseT>::type,
445  typename remove_cv<DerivedT>::type>::value)> {};
446 
447 #else
448 
449 using std::is_same;
450 using std::is_base_of;
451 
452 #endif
453 
454 //-----------------------------------------------------------------------------
455 // Type properties <type_traits>
456 //-----------------------------------------------------------------------------
457 
458 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1500))
459 
461 template <typename T>
463 template <typename T>
464 struct is_volatile<volatile T> : true_type {};
465 
467 template <typename T>
469 
471 template <typename T>
472 struct is_pointer_helper<T*> : true_type {};
473 
475 template <typename T>
476 struct is_pointer : is_pointer_helper<typename remove_cv<T>::type> {};
477 
479 template <typename T>
480 struct is_void : is_same<void, typename remove_cv<T>::type> {};
481 
483 template <typename T>
485 template <>
486 struct is_integral<char> : true_type {};
487 template <>
488 struct is_integral<signed char> : true_type {};
489 template <>
490 struct is_integral<unsigned char> : true_type {};
491 template <>
492 struct is_integral<short> : true_type {};
493 template <>
494 struct is_integral<unsigned short> : true_type {};
495 template <>
496 struct is_integral<int> : true_type {};
497 template <>
498 struct is_integral<unsigned int> : true_type {};
499 template <>
500 struct is_integral<long> : true_type {};
501 template <>
502 struct is_integral<unsigned long> : true_type {};
503 template <>
504 struct is_integral<long long> : true_type {};
505 template <>
506 struct is_integral<unsigned long long> : true_type {};
507 template <typename T>
508 struct is_integral<volatile T> : is_integral<T> {};
509 template <typename T>
510 struct is_integral<const T> : is_integral<T> {};
511 template <typename T>
512 struct is_integral<const volatile T> : is_integral<T> {};
513 
515 template <typename T>
517  : integral_constant<bool,
518  (is_same<float, typename remove_cv<T>::type>::value ||
519  is_same<double, typename remove_cv<T>::type>::value)> {};
520 
522 template <typename T>
524  : integral_constant<bool, (is_integral<T>::value || is_floating_point<T>::value)> {};
525 
527 template <typename T>
529  : integral_constant<bool,
530  (is_arithmetic<T>::value || is_void<T>::value ||
531  is_same<nullptr_t, typename remove_cv<T>::type>::value)> {};
532 
533 #else
534 
535 using std::is_volatile;
536 using std::is_pointer;
537 using std::is_void;
538 using std::is_integral;
539 using std::is_floating_point;
540 using std::is_arithmetic;
541 using std::is_fundamental;
542 
543 #endif
544 
545 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1800)) || \
546  (defined(__GNUG__) && (__GNUC__ < 5))
547 
558 template <typename T>
560  : integral_constant<bool, (is_fundamental<T>::value || is_pointer<T>::value)> {};
561 
562 #else
563 
564 using std::is_trivially_copyable;
565 
566 #endif
567 
568 //-----------------------------------------------------------------------------
569 // Alignment and layout utilities
570 //-----------------------------------------------------------------------------
571 
572 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1500))
573 
575 template <typename value_t>
576 struct alignment_of {
577  struct pad {
578  value_t val;
579  char byte;
580  };
581 
582  enum { value = sizeof(pad) - sizeof(value_t) };
583 };
584 
585 #else
586 
587 template <typename value_t>
588 struct alignment_of : std::alignment_of<value_t> {};
589 
590 #endif
591 
592 /* 16B specializations where 32-bit Win32 host compiler disagrees with device compiler */
593 template <>
594 struct alignment_of<int4> {
595  enum { value = 16 };
596 };
597 template <>
598 struct alignment_of<uint4> {
599  enum { value = 16 };
600 };
601 template <>
602 struct alignment_of<float4> {
603  enum { value = 16 };
604 };
605 template <>
606 struct alignment_of<long4> {
607  enum { value = 16 };
608 };
609 template <>
610 struct alignment_of<ulong4> {
611  enum { value = 16 };
612 };
613 template <>
614 struct alignment_of<longlong2> {
615  enum { value = 16 };
616 };
617 template <>
618 struct alignment_of<ulonglong2> {
619  enum { value = 16 };
620 };
621 template <>
622 struct alignment_of<double2> {
623  enum { value = 16 };
624 };
625 template <>
626 struct alignment_of<longlong4> {
627  enum { value = 16 };
628 };
629 template <>
630 struct alignment_of<ulonglong4> {
631  enum { value = 16 };
632 };
633 template <>
634 struct alignment_of<double4> {
635  enum { value = 16 };
636 };
637 
638 // Specializations for volatile/const qualified types
639 template <typename value_t>
640 struct alignment_of<volatile value_t> : alignment_of<value_t> {};
641 template <typename value_t>
642 struct alignment_of<const value_t> : alignment_of<value_t> {};
643 template <typename value_t>
644 struct alignment_of<const volatile value_t> : alignment_of<value_t> {};
645 
646 #if (!defined(_MSC_VER) && (__cplusplus < 201103L)) || (defined(_MSC_VER) && (_MSC_VER < 1800))
647 
648 template <size_t Align>
650 template <>
651 struct __align__(1) aligned_chunk<1> {
652  uint8_t buff;
653 };
654 template <>
655 struct __align__(2) aligned_chunk<2> {
656  uint16_t buff;
657 };
658 template <>
659 struct __align__(4) aligned_chunk<4> {
660  uint32_t buff;
661 };
662 template <>
663 struct __align__(8) aligned_chunk<8> {
664  uint32_t buff[2];
665 };
666 template <>
667 struct __align__(16) aligned_chunk<16> {
668  uint32_t buff[4];
669 };
670 template <>
671 struct __align__(32) aligned_chunk<32> {
672  uint32_t buff[8];
673 };
674 template <>
675 struct __align__(64) aligned_chunk<64> {
676  uint32_t buff[16];
677 };
678 template <>
679 struct __align__(128) aligned_chunk<128> {
680  uint32_t buff[32];
681 };
682 template <>
683 struct __align__(256) aligned_chunk<256> {
684  uint32_t buff[64];
685 };
686 template <>
687 struct __align__(512) aligned_chunk<512> {
688  uint32_t buff[128];
689 };
690 template <>
691 struct __align__(1024) aligned_chunk<1024> {
692  uint32_t buff[256];
693 };
694 template <>
695 struct __align__(2048) aligned_chunk<2048> {
696  uint32_t buff[512];
697 };
698 template <>
699 struct __align__(4096) aligned_chunk<4096> {
700  uint32_t buff[1024];
701 };
702 
704 template <size_t Len, size_t Align>
707 };
708 
709 #else
710 
711 using std::aligned_storage;
712 
713 #endif
714 
715 #if !defined(__CUDACC_RTC__)
716 template <typename T>
719  void operator()(T* ptr) const { delete ptr; }
720 };
721 
723 template <typename T>
724 struct default_delete<T[]> {
725  void operator()(T* ptr) const { delete[] ptr; }
726 };
727 
729 template <class T, class Deleter = default_delete<T> >
730 class unique_ptr {
731  public:
732  typedef T* pointer;
733  typedef T element_type;
734  typedef Deleter deleter_type;
735 
736  private:
738  pointer _ptr;
739 
741  deleter_type _deleter;
742 
743  public:
744  unique_ptr() : _ptr(nullptr) {}
745  unique_ptr(pointer p) : _ptr(p) {}
746 
748  if (_ptr) {
749  _deleter(_ptr);
750  }
751  }
753  pointer get() const noexcept { return _ptr; }
754 
757  pointer p(_ptr);
758  _ptr = nullptr;
759  return p;
760  }
761 
764  pointer old_ptr = _ptr;
765  _ptr = p;
766  if (old_ptr != nullptr) {
767  get_deleter()(old_ptr);
768  }
769  }
770 
772  void swap(unique_ptr& other) noexcept { std::swap(_ptr, other._ptr); }
773 
775  Deleter& get_deleter() noexcept { return _deleter; }
776 
778  Deleter const& get_deleter() const noexcept { return _deleter; }
779 
781  operator bool() const noexcept { return _ptr != nullptr; }
782 
784  T& operator*() const { return *_ptr; }
785 
787  pointer operator->() const noexcept { return _ptr; }
788 
790  T& operator[](size_t i) const { return _ptr[i]; }
791 };
792 
794 template <typename T, typename Deleter>
796  lhs.swap(rhs);
797 }
798 #endif
799 
800 }; // namespace platform
801 }; // namespace cutlass
static const value_t value
Definition: platform.h:279
CUTLASS_HOST_DEVICE constexpr const T & max(const T &a, const T &b)
std::max
Definition: platform.h:207
Definition: convert.h:33
#define constexpr
Definition: platform.h:129
std::nullptr_t
Definition: platform.h:317
void swap(unique_ptr< T, Deleter > &lhs, unique_ptr< T, Deleter > &rhs) noexcept
Specializes the swap algorithm.
Definition: platform.h:795
Helper for std::is_pointer (false specialization)
Definition: platform.h:468
Deleter deleter_type
Definition: platform.h:734
T type
Definition: platform.h:369
value_t val
Definition: platform.h:578
T type
Definition: platform.h:344
T * pointer
Definition: platform.h:732
std::less
Definition: platform.h:181
std::is_same (false specialization)
Definition: platform.h:412
std::is_pointer
Definition: platform.h:476
value_t value_type
Definition: platform.h:281
CUTLASS_HOST_DEVICE std::pair< T1, T2 > make_pair(T1 t, T2 u)
Definition: platform.h:250
unique_ptr()
Definition: platform.h:744
std::greater
Definition: platform.h:189
CUTLASS_HOST_DEVICE constexpr bool operator==(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Definition: platform.h:219
std::is_void
Definition: platform.h:480
CUTLASS_HOST_DEVICE constexpr bool operator>=(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Definition: platform.h:245
pointer operator->() const noexcept
Returns a pointer to the managed object.
Definition: platform.h:787
T & operator[](size_t i) const
Array access to managed object.
Definition: platform.h:790
CUTLASS_HOST_DEVICE constexpr bool operator>(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Definition: platform.h:240
void operator()(T *ptr) const
Definition: platform.h:725
Default deleter.
Definition: platform.h:718
Definition: platform.h:582
CUTLASS_HOST_DEVICE constexpr bool operator!=(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Definition: platform.h:224
std::unique_ptr
Definition: platform.h:730
Definition: platform.h:577
std::is_floating_point
Definition: platform.h:516
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
Definition: platform.h:300
Deleter const & get_deleter() const noexcept
Returns the deleter object.
Definition: platform.h:778
std::remove_cv
Definition: platform.h:392
CUTLASS_HOST_DEVICE const value_type operator()() const
Definition: platform.h:286
~unique_ptr()
Definition: platform.h:747
CUTLASS_HOST_DEVICE constexpr bool operator()(const T &lhs, const T &rhs) const
Definition: platform.h:190
struct __align__(1) aligned_chunk< 1 >
Definition: platform.h:651
T type
Definition: platform.h:375
T type
Definition: platform.h:381
std::is_integral
Definition: platform.h:484
integral_constant< value_t, V > type
Definition: platform.h:282
std::is_arithmetic
Definition: platform.h:523
char byte
Definition: platform.h:579
std::integral_constant
Definition: platform.h:274
std::is_base_of
Definition: platform.h:440
T type
Definition: platform.h:334
#define nullptr
nullptr
Definition: platform.h:136
std::is_volatile
Definition: platform.h:462
std::is_fundamental
Definition: platform.h:528
platform::plus
Definition: platform.h:175
std::enable_if (true specialization)
Definition: platform.h:333
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
Definition: platform.h:297
void operator()(T *ptr) const
Definition: platform.h:719
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:46
T element_type
Definition: platform.h:733
Deleter & get_deleter() noexcept
Returns the deleter object.
Definition: platform.h:775
std::alignment_of
Definition: platform.h:576
CUTLASS_HOST_DEVICE constexpr const T & min(const T &a, const T &b)
std::min
Definition: platform.h:201
remove_volatile< typename remove_const< T >::type >::type type
Definition: platform.h:393
std::conditional (true specialization)
Definition: platform.h:343
#define noexcept
noexcept, constexpr
Definition: platform.h:126
void reset(pointer p=pointer()) noexcept
Replaces the managed object, deleting the old object.
Definition: platform.h:763
T & operator*() const
Dereferences the unique_ptr.
Definition: platform.h:784
Helper for std::is_base_of.
Definition: platform.h:420
std::remove_const (non-const specialization)
Definition: platform.h:368
CUTLASS_HOST_DEVICE constexpr T operator()(const T &lhs, const T &rhs) const
Definition: platform.h:176
CUTLASS_HOST_DEVICE constexpr bool operator()(const T &lhs, const T &rhs) const
Definition: platform.h:182
Definition: platform.h:649
static CUTLASS_HOST_DEVICE yes check(DerivedT *, T)
void swap(unique_ptr &other) noexcept
Swaps the managed objects with *this and another unique_ptr.
Definition: platform.h:772
static const bool value
Definition: platform.h:435
aligned_chunk< Align > type[Len/sizeof(aligned_chunk< Align >)]
Definition: platform.h:706
std::aligned_storage
Definition: platform.h:705
std::remove_volatile (non-volatile specialization)
Definition: platform.h:380
unique_ptr(pointer p)
Definition: platform.h:745
char(& yes)[1]
Definition: platform.h:421
pointer release() noexcept
Releases ownership of the managed object, if any.
Definition: platform.h:756
Basic include for CUTLASS macros.
std::bool_constant
Definition: platform.h:306
char(& no)[2]
Definition: platform.h:422