28 #ifndef HIP_INCLUDE_HIP_AMD_DETAIL_HOST_DEFINES_H
29 #define HIP_INCLUDE_HIP_AMD_DETAIL_HOST_DEFINES_H
32 #ifndef GENERIC_GRID_LAUNCH
33 #define GENERIC_GRID_LAUNCH 1
36 #if defined(__clang__) && defined(__HIP__)
38 namespace __hip_internal {
39 typedef unsigned char uint8_t;
40 typedef unsigned short uint16_t;
41 typedef unsigned int uint32_t;
42 typedef unsigned long long uint64_t;
43 typedef signed char int8_t;
44 typedef signed short int16_t;
45 typedef signed int int32_t;
46 typedef signed long long int64_t;
48 template <
class _Tp, _Tp __v>
struct integral_constant {
49 static constexpr
const _Tp value = __v;
50 typedef _Tp value_type;
51 typedef integral_constant type;
52 constexpr
operator value_type()
const {
return value; }
53 constexpr value_type operator()()
const {
return value; }
55 template <
class _Tp, _Tp __v> constexpr
const _Tp integral_constant<_Tp, __v>::value;
57 typedef integral_constant<bool, true> true_type;
58 typedef integral_constant<bool, false> false_type;
60 template <
bool B>
using bool_constant = integral_constant<bool, B>;
61 typedef bool_constant<true> true_type;
62 typedef bool_constant<false> false_type;
64 template <
bool __B,
class __T =
void>
struct enable_if {};
65 template <
class __T>
struct enable_if<true, __T> {
typedef __T type; };
67 template<
bool _B>
struct true_or_false_type :
public false_type {};
68 template<>
struct true_or_false_type<true> :
public true_type {};
70 template <
class _Tp>
struct is_integral :
public false_type {};
71 template <>
struct is_integral<bool> :
public true_type {};
72 template <>
struct is_integral<char> :
public true_type {};
73 template <>
struct is_integral<signed char> :
public true_type {};
74 template <>
struct is_integral<unsigned char> :
public true_type {};
75 template <>
struct is_integral<wchar_t> :
public true_type {};
76 template <>
struct is_integral<short> :
public true_type {};
77 template <>
struct is_integral<unsigned short> :
public true_type {};
78 template <>
struct is_integral<int> :
public true_type {};
79 template <>
struct is_integral<unsigned int> :
public true_type {};
80 template <>
struct is_integral<long> :
public true_type {};
81 template <>
struct is_integral<unsigned long> :
public true_type {};
82 template <>
struct is_integral<long long> :
public true_type {};
83 template <>
struct is_integral<unsigned long long> :
public true_type {};
85 template <
class _Tp>
struct is_arithmetic :
public false_type {};
86 template <>
struct is_arithmetic<bool> :
public true_type {};
87 template <>
struct is_arithmetic<char> :
public true_type {};
88 template <>
struct is_arithmetic<signed char> :
public true_type {};
89 template <>
struct is_arithmetic<unsigned char> :
public true_type {};
90 template <>
struct is_arithmetic<wchar_t> :
public true_type {};
91 template <>
struct is_arithmetic<short> :
public true_type {};
92 template <>
struct is_arithmetic<unsigned short> :
public true_type {};
93 template <>
struct is_arithmetic<int> :
public true_type {};
94 template <>
struct is_arithmetic<unsigned int> :
public true_type {};
95 template <>
struct is_arithmetic<long> :
public true_type {};
96 template <>
struct is_arithmetic<unsigned long> :
public true_type {};
97 template <>
struct is_arithmetic<long long> :
public true_type {};
98 template <>
struct is_arithmetic<unsigned long long> :
public true_type {};
99 template <>
struct is_arithmetic<float> :
public true_type {};
100 template <>
struct is_arithmetic<double> :
public true_type {};
102 template<
typename _Tp>
struct is_floating_point :
public false_type {};
103 template<>
struct is_floating_point<float> :
public true_type {};
104 template<>
struct is_floating_point<double> :
public true_type {};
105 template<>
struct is_floating_point<long double> :
public true_type {};
107 template <
typename __T,
typename __U>
struct is_same :
public false_type {};
108 template <
typename __T>
struct is_same<__T, __T> :
public true_type {};
110 template<typename _Tp, bool = is_arithmetic<_Tp>::value>
111 struct is_signed :
public false_type {};
112 template<
typename _Tp>
113 struct is_signed<_Tp, true> :
public true_or_false_type<_Tp(-1) < _Tp(0)> {};
115 template<typename _CharT> struct char_traits;
116 template<typename _CharT, typename _Traits = char_traits<_CharT>> class basic_istream;
117 template<typename _CharT, typename _Traits = char_traits<_CharT>> class basic_ostream;
118 typedef basic_istream<char> istream;
119 typedef basic_ostream<char> ostream;
121 template<typename _Tp>
122 struct is_standard_layout
123 : public integral_constant<bool, __is_standard_layout(_Tp)>
126 template<typename _Tp>
128 : public integral_constant<bool, __is_trivial(_Tp)>
132 template <bool B, class T, class F> struct conditional { using type = T; };
133 template <class T, class F> struct conditional<false, T, F> { using type = F; };
135 typedef __hip_internal::uint8_t __hip_uint8_t;
136 typedef __hip_internal::uint16_t __hip_uint16_t;
137 typedef __hip_internal::uint32_t __hip_uint32_t;
138 typedef __hip_internal::uint64_t __hip_uint64_t;
139 typedef __hip_internal::int8_t __hip_int8_t;
140 typedef __hip_internal::int16_t __hip_int16_t;
141 typedef __hip_internal::int32_t __hip_int32_t;
142 typedef __hip_internal::int64_t __hip_int64_t;
144 #if !__CLANG_HIP_RUNTIME_WRAPPER_INCLUDED__
145 #define __host__ __attribute__((host))
146 #define __device__ __attribute__((device))
147 #define __global__ __attribute__((global))
148 #define __shared__ __attribute__((shared))
149 #define __constant__ __attribute__((constant))
152 #if !defined(__has_feature) || !__has_feature(cuda_noinline_keyword)
153 #define __noinline__ __attribute__((noinline))
156 #define __forceinline__ inline __attribute__((always_inline))
158 #if __HIP_NO_IMAGE_SUPPORT
159 #define __hip_img_chk__ __attribute__((unavailable("The image/texture API not supported on the device")))
161 #define __hip_img_chk__
176 #define __forceinline__ inline
181 #define __hip_img_chk__