legate::Type#

class Type#

A base class for data type metadata.

Subclassed by legate::FixedArrayType, legate::ListType, legate::StructType

Public Types

enum class Code : std::int32_t#

Enum for type codes.

Values:

enumerator BOOL#

Boolean type

enumerator INT8#

8-bit signed integer type

enumerator INT16#

16-bit signed integer type

enumerator INT32#

32-bit signed integer type

enumerator INT64#

64-bit signed integer type

enumerator UINT8#

8-bit unsigned integer type

enumerator UINT16#

16-bit unsigned integer type

enumerator UINT32#

32-bit unsigned integer type

enumerator UINT64#

64-bit unsigned integer type

enumerator FLOAT16#

Half-precision floating point type

enumerator FLOAT32#

Single-precision floating point type

enumerator FLOAT64#

Double-precision floating point type

enumerator COMPLEX64#

Single-precision complex type

enumerator COMPLEX128#

Double-precision complex type

enumerator NIL#

Null type

enumerator BINARY#

Opaque binary type

enumerator FIXED_ARRAY#

Fixed-size array type

enumerator STRUCT#

Struct type

enumerator STRING#

String type

enumerator LIST#

List type

Public Functions

Code code() const#

Code of the type.

Returns:

Type code

std::uint32_t size() const#

Size of the data type in bytes.

Returns:

Data type size in bytes

std::uint32_t alignment() const#

Alignment of the type.

Returns:

Alignment in bytes

std::uint32_t uid() const#

Unique ID of the data type.

Returns:

Unique ID

bool variable_size() const#

Indicates whether the data type is of variable size elements.

Returns:

true Elements can be variable size

Returns:

false Elements have fixed size

std::string to_string() const#

Converts the data type into a string.

Returns:

A string of the data type

bool is_primitive() const#

Indicates whether the type is a primitive type.

Returns:

true If the type is a primitive type

Returns:

false Otherwise

FixedArrayType as_fixed_array_type() const#

Dynamically casts the type into a fixed size array type.

If the type is not a fixed size array type, an exception will be raised.

Returns:

Type object

StructType as_struct_type() const#

Dynamically casts the type into a struct type.

If the type is not a struct type, an exception will be raised.

Returns:

Type object

ListType as_list_type() const#

Dynamically casts the type into a struct type.

If the type is not a struct type, an exception will be raised.

Returns:

Type object

void record_reduction_operator(
std::int32_t op_kind,
GlobalRedopID global_op_id
) const#

Records a reduction operator.

The global ID of the reduction operator is issued when that operator is registered to the runtime.

Parameters:
  • op_kind – Reduction operator kind

  • global_op_id – Global reduction operator ID

void record_reduction_operator(
ReductionOpKind op_kind,
GlobalRedopID global_op_id
) const#

Records a reduction operator.

The global ID of the reduction operator is issued when that operator is registered to the runtime.

Parameters:
  • op_kind – Reduction operator kind

  • global_op_id – Global reduction operator ID

GlobalRedopID find_reduction_operator(std::int32_t op_kind) const#

Finds the global operator ID for a given reduction operator kind.

Raises an exception if no reduction operator has been registered for the kind.

Parameters:

op_kind – Reduction operator kind

Returns:

Global reduction operator ID

GlobalRedopID find_reduction_operator(ReductionOpKind op_kind) const#

Finds the global operator ID for a given reduction operator kind.

Raises an exception if no reduction operator has been registered for the kind.

Parameters:

op_kind – Reduction operator kind

Returns:

Global reduction operator ID

bool operator==(const Type &other) const#

Equality check between types.

Note that type checks are name-based; two isomorphic fixed-size array types are considered different if their uids are different (the same applies to struct types).

Parameters:

otherType to compare

Returns:

true Types are equal

Returns:

false Types are different