mlir.runtime.np_to_memref

Attributes

Classes

C128

A ctype representation for MLIR's Double Complex.

C64

A ctype representation for MLIR's Float Complex.

F16

A ctype representation for MLIR's Float16.

BF16

A ctype representation for MLIR's BFloat16.

F8E5M2

A ctype representation for MLIR's Float8E5M2.

UnrankedMemRefDescriptor

Creates a ctype struct for memref descriptor

Functions

as_ctype(dtp)

Converts dtype to ctype.

to_numpy(array)

Converts ctypes array back to numpy dtype array.

make_nd_memref_descriptor(rank, dtype)

make_zero_d_memref_descriptor(dtype)

get_ranked_memref_descriptor(nparray)

Returns a ranked memref descriptor for the given numpy array.

get_unranked_memref_descriptor(nparray)

Returns a generic/unranked memref descriptor for the given numpy array.

move_aligned_ptr_by_offset(aligned_ptr, offset)

Moves the supplied ctypes pointer ahead by offset elements.

unranked_memref_to_numpy(unranked_memref, np_dtype)

Converts unranked memrefs to numpy arrays.

ranked_memref_to_numpy(ranked_memref)

Converts ranked memrefs to numpy arrays.

Module Contents

mlir.runtime.np_to_memref.ml_dtypes = None
class mlir.runtime.np_to_memref.C128

Bases: ctypes.Structure

A ctype representation for MLIR’s Double Complex.

_fields_
class mlir.runtime.np_to_memref.C64

Bases: ctypes.Structure

A ctype representation for MLIR’s Float Complex.

_fields_
class mlir.runtime.np_to_memref.F16

Bases: ctypes.Structure

A ctype representation for MLIR’s Float16.

_fields_
class mlir.runtime.np_to_memref.BF16

Bases: ctypes.Structure

A ctype representation for MLIR’s BFloat16.

_fields_
class mlir.runtime.np_to_memref.F8E5M2

Bases: ctypes.Structure

A ctype representation for MLIR’s Float8E5M2.

_fields_
mlir.runtime.np_to_memref.as_ctype(dtp)

Converts dtype to ctype.

mlir.runtime.np_to_memref.to_numpy(array)

Converts ctypes array back to numpy dtype array.

mlir.runtime.np_to_memref.make_nd_memref_descriptor(rank, dtype)
mlir.runtime.np_to_memref.make_zero_d_memref_descriptor(dtype)
class mlir.runtime.np_to_memref.UnrankedMemRefDescriptor

Bases: ctypes.Structure

Creates a ctype struct for memref descriptor

_fields_
mlir.runtime.np_to_memref.get_ranked_memref_descriptor(nparray)

Returns a ranked memref descriptor for the given numpy array.

mlir.runtime.np_to_memref.get_unranked_memref_descriptor(nparray)

Returns a generic/unranked memref descriptor for the given numpy array.

mlir.runtime.np_to_memref.move_aligned_ptr_by_offset(aligned_ptr, offset)

Moves the supplied ctypes pointer ahead by offset elements.

mlir.runtime.np_to_memref.unranked_memref_to_numpy(unranked_memref, np_dtype)

Converts unranked memrefs to numpy arrays.

mlir.runtime.np_to_memref.ranked_memref_to_numpy(ranked_memref)

Converts ranked memrefs to numpy arrays.