10#include <kernel/util/half.hpp>
11#include <kernel/util/string.hpp>
15#if defined(FEAT_HAVE_FLOATX) && !defined(__CUDACC__)
35 return (
size_t) feature_hash&0xFFFFFFFF;
41 return (feature_hash&(uint64_t(1)<<32)) != uint64_t(0);
47 return (feature_hash&(uint64_t(1)<<33)) != uint64_t(0);
53 return (feature_hash&(uint64_t(1)<<34)) != uint64_t(0);
71 template<
typename DT_>
94 static constexpr bool is_int =
false;
96 static constexpr bool is_float =
true;
98 static constexpr bool is_bool =
false;
100 static constexpr bool is_signed =
true;
106 static constexpr int format_precision = 7;
117 return uint64_t(
sizeof(
float)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
131 static constexpr bool is_int =
false;
133 static constexpr bool is_float =
true;
135 static constexpr bool is_bool =
false;
137 static constexpr bool is_signed =
true;
143 static constexpr int format_precision = 16;
154 return uint64_t(
sizeof(
double)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
168 static constexpr bool is_int =
false;
170 static constexpr bool is_float =
true;
172 static constexpr bool is_bool =
false;
174 static constexpr bool is_signed =
true;
180 static constexpr int format_precision = 16;
185 return "long double";
191 return uint64_t(
sizeof(
long double)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
205 static constexpr bool is_int =
true;
207 static constexpr bool is_float =
false;
209 static constexpr bool is_bool =
false;
211 static constexpr bool is_signed =
false;
217 static constexpr int format_precision = 0;
222 return "unsigned int";
228 return uint64_t(
sizeof(
unsigned int)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
242 static constexpr bool is_int =
true;
244 static constexpr bool is_float =
false;
246 static constexpr bool is_bool =
false;
248 static constexpr bool is_signed =
true;
254 static constexpr int format_precision = 0;
265 return uint64_t(
sizeof(
signed int)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
279 static constexpr bool is_int =
true;
281 static constexpr bool is_float =
false;
283 static constexpr bool is_bool =
false;
285 static constexpr bool is_signed =
false;
291 static constexpr int format_precision = 0;
296 return "unsigned char";
302 return uint64_t(
sizeof(
unsigned char)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
316 static constexpr bool is_int =
true;
318 static constexpr bool is_float =
false;
320 static constexpr bool is_bool =
false;
322 static constexpr bool is_signed =
true;
328 static constexpr int format_precision = 0;
333 return "signed char";
339 return uint64_t(
sizeof(
signed char)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
353 static constexpr bool is_int =
true;
355 static constexpr bool is_float =
false;
357 static constexpr bool is_bool =
false;
359 static constexpr bool is_signed =
false;
365 static constexpr int format_precision = 0;
370 return "unsigned short";
376 return uint64_t(
sizeof(
unsigned short)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
390 static constexpr bool is_int =
true;
392 static constexpr bool is_float =
false;
394 static constexpr bool is_bool =
false;
396 static constexpr bool is_signed =
true;
402 static constexpr int format_precision = 0;
407 return "signed short";
413 return uint64_t(
sizeof(
signed short)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
427 static constexpr bool is_int =
true;
429 static constexpr bool is_float =
false;
431 static constexpr bool is_bool =
false;
433 static constexpr bool is_signed =
false;
439 static constexpr int format_precision = 0;
444 return "unsigned long";
450 return uint64_t(
sizeof(
unsigned long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
464 static constexpr bool is_int =
true;
466 static constexpr bool is_float =
false;
468 static constexpr bool is_bool =
false;
470 static constexpr bool is_signed =
true;
476 static constexpr int format_precision = 0;
481 return "signed long";
487 return uint64_t(
sizeof(
signed long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
501 static constexpr bool is_int =
true;
503 static constexpr bool is_float =
false;
505 static constexpr bool is_bool =
false;
507 static constexpr bool is_signed =
false;
513 static constexpr int format_precision = 0;
518 return "unsigned long long";
524 return uint64_t(
sizeof(
unsigned long long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
538 static constexpr bool is_int =
true;
540 static constexpr bool is_float =
false;
542 static constexpr bool is_bool =
false;
544 static constexpr bool is_signed =
true;
550 static constexpr int format_precision = 0;
555 return "signed long long";
561 return uint64_t(
sizeof(
signed long long)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
575 static constexpr bool is_int =
false;
577 static constexpr bool is_float =
false;
579 static constexpr bool is_bool =
true;
581 static constexpr bool is_signed =
false;
587 static constexpr int format_precision = 0;
598 return uint64_t(
sizeof(
bool)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
602#if defined(FEAT_HAVE_QUADMATH) && !defined(__CUDACC__)
609 struct Traits<__float128>
612 static constexpr bool is_int =
false;
614 static constexpr bool is_float =
true;
616 static constexpr bool is_bool =
false;
618 static constexpr bool is_signed =
true;
624 static constexpr int format_precision = 34;
633 static uint64_t feature_hash()
635 return uint64_t(
sizeof(__float128)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
640#if defined(FEAT_HAVE_HALFMATH)
650 static constexpr bool is_int =
false;
652 static constexpr bool is_float =
true;
654 static constexpr bool is_bool =
false;
656 static constexpr bool is_signed =
true;
662 static constexpr int format_precision = 4;
671 static uint64_t feature_hash()
673 return uint64_t(
sizeof(
Half)) | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
678#if defined(FEAT_HAVE_FLOATX) && !defined(__CUDACC__)
684 template<
int exp_bits_,
int sig_bits_,
typename Backend_>
685 struct Traits<flx::floatx<exp_bits_, sig_bits_, Backend_>>
688 static constexpr bool is_int =
false;
690 static constexpr bool is_float =
true;
692 static constexpr bool is_bool =
false;
694 static constexpr bool is_signed =
true;
700 static constexpr int format_precision = 0;
709 static uint64_t feature_hash()
713 return uint64_t(
sizeof(Backend_)) | uint64_t(exp_bits_) << 16 | uint64_t(sig_bits_) << 24
714 | uint64_t(is_int) << 32 | uint64_t(is_float) << 33 | uint64_t(is_signed) << 34;
String class implementation.
Tag class for any data type not matching any other type class.
Tag class for the one and only boolean data type.
Tag class for floating data types.
Tag class for integral data types.
String stringify(const T_ &item)
Converts an item into a String.
__half Half
Half data type.
static bool extract_signedness(uint64_t feature_hash)
extracts sign feature from a given types feature hash
static bool extract_intness(uint64_t feature_hash)
extracts integral feature from a given types feature hash
static bool extract_floatness(uint64_t feature_hash)
extracts floating point feature from a given types feature hash
static size_t extract_type_size(uint64_t feature_hash)
extracts sizeof datatype from a given types feature hash
BooleanClass TypeClass
this type is of boolean class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
FloatingClass TypeClass
this type is of floating class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
FloatingClass TypeClass
this type is of floating class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
FloatingClass TypeClass
this type is of floating class
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
IntegralClass TypeClass
this type is of integral class
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
IntegralClass TypeClass
this type is of integral class
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static String name()
returns a string identifying the datatype
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
IntegralClass TypeClass
this type is of integral class
IntegralClass TypeClass
this type is of integral class
static uint64_t feature_hash()
returns composition of datatype size, int-, float- and signed feature
static String name()
returns a string identifying the datatype
static String name()
returns a string identifying the datatype
AnotherClass TypeClass
this type is of another class