platform.h File Reference

C++ features that may be otherwise unimplemented for CUDA device functions. More...

`#include <stdint.h>`
`#include <algorithm>`
`#include <cstddef>`
`#include <functional>`
`#include <utility>`
`#include "cutlass/cutlass.h"`
Include dependency graph for platform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes

struct | cutlass::platform::integral_constant< value_t, V >
| std::integral_constant More...
struct | cutlass::platform::integral_constant< value_t, V >
| std::integral_constant More...
struct | cutlass::platform::bool_constant< V >
| std::bool_constant More...
struct | cutlass::platform::nullptr_t
| std::nullptr_t More...
struct | cutlass::platform::enable_if< C, T >
| std::enable_if (true specialization) More...
struct | cutlass::platform::enable_if< false, T >
| std::enable_if (false specialization) More...
struct | cutlass::platform::conditional< B, T, F >
| std::conditional (true specialization) More...
struct | cutlass::platform::conditional< false, T, F >
| std::conditional (false specialization) More...
struct | cutlass::platform::remove_const< T >
| std::remove_const (non-const specialization) More...
struct | cutlass::platform::remove_const< const T >
| std::remove_const (const specialization) More...
struct | cutlass::platform::remove_volatile< T >
| std::remove_volatile (non-volatile specialization) More...
struct | cutlass::platform::remove_volatile< volatile T >
| std::remove_volatile (volatile specialization) More...
struct | cutlass::platform::remove_cv< T >
| std::remove_cv More...
struct | cutlass::platform::is_same< A, B >
| std::is_same (false specialization) More...
struct | cutlass::platform::is_same< A, A >
| std::is_same (true specialization) More...
struct | cutlass::platform::is_base_of_helper< BaseT, DerivedT >
| Helper for std::is_base_of. More...
struct | cutlass::platform::is_base_of_helper< BaseT, DerivedT >::dummy< B, D >
struct | cutlass::platform::is_base_of< BaseT, DerivedT >
| std::is_base_of More...
struct | cutlass::platform::is_volatile< T >
| std::is_volatile More...
struct | cutlass::platform::is_volatile< volatile T >
struct | cutlass::platform::is_pointer_helper< T >
| Helper for std::is_pointer (false specialization) More...
struct | cutlass::platform::is_pointer_helper< T * >
| Helper for std::is_pointer (true specialization) More...
struct | cutlass::platform::is_pointer< T >
| std::is_pointer More...
struct | cutlass::platform::is_void< T >
| std::is_void More...
struct | cutlass::platform::is_integral< T >
| std::is_integral More...
struct | cutlass::platform::is_integral< char >
struct | cutlass::platform::is_integral< signed char >
struct | cutlass::platform::is_integral< unsigned char >
struct | cutlass::platform::is_integral< short >
struct | cutlass::platform::is_integral< unsigned short >
struct | cutlass::platform::is_integral< int >
struct | cutlass::platform::is_integral< unsigned int >
struct | cutlass::platform::is_integral< long >
struct | cutlass::platform::is_integral< unsigned long >
struct | cutlass::platform::is_integral< long long >
struct | cutlass::platform::is_integral< unsigned long long >
struct | cutlass::platform::is_integral< volatile T >
struct | cutlass::platform::is_integral< const T >
struct | cutlass::platform::is_integral< const volatile T >
struct | cutlass::platform::is_floating_point< T >
| std::is_floating_point More...
struct | cutlass::platform::is_arithmetic< T >
| std::is_arithmetic More...
struct | cutlass::platform::is_fundamental< T >
| std::is_fundamental More...
struct | cutlass::platform::is_trivially_copyable< T >
struct | cutlass::platform::alignment_of< value_t >
| std::alignment_of More...
struct | cutlass::platform::alignment_of< value_t >::pad
struct | cutlass::platform::alignment_of< int4 >
struct | cutlass::platform::alignment_of< uint4 >
struct | cutlass::platform::alignment_of< float4 >
struct | cutlass::platform::alignment_of< long4 >
struct | cutlass::platform::alignment_of< ulong4 >
struct | cutlass::platform::alignment_of< longlong2 >
struct | cutlass::platform::alignment_of< ulonglong2 >
struct | cutlass::platform::alignment_of< double2 >
struct | cutlass::platform::alignment_of< longlong4 >
struct | cutlass::platform::alignment_of< ulonglong4 >
struct | cutlass::platform::alignment_of< double4 >
struct | cutlass::platform::alignment_of< volatile value_t >
struct | cutlass::platform::alignment_of< const value_t >
struct | cutlass::platform::alignment_of< const volatile value_t >
struct | cutlass::platform::aligned_chunk< Align >
struct | cutlass::platform::aligned_storage< Len, Align >
| std::aligned_storage More...
struct | cutlass::platform::default_delete< T >
| Default deleter. More...
struct | cutlass::platform::default_delete< T[]>
| Partial specialization for deleting array types. More...
class | cutlass::platform::unique_ptr< T, Deleter >
| std::unique_ptr More...

## Namespaces

| cutlass
| cutlass::platform

## Macros

#define | noexcept
| noexcept, constexpr More...
#define | constexpr
#define | nullptr 0
| nullptr More...
#define | __platform_cat_(a, b) a##b
| static_assert More...
#define | __platform_cat(a, b) __platform_cat_(a, b)
#define | static_assert(__e, __m) typedef int __platform_cat(AsSeRt, __LINE__)[(__e) ? 1 : -1]
#define | __NV_STD_MAX(a, b) (((b) > (a)) ? (b) : (a))
| Select maximum(a, b) More...
#define | __NV_STD_MIN(a, b) (((b) < (a)) ? (b) : (a))
| Select minimum(a, b) More...

## Typedefs

typedef integral_constant< bool, true > | cutlass::platform::true_type
| The type used as a compile-time boolean with true value. More...
typedef integral_constant< bool, false > | cutlass::platform::false_type
| The type used as a compile-time boolean with false value. More...

## Functions

template<typename T >
CUTLASS_HOST_DEVICE constexpr const T & | cutlass::platform::min (const T &a, const T &b)
| std::min More...
template<typename T >
CUTLASS_HOST_DEVICE constexpr const T & | cutlass::platform::max (const T &a, const T &b)
| std::max More...
template<class T1 , class T2 >
CUTLASS_HOST_DEVICE constexpr bool | cutlass::platform::operator== (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
template<class T1 , class T2 >
CUTLASS_HOST_DEVICE constexpr bool | cutlass::platform::operator!= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
template<class T1 , class T2 >
CUTLASS_HOST_DEVICE constexpr bool | cutlass::platform::operator< (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
template<class T1 , class T2 >
CUTLASS_HOST_DEVICE constexpr bool | cutlass::platform::operator<= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
template<class T1 , class T2 >
CUTLASS_HOST_DEVICE constexpr bool | cutlass::platform::operator> (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
template<class T1 , class T2 >
CUTLASS_HOST_DEVICE constexpr bool | cutlass::platform::operator>= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
template<class T1 , class T2 >
CUTLASS_HOST_DEVICE std::pair< T1, T2 > | cutlass::platform::make_pair (T1 t, T2 u)
template<>
struct | cutlass::platform::__align__ (1) aligned_chunk< 1 >
template<>
struct | cutlass::platform::__align__ (2) aligned_chunk< 2 >
template<>
struct | cutlass::platform::__align__ (4) aligned_chunk< 4 >
template<>
struct | cutlass::platform::__align__ (8) aligned_chunk< 8 >
template<>
struct | cutlass::platform::__align__ (16) aligned_chunk< 16 >
template<>
struct | cutlass::platform::__align__ (32) aligned_chunk< 32 >
template<>
struct | cutlass::platform::__align__ (64) aligned_chunk< 64 >
template<>
struct | cutlass::platform::__align__ (128) aligned_chunk< 128 >
template<>
struct | cutlass::platform::__align__ (256) aligned_chunk< 256 >
template<>
struct | cutlass::platform::__align__ (512) aligned_chunk< 512 >
template<>
struct | cutlass::platform::__align__ (1024) aligned_chunk< 1024 >
template<>
struct | cutlass::platform::__align__ (2048) aligned_chunk< 2048 >
template<>
struct | cutlass::platform::__align__ (4096) aligned_chunk< 4096 >
template<typename T , typename Deleter >
void | cutlass::platform::swap (unique_ptr< T, Deleter > &lhs, unique_ptr< T, Deleter > &rhs) noexcept
| Specializes the swap algorithm. More...

## Detailed Description

This file has three components:

(1) Macros:

- Empty macro defines for C++ keywords not supported by the current version of C++. These simply allow compilation to proceed (but do not provide the added semantics).
  - `noexcept`
  - `constexpr`
  - `nullptr`
  - `static_assert`
- Macro functions that we need in constant expressions because the C++ equivalents require constexpr compiler support. These are prefixed with `__NV_STD_*`
  - `__NV_STD_MAX`
  - `__NV_STD_MIN`

(2) Re-implementations of STL functions and types:

- C++ features that need the `device` annotation. These are placed into the `platform` namespace.
  - `plus`
  - `less`
  - `greater`
  - `min`
  - `max`
  - `methods` on std::pair (==, !=, <, <=, >, >=, and make_pair())

(3) Stop-gap implementations of unsupported STL functions and types:

- STL functions and types defined by C++ 11/14/17/etc. that are not provided by the current version of C++. These are placed into the `platform` namespace
  - `integral_constant`
  - `nullptr_t`
  - `true_type`
  - `false_type`
  - `bool_constant`
  - `enable_if`
  - `conditional`
  - `is_same`
  - `is_base_of`
  - `remove_const`
  - `remove_volatile`
  - `remove_cv`
  - `is_volatile`
  - `is_pointer`
  - `is_void`
  - `is_integral`
  - `is_floating_point`
  - `is_arithmetic`
  - `is_fundamental`
  - `is_trivially_copyable`
  - `alignment_of`
  - `aligned_storage`

(4) Functions and types that are STL-like (but aren't in the STL):

- `TODO:` min and max functors?

The idea is that, as we drop support for older compilers, we can simply #define the `__NV_STD_XYZ` macros and `platform` namespace to alias their C++ counterparts (or trivially find-and-replace their occurrences in code text).

## Macro Definition Documentation

#define __NV_STD_MAX | ( |  | a,
|  |  | b
| ) |  | (((b) > (a)) ? (b) : (a))

#define __NV_STD_MIN | ( |  | a,
|  |  | b
| ) |  | (((b) < (a)) ? (b) : (a))

#define __platform_cat | ( |  | a,
|  |  | b
| ) |  | __platform_cat_(a, b)

#define __platform_cat_ | ( |  | a,
|  |  | b
| ) |  | a##b

#define constexpr

#define noexcept

#define nullptr 0

#define static_assert | ( |  | __e,
|  |  | __m
| ) |  | typedef int __platform_cat(AsSeRt, __LINE__)[(__e) ? 1 : -1]