Types#

group types

Enums

enum class ReductionOpKind : std::int32_t#

Enum for reduction operator kinds.

Values:

enumerator ADD#

Addition

enumerator SUB#

Subtraction

enumerator MUL#

Multiplication

enumerator DIV#

Division

enumerator MAX#

Binary maximum operator

enumerator MIN#

Binary minimum operator

enumerator OR#

Bitwise OR

enumerator AND#

Bitwse AND

enumerator XOR#

Bitwas XOR

enum class Code : std::int32_t#

Enum for type codes.

Values:

enumerator NIL#

Null type

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 BINARY#

Opaque binary type

enumerator FIXED_ARRAY#

Fixed-size array type

enumerator STRUCT#

Struct type

enumerator STRING#

String type

enumerator LIST#

List type

Functions

Type primitive_type(Type::Code code)#

Creates a metadata object for a primitive type.

Parameters:

codeType code

Returns:

Type object

Type string_type()#

Creates a metadata object for the string type.

Returns:

Type object

Type binary_type(std::uint32_t size)#

Creates an opaque binary type of a given size.

Parameters:

size – Element size

Returns:

Type object

Type fixed_array_type(const Type &element_type, std::uint32_t N)#

Creates a metadata object for a fixed-size array type.

Parameters:
  • element_typeType of the array elements

  • N – Size of the array

Returns:

Type object

Type struct_type(const std::vector<Type> &field_types, bool align = false)#

Creates a metadata object for a struct type.

Parameters:
  • field_types – A vector of field types

  • align – If true, fields in the struct are aligned

Returns:

Type object

Type list_type(const Type &element_type)#

Creates a metadata object for a list type.

Parameters:

element_typeType of the list elements

Returns:

Type object

template<typename ...Args>
std::enable_if_t<std::conjunction_v<std::is_same<std::decay_t<Args>, Type>...>, Type> struct_type(bool align, Args&&... field_types)#

Creates a metadata object for a struct type.

Parameters:
  • align – If true, fields in the struct are aligned

  • field_types – Field types

Returns:

Type object

Type bool_()#

Creates a boolean type.

Returns:

Type object

Type int8()#

Creates a 8-bit signed integer type.

Returns:

Type object

Type int16()#

Creates a 16-bit signed integer type.

Returns:

Type object

Type int32()#

Creates a 32-bit signed integer type.

Returns:

Type object

Type int64()#

Creates a 64-bit signed integer type.

Returns:

Type object

Type uint8()#

Creates a 8-bit unsigned integer type.

Returns:

Type object

Type uint16()#

Creates a 16-bit unsigned integer type.

Returns:

Type object

Type uint32()#

Creates a 32-bit unsigned integer type.

Returns:

Type object

Type uint64()#

Creates a 64-bit unsigned integer type.

Returns:

Type object

Type float16()#

Creates a half-precision floating point type.

Returns:

Type object

Type float32()#

Creates a single-precision floating point type.

Returns:

Type object

Type float64()#

Creates a double-precision floating point type.

Returns:

Type object

Type complex64()#

Creates a single-precision complex number type.

Returns:

Type object

Type complex128()#

Creates a double-precision complex number type.

Returns:

Type object

Type point_type(std::uint32_t ndim)#

Creates a point type.

Parameters:

ndim – Number of dimensions

Returns:

Type object

Type rect_type(std::uint32_t ndim)#

Creates a rect type.

Parameters:

ndim – Number of dimensions

Returns:

Type object

Type null_type()#

Creates a null type.

Returns:

Type object

bool is_point_type(const Type &type)#

Checks if the type is a point type.

Parameters:

typeType to check

Returns:

true If the type is a point type

Returns:

false Otherwise

bool is_point_type(const Type &type, std::uint32_t ndim)#

Checks if the type is a point type of the given dimensionality.

Parameters:
  • typeType to check

  • ndim – Number of dimensions the point type should have

Returns:

true If the type is a point type

Returns:

false Otherwise

std::int32_t ndim_point_type(const Type &type)#

Returns the number of dimensions of a given point type.

Parameters:

type – Point type

Throws:

std::invalid_argument – IF the type is not a point type

Returns:

Number of dimensions

bool is_rect_type(const Type &type)#

Checks if the type is a rect type.

Parameters:

typeType to check

Returns:

true If the type is a rect type

Returns:

false Otherwise

bool is_rect_type(const Type &type, std::uint32_t ndim)#

Checks if the type is a rect type of the given dimensionality.

Parameters:
  • typeType to check

  • ndim – Number of dimensions the rect type should have

Returns:

true If the type is a rect type

Returns:

false Otherwise

std::int32_t ndim_rect_type(const Type &type)#

Returns the number of dimensions of a given rect type.

Parameters:

type – Rect type

Throws:

std::invalid_argument – IF the type is not a rect type

Returns:

Number of dimensions

class Type#
#include <core/type/type_info.h>

A base class for data type metadata.

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

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#

Inidicates whether the data type is of varible 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, std::int32_t 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, std::int32_t 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

std::int32_t 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

std::int32_t 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

class FixedArrayType : public legate::Type#
#include <core/type/type_info.h>

A class for fixed-size array data types.

Public Functions

std::uint32_t num_elements() const#

Returns the number of elements.

Returns:

Number of elements

Type element_type() const#

Returns the element type.

Returns:

Element type

class StructType : public legate::Type#
#include <core/type/type_info.h>

A class for struct data types.

Public Functions

std::uint32_t num_fields() const#

Returns the number of fields.

Returns:

Number of fields

Type field_type(std::uint32_t field_idx) const#

Returns the element type.

Parameters:

field_idx – Field index. Must be within the range

Returns:

Element type

bool aligned() const#

Indiciates whether the fields are aligned.

Returns:

true Fields are aligned

Returns:

false Fields are compact

std::vector<std::uint32_t> offsets() const#

Returns offsets to fields.

Returns:

Field offsets in a vector

class ListType : public legate::Type#
#include <core/type/type_info.h>

A class for list types.

Public Functions

Type element_type() const#

Returns the element type.

Returns:

Element type