Halide  12.0.1
Halide compiler and libraries
Type.h
Go to the documentation of this file.
1 #ifndef HALIDE_TYPE_H
2 #define HALIDE_TYPE_H
3 
4 #include "Error.h"
5 #include "Float16.h"
6 #include "Util.h"
8 #include <cstdint>
9 
10 /** \file
11  * Defines halide types
12  */
13 
14 /** A set of types to represent a C++ function signature. This allows
15  * two things. First, proper prototypes can be provided for Halide
16  * generated functions, giving better compile time type
17  * checking. Second, C++ name mangling can be done to provide link
18  * time type checking for both Halide generated functions and calls
19  * from Halide to external functions.
20  *
21  * These are intended to be constexpr producable, but we don't depend
22  * on C++11 yet. In C++14, it is possible these will be replaced with
23  * introspection/reflection facilities.
24  *
25  * halide_handle_traits has to go outside the Halide namespace due to template
26  * resolution rules. TODO(zalman): Do all types need to be in global namespace?
27  */
28 //@{
29 
30 /** A structure to represent the (unscoped) name of a C++ composite type for use
31  * as a single argument (or return value) in a function signature.
32  *
33  * Currently does not support the restrict qualifier, references, or
34  * r-value references. These features cannot be used in extern
35  * function calls from Halide or in the generated function from
36  * Halide, but their applicability seems limited anyway.
37  *
38  * Although this is in the global namespace, it should be considered "Halide Internal"
39  * and subject to change; code outside Halide should avoid referencing it.
40  */
42  /// An enum to indicate whether a C++ type is non-composite, a struct, class, or union
43  enum CPPTypeType {
44  Simple, ///< "int"
45  Struct, ///< "struct Foo"
46  Class, ///< "class Foo"
47  Union, ///< "union Foo"
48  Enum, ///< "enum Foo"
49  } cpp_type_type; // Note: order is reflected in map_to_name table in CPlusPlusMangle.cpp
50 
51  std::string name;
52 
55  }
56 
57  bool operator==(const halide_cplusplus_type_name &rhs) const {
58  return cpp_type_type == rhs.cpp_type_type &&
59  name == rhs.name;
60  }
61 
62  bool operator!=(const halide_cplusplus_type_name &rhs) const {
63  return !(*this == rhs);
64  }
65 
66  bool operator<(const halide_cplusplus_type_name &rhs) const {
67  return cpp_type_type < rhs.cpp_type_type ||
68  (cpp_type_type == rhs.cpp_type_type &&
69  name < rhs.name);
70  }
71 };
72 
73 /** A structure to represent the fully scoped name of a C++ composite
74  * type for use in generating function signatures that use that type.
75  *
76  * This is intended to be a constexpr usable type, but we don't depend
77  * on C++11 yet. In C++14, it is possible this will be replaced with
78  * introspection/reflection facilities.
79  *
80  * Although this is in the global namespace, it should be considered "Halide Internal"
81  * and subject to change; code outside Halide should avoid referencing it.
82  */
85  std::vector<std::string> namespaces;
86  std::vector<halide_cplusplus_type_name> enclosing_types;
87 
88  /// One set of modifiers on a type.
89  /// The const/volatile/restrict propertises are "inside" the pointer property.
90  enum Modifier : uint8_t {
91  Const = 1 << 0, ///< Bitmask flag for "const"
92  Volatile = 1 << 1, ///< Bitmask flag for "volatile"
93  Restrict = 1 << 2, ///< Bitmask flag for "restrict"
94  Pointer = 1 << 3, ///< Bitmask flag for a pointer "*"
95  };
96 
97  /// Qualifiers and indirections on type. 0 is innermost.
98  std::vector<uint8_t> cpp_type_modifiers;
99 
100  /// References are separate because they only occur at the outermost level.
101  /// No modifiers are needed for references as they are not allowed to apply
102  /// to the reference itself. (This isn't true for restrict, but that is a C++
103  /// extension anyway.) If modifiers are needed, the last entry in the above
104  /// array would be the modifers for the reference.
107  LValueReference = 1, // "&"
108  RValueReference = 2, // "&&"
109  };
111 
113  const std::vector<std::string> &namespaces = {},
114  const std::vector<halide_cplusplus_type_name> &enclosing_types = {},
115  const std::vector<uint8_t> &modifiers = {},
120  cpp_type_modifiers(modifiers),
122  }
123 
124  template<typename T>
126 };
127 //@}
128 
129 /** halide_c_type_to_name is a utility class used to provide a user-extensible
130  * way of naming Handle types.
131  *
132  * Although this is in the global namespace, it should be considered "Halide Internal"
133  * and subject to change; code outside Halide should avoid referencing it
134  * directly (use the HALIDE_DECLARE_EXTERN_xxx macros instead).
135  */
136 template<typename T>
138  static constexpr bool known_type = false;
140  return {halide_cplusplus_type_name::Simple, "void"};
141  }
142 };
143 
144 #define HALIDE_DECLARE_EXTERN_TYPE(TypeType, Type) \
145  template<> \
146  struct halide_c_type_to_name<Type> { \
147  static constexpr bool known_type = true; \
148  static halide_cplusplus_type_name name() { \
149  return {halide_cplusplus_type_name::TypeType, #Type}; \
150  } \
151  }
152 
153 #define HALIDE_DECLARE_EXTERN_SIMPLE_TYPE(T) HALIDE_DECLARE_EXTERN_TYPE(Simple, T)
154 #define HALIDE_DECLARE_EXTERN_STRUCT_TYPE(T) HALIDE_DECLARE_EXTERN_TYPE(Struct, T)
155 #define HALIDE_DECLARE_EXTERN_CLASS_TYPE(T) HALIDE_DECLARE_EXTERN_TYPE(Class, T)
156 #define HALIDE_DECLARE_EXTERN_UNION_TYPE(T) HALIDE_DECLARE_EXTERN_TYPE(Union, T)
157 
178 
179 // You can make arbitrary user-defined types be "Known" using the
180 // macro above. This is useful for making Param<> arguments for
181 // Generators type safe. e.g.,
182 //
183 // struct MyFunStruct { ... };
184 //
185 // ...
186 //
187 // HALIDE_DECLARE_EXTERN_STRUCT_TYPE(MyFunStruct);
188 //
189 // ...
190 //
191 // class MyGenerator : public Generator<MyGenerator> {
192 // Param<const MyFunStruct *> my_struct_ptr;
193 // ...
194 // };
195 
196 template<typename T>
198  constexpr bool is_ptr = std::is_pointer<T>::value;
199  constexpr bool is_lvalue_reference = std::is_lvalue_reference<T>::value;
200  constexpr bool is_rvalue_reference = std::is_rvalue_reference<T>::value;
201 
202  using TBase = typename std::remove_pointer<typename std::remove_reference<T>::type>::type;
203  constexpr bool is_const = std::is_const<TBase>::value;
204  constexpr bool is_volatile = std::is_volatile<TBase>::value;
205 
206  constexpr uint8_t modifiers = static_cast<uint8_t>(
209  (is_volatile ? halide_handle_cplusplus_type::Volatile : 0));
210 
211  // clang-format off
213  (is_lvalue_reference ? halide_handle_cplusplus_type::LValueReference :
214  is_rvalue_reference ? halide_handle_cplusplus_type::RValueReference :
216  // clang-format on
217 
218  using TNonCVBase = typename std::remove_cv<TBase>::type;
219  constexpr bool known_type = halide_c_type_to_name<TNonCVBase>::known_type;
220  static_assert(!(!known_type && !is_ptr), "Unknown types must be pointers");
221 
224  {},
225  {},
226  {modifiers},
227  ref_type};
228  // Pull off any namespaces
230  return info;
231 }
232 
233 /** A type traits template to provide a halide_handle_cplusplus_type
234  * value from a C++ type.
235  *
236  * Note the type represented is implicitly a pointer.
237  *
238  * A NULL pointer of type halide_handle_traits represents "void *".
239  * This is chosen for compactness or representation as Type is a very
240  * widely used data structure.
241  *
242  * Although this is in the global namespace, it should be considered "Halide Internal"
243  * and subject to change; code outside Halide should avoid referencing it directly.
244  */
245 template<typename T>
247  // This trait must return a pointer to a global structure. I.e. it should never be freed.
248  // A return value of nullptr here means "void *".
250  if (std::is_pointer<T>::value ||
251  std::is_lvalue_reference<T>::value ||
252  std::is_rvalue_reference<T>::value) {
253  static const halide_handle_cplusplus_type the_info = halide_handle_cplusplus_type::make<T>();
254  return &the_info;
255  }
256  return nullptr;
257  }
258 };
259 
260 namespace Halide {
261 
262 struct Expr;
263 
264 /** Types in the halide type system. They can be ints, unsigned ints,
265  * or floats of various bit-widths (the 'bits' field). They can also
266  * be vectors of the same (by setting the 'lanes' field to something
267  * larger than one). Front-end code shouldn't use vector
268  * types. Instead vectorize a function. */
269 struct Type {
270 private:
271  halide_type_t type;
272 
273 public:
274  /** Aliases for halide_type_code_t values for legacy compatibility
275  * and to match the Halide internal C++ style. */
276  // @{
282  // @}
283 
284  /** The number of bytes required to store a single scalar value of this type. Ignores vector lanes. */
285  int bytes() const {
286  return (bits() + 7) / 8;
287  }
288 
289  // Default ctor initializes everything to predictable-but-unlikely values
291  : type(Handle, 0, 0) {
292  }
293 
294  /** Construct a runtime representation of a Halide type from:
295  * code: The fundamental type from an enum.
296  * bits: The bit size of one element.
297  * lanes: The number of vector elements in the type. */
300  }
301 
302  /** Trivial copy constructor. */
303  Type(const Type &that) = default;
304 
305  /** Trivial copy assignment operator. */
306  Type &operator=(const Type &that) = default;
307 
308  /** Type is a wrapper around halide_type_t with more methods for use
309  * inside the compiler. This simply constructs the wrapper around
310  * the runtime value. */
313  : type(that), handle_type(handle_type) {
314  }
315 
316  /** Unwrap the runtime halide_type_t for use in runtime calls, etc.
317  * Representation is exactly equivalent. */
319  operator halide_type_t() const {
320  return type;
321  }
322 
323  /** Return the underlying data type of an element as an enum value. */
326  return (halide_type_code_t)type.code;
327  }
328 
329  /** Return the bit size of a single element of this type. */
331  int bits() const {
332  return type.bits;
333  }
334 
335  /** Return the number of vector elements in this type. */
337  int lanes() const {
338  return type.lanes;
339  }
340 
341  /** Return Type with same number of bits and lanes, but new_code for a type code. */
343  return Type(new_code, bits(), lanes(),
344  (new_code == code()) ? handle_type : nullptr);
345  }
346 
347  /** Return Type with same type code and lanes, but new_bits for the number of bits. */
348  Type with_bits(int new_bits) const {
349  return Type(code(), new_bits, lanes(),
350  (new_bits == bits()) ? handle_type : nullptr);
351  }
352 
353  /** Return Type with same type code and number of bits,
354  * but new_lanes for the number of vector lanes. */
355  Type with_lanes(int new_lanes) const {
356  return Type(code(), bits(), new_lanes, handle_type);
357  }
358 
359  /** Return Type with the same type code and number of lanes, but with twice as many bits. */
360  Type widen() const {
361  return with_bits(bits() * 2);
362  }
363 
364  /** Return Type with the same type code and number of lanes, but with half as many bits. */
365  Type narrow() const {
366  return with_bits(bits() / 2);
367  }
368 
369  /** Type to be printed when declaring handles of this type. */
371 
372  /** Is this type boolean (represented as UInt(1))? */
374  bool is_bool() const {
375  return code() == UInt && bits() == 1;
376  }
377 
378  /** Is this type a vector type? (lanes() != 1).
379  * TODO(abadams): Decide what to do for lanes() == 0. */
381  bool is_vector() const {
382  return lanes() != 1;
383  }
384 
385  /** Is this type a scalar type? (lanes() == 1).
386  * TODO(abadams): Decide what to do for lanes() == 0. */
388  bool is_scalar() const {
389  return lanes() == 1;
390  }
391 
392  /** Is this type a floating point type (float or double). */
394  bool is_float() const {
395  return code() == Float || code() == BFloat;
396  }
397 
398  /** Is this type a floating point type (float or double). */
400  bool is_bfloat() const {
401  return code() == BFloat;
402  }
403 
404  /** Is this type a signed integer type? */
406  bool is_int() const {
407  return code() == Int;
408  }
409 
410  /** Is this type an unsigned integer type? */
412  bool is_uint() const {
413  return code() == UInt;
414  }
415 
416  /** Is this type an integer type of any sort? */
418  bool is_int_or_uint() const {
419  return code() == Int || code() == UInt;
420  }
421 
422  /** Is this type an opaque handle type (void *) */
424  bool is_handle() const {
425  return code() == Handle;
426  }
427 
428  // Returns true iff type is a signed integral type where overflow is defined.
430  bool can_overflow_int() const {
431  return is_int() && bits() <= 16;
432  }
433 
434  // Returns true iff type does have a well-defined overflow behavior.
436  bool can_overflow() const {
437  return is_uint() || can_overflow_int();
438  }
439 
440  /** Check that the type name of two handles matches. */
441  bool same_handle_type(const Type &other) const;
442 
443  /** Compare two types for equality */
444  bool operator==(const Type &other) const {
445  return type == other.type && (code() != Handle || same_handle_type(other));
446  }
447 
448  /** Compare two types for inequality */
449  bool operator!=(const Type &other) const {
450  return type != other.type || (code() == Handle && !same_handle_type(other));
451  }
452 
453  /** Compare ordering of two types so they can be used in certain containers and algorithms */
454  bool operator<(const Type &other) const {
455  if (type < other.type) {
456  return true;
457  }
458  if (code() == Handle) {
459  return handle_type < other.handle_type;
460  }
461  return false;
462  }
463 
464  /** Produce the scalar type (that of a single element) of this vector type */
465  Type element_of() const {
466  return with_lanes(1);
467  }
468 
469  /** Can this type represent all values of another type? */
470  bool can_represent(Type other) const;
471 
472  /** Can this type represent a particular constant? */
473  // @{
474  bool can_represent(double x) const;
475  bool can_represent(int64_t x) const;
476  bool can_represent(uint64_t x) const;
477  // @}
478 
479  /** Check if an integer constant value is the maximum or minimum
480  * representable value for this type. */
481  // @{
482  bool is_max(uint64_t) const;
483  bool is_max(int64_t) const;
484  bool is_min(uint64_t) const;
485  bool is_min(int64_t) const;
486  // @}
487 
488  /** Return an expression which is the maximum value of this type.
489  * Returns infinity for types which can represent it. */
490  Expr max() const;
491 
492  /** Return an expression which is the minimum value of this type.
493  * Returns -infinity for types which can represent it. */
494  Expr min() const;
495 };
496 
497 /** Constructing a signed integer type */
498 inline Type Int(int bits, int lanes = 1) {
499  return Type(Type::Int, bits, lanes);
500 }
501 
502 /** Constructing an unsigned integer type */
503 inline Type UInt(int bits, int lanes = 1) {
504  return Type(Type::UInt, bits, lanes);
505 }
506 
507 /** Construct a floating-point type */
508 inline Type Float(int bits, int lanes = 1) {
509  return Type(Type::Float, bits, lanes);
510 }
511 
512 /** Construct a floating-point type in the bfloat format. Only 16-bit currently supported. */
513 inline Type BFloat(int bits, int lanes = 1) {
514  return Type(Type::BFloat, bits, lanes);
515 }
516 
517 /** Construct a boolean type */
518 inline Type Bool(int lanes = 1) {
519  return UInt(1, lanes);
520 }
521 
522 /** Construct a handle type */
523 inline Type Handle(int lanes = 1, const halide_handle_cplusplus_type *handle_type = nullptr) {
524  return Type(Type::Handle, 64, lanes, handle_type);
525 }
526 
527 /** Construct the halide equivalent of a C type */
528 template<typename T>
529 inline Type type_of() {
530  return Type(halide_type_of<T>(), halide_handle_traits<T>::type_info());
531 }
532 
533 /** Halide type to a C++ type */
534 std::string type_to_c_type(Type type, bool include_space, bool c_plus_plus = true);
535 
536 } // namespace Halide
537 
538 #endif
This file declares the routines used by Halide internally in its runtime.
halide_type_code_t
Types in the halide type system.
@ halide_type_float
IEEE floating point numbers.
@ halide_type_handle
opaque pointer type (void *)
@ halide_type_bfloat
floating point numbers in the bfloat format
@ halide_type_int
signed integers
@ halide_type_uint
unsigned integers
#define HALIDE_ALWAYS_INLINE
Definition: HalideRuntime.h:38
#define HALIDE_DECLARE_EXTERN_STRUCT_TYPE(T)
Definition: Type.h:154
#define HALIDE_DECLARE_EXTERN_SIMPLE_TYPE(T)
Definition: Type.h:153
Various utility functions used internally Halide.
HALIDE_ALWAYS_INLINE auto is_const(A &&a) noexcept -> IsConst< decltype(pattern_arg(a))>
Definition: IRMatch.h:2200
std::string extract_namespaces(const std::string &name, std::vector< std::string > &namespaces)
Returns base name and fills in namespaces, outermost one first in vector.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
std::string type_to_c_type(Type type, bool include_space, bool c_plus_plus=true)
Halide type to a C++ type.
Type BFloat(int bits, int lanes=1)
Construct a floating-point type in the bfloat format.
Definition: Type.h:513
Type UInt(int bits, int lanes=1)
Constructing an unsigned integer type.
Definition: Type.h:503
Type Float(int bits, int lanes=1)
Construct a floating-point type.
Definition: Type.h:508
Type type_of()
Construct the halide equivalent of a C type.
Definition: Type.h:529
Type Int(int bits, int lanes=1)
Constructing a signed integer type.
Definition: Type.h:498
Type Handle(int lanes=1, const halide_handle_cplusplus_type *handle_type=nullptr)
Construct a handle type.
Definition: Type.h:523
Type Bool(int lanes=1)
Construct a boolean type.
Definition: Type.h:518
unsigned __INT64_TYPE__ uint64_t
signed __INT64_TYPE__ int64_t
signed __INT32_TYPE__ int32_t
unsigned __INT8_TYPE__ uint8_t
unsigned __INT16_TYPE__ uint16_t
unsigned __INT32_TYPE__ uint32_t
signed __INT16_TYPE__ int16_t
signed __INT8_TYPE__ int8_t
A fragment of Halide syntax.
Definition: Expr.h:256
Types in the halide type system.
Definition: Type.h:269
HALIDE_ALWAYS_INLINE halide_type_code_t code() const
Return the underlying data type of an element as an enum value.
Definition: Type.h:325
static const halide_type_code_t Float
Definition: Type.h:279
Type widen() const
Return Type with the same type code and number of lanes, but with twice as many bits.
Definition: Type.h:360
Type(halide_type_code_t code, int bits, int lanes, const halide_handle_cplusplus_type *handle_type=nullptr)
Construct a runtime representation of a Halide type from: code: The fundamental type from an enum.
Definition: Type.h:298
Type element_of() const
Produce the scalar type (that of a single element) of this vector type.
Definition: Type.h:465
bool is_max(uint64_t) const
Check if an integer constant value is the maximum or minimum representable value for this type.
static const halide_type_code_t Int
Aliases for halide_type_code_t values for legacy compatibility and to match the Halide internal C++ s...
Definition: Type.h:277
Type with_bits(int new_bits) const
Return Type with same type code and lanes, but new_bits for the number of bits.
Definition: Type.h:348
HALIDE_ALWAYS_INLINE bool is_int() const
Is this type a signed integer type?
Definition: Type.h:406
Expr min() const
Return an expression which is the minimum value of this type.
bool operator!=(const Type &other) const
Compare two types for inequality.
Definition: Type.h:449
HALIDE_ALWAYS_INLINE int lanes() const
Return the number of vector elements in this type.
Definition: Type.h:337
HALIDE_ALWAYS_INLINE bool is_uint() const
Is this type an unsigned integer type?
Definition: Type.h:412
HALIDE_ALWAYS_INLINE bool is_bool() const
Is this type boolean (represented as UInt(1))?
Definition: Type.h:374
Type with_lanes(int new_lanes) const
Return Type with same type code and number of bits, but new_lanes for the number of vector lanes.
Definition: Type.h:355
HALIDE_ALWAYS_INLINE Type(const halide_type_t &that, const halide_handle_cplusplus_type *handle_type=nullptr)
Type is a wrapper around halide_type_t with more methods for use inside the compiler.
Definition: Type.h:312
static const halide_type_code_t BFloat
Definition: Type.h:280
bool operator<(const Type &other) const
Compare ordering of two types so they can be used in certain containers and algorithms.
Definition: Type.h:454
Type(const Type &that)=default
Trivial copy constructor.
HALIDE_ALWAYS_INLINE int bits() const
Return the bit size of a single element of this type.
Definition: Type.h:331
HALIDE_ALWAYS_INLINE bool can_overflow_int() const
Definition: Type.h:430
bool same_handle_type(const Type &other) const
Check that the type name of two handles matches.
HALIDE_ALWAYS_INLINE bool is_int_or_uint() const
Is this type an integer type of any sort?
Definition: Type.h:418
static const halide_type_code_t UInt
Definition: Type.h:278
HALIDE_ALWAYS_INLINE bool is_vector() const
Is this type a vector type? (lanes() != 1).
Definition: Type.h:381
HALIDE_ALWAYS_INLINE bool is_bfloat() const
Is this type a floating point type (float or double).
Definition: Type.h:400
const halide_handle_cplusplus_type * handle_type
Type to be printed when declaring handles of this type.
Definition: Type.h:370
int bytes() const
The number of bytes required to store a single scalar value of this type.
Definition: Type.h:285
bool is_max(int64_t) const
bool can_represent(Type other) const
Can this type represent all values of another type?
bool is_min(int64_t) const
bool operator==(const Type &other) const
Compare two types for equality.
Definition: Type.h:444
HALIDE_ALWAYS_INLINE bool can_overflow() const
Definition: Type.h:436
Type with_code(halide_type_code_t new_code) const
Return Type with same number of bits and lanes, but new_code for a type code.
Definition: Type.h:342
static const halide_type_code_t Handle
Definition: Type.h:281
bool can_represent(double x) const
Can this type represent a particular constant?
Type narrow() const
Return Type with the same type code and number of lanes, but with half as many bits.
Definition: Type.h:365
HALIDE_ALWAYS_INLINE bool is_handle() const
Is this type an opaque handle type (void *)
Definition: Type.h:424
bool can_represent(int64_t x) const
bool is_min(uint64_t) const
bool can_represent(uint64_t x) const
Type & operator=(const Type &that)=default
Trivial copy assignment operator.
HALIDE_ALWAYS_INLINE bool is_scalar() const
Is this type a scalar type? (lanes() == 1).
Definition: Type.h:388
Expr max() const
Return an expression which is the maximum value of this type.
HALIDE_ALWAYS_INLINE bool is_float() const
Is this type a floating point type (float or double).
Definition: Type.h:394
Class that provides a type that implements half precision floating point using the bfloat16 format.
Definition: Float16.h:142
Class that provides a type that implements half precision floating point (IEEE754 2008 binary16) in s...
Definition: Float16.h:17
The raw representation of an image passed around by generated Halide code.
halide_c_type_to_name is a utility class used to provide a user-extensible way of naming Handle types...
Definition: Type.h:137
static constexpr bool known_type
Definition: Type.h:138
static halide_cplusplus_type_name name()
Definition: Type.h:139
A set of types to represent a C++ function signature.
Definition: Type.h:41
bool operator<(const halide_cplusplus_type_name &rhs) const
Definition: Type.h:66
std::string name
Definition: Type.h:51
bool operator==(const halide_cplusplus_type_name &rhs) const
Definition: Type.h:57
enum halide_cplusplus_type_name::CPPTypeType cpp_type_type
halide_cplusplus_type_name(CPPTypeType cpp_type_type, const std::string &name)
Definition: Type.h:53
bool operator!=(const halide_cplusplus_type_name &rhs) const
Definition: Type.h:62
CPPTypeType
An enum to indicate whether a C++ type is non-composite, a struct, class, or union.
Definition: Type.h:43
@ Class
"class Foo"
Definition: Type.h:46
@ Enum
"enum Foo"
Definition: Type.h:48
@ Union
"union Foo"
Definition: Type.h:47
@ Struct
"struct Foo"
Definition: Type.h:45
Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device all...
A structure to represent the fully scoped name of a C++ composite type for use in generating function...
Definition: Type.h:83
ReferenceType reference_type
Definition: Type.h:110
halide_cplusplus_type_name inner_name
Definition: Type.h:84
static halide_handle_cplusplus_type make()
Definition: Type.h:197
ReferenceType
References are separate because they only occur at the outermost level.
Definition: Type.h:105
halide_handle_cplusplus_type(const halide_cplusplus_type_name &inner_name, const std::vector< std::string > &namespaces={}, const std::vector< halide_cplusplus_type_name > &enclosing_types={}, const std::vector< uint8_t > &modifiers={}, ReferenceType reference_type=NotReference)
Definition: Type.h:112
std::vector< std::string > namespaces
Definition: Type.h:85
std::vector< halide_cplusplus_type_name > enclosing_types
Definition: Type.h:86
Modifier
One set of modifiers on a type.
Definition: Type.h:90
@ Const
Bitmask flag for "const".
Definition: Type.h:91
@ Restrict
Bitmask flag for "restrict".
Definition: Type.h:93
@ Volatile
Bitmask flag for "volatile".
Definition: Type.h:92
@ Pointer
Bitmask flag for a pointer "*".
Definition: Type.h:94
std::vector< uint8_t > cpp_type_modifiers
Qualifiers and indirections on type. 0 is innermost.
Definition: Type.h:98
A type traits template to provide a halide_handle_cplusplus_type value from a C++ type.
Definition: Type.h:246
static HALIDE_ALWAYS_INLINE const halide_handle_cplusplus_type * type_info()
Definition: Type.h:249
A parallel task to be passed to halide_do_parallel_tasks.
An opaque struct representing a semaphore.
A runtime tag for a type in the halide type system.
uint8_t bits
The number of bits of precision of a single scalar value of this type.
uint16_t lanes
How many elements in a vector.
uint8_t code
The basic type code: signed integer, unsigned integer, or floating point.