MLIR
20.0.0git
|
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | MlirStringRef |
A pointer to a sized fragment of a string, not necessarily null-terminated. More... | |
struct | MlirLogicalResult |
A logical result value, essentially a boolean with named states. More... | |
Macros | |
#define | MLIR_CAPI_EXPORTED __attribute__((visibility("default"))) |
#define | DEFINE_C_API_STRUCT(name, storage) |
Typedefs | |
typedef struct MlirStringRef | MlirStringRef |
typedef void(* | MlirStringCallback) (MlirStringRef, void *) |
A callback for returning string references. More... | |
typedef struct MlirLogicalResult | MlirLogicalResult |
Functions | |
DEFINE_C_API_STRUCT (MlirLlvmThreadPool, void) | |
Re-export llvm::ThreadPool so as to avoid including the LLVM C API directly. More... | |
DEFINE_C_API_STRUCT (MlirTypeID, const void) | |
DEFINE_C_API_STRUCT (MlirTypeIDAllocator, void) | |
static MlirStringRef | mlirStringRefCreate (const char *str, size_t length) |
Constructs a string reference from the pointer and length. More... | |
MLIR_CAPI_EXPORTED MlirStringRef | mlirStringRefCreateFromCString (const char *str) |
Constructs a string reference from a null-terminated C string. More... | |
MLIR_CAPI_EXPORTED bool | mlirStringRefEqual (MlirStringRef string, MlirStringRef other) |
Returns true if two string references are equal, false otherwise. More... | |
static bool | mlirLogicalResultIsSuccess (MlirLogicalResult res) |
Checks if the given logical result represents a success. More... | |
static bool | mlirLogicalResultIsFailure (MlirLogicalResult res) |
Checks if the given logical result represents a failure. More... | |
static MlirLogicalResult | mlirLogicalResultSuccess (void) |
Creates a logical result representing a success. More... | |
static MlirLogicalResult | mlirLogicalResultFailure (void) |
Creates a logical result representing a failure. More... | |
MLIR_CAPI_EXPORTED MlirLlvmThreadPool | mlirLlvmThreadPoolCreate (void) |
Create an LLVM thread pool. More... | |
MLIR_CAPI_EXPORTED void | mlirLlvmThreadPoolDestroy (MlirLlvmThreadPool pool) |
Destroy an LLVM thread pool. More... | |
MLIR_CAPI_EXPORTED MlirTypeID | mlirTypeIDCreate (const void *ptr) |
ptr must be 8 byte aligned and unique to a type valid for the duration of the returned type id's usage More... | |
static bool | mlirTypeIDIsNull (MlirTypeID typeID) |
Checks whether a type id is null. More... | |
MLIR_CAPI_EXPORTED bool | mlirTypeIDEqual (MlirTypeID typeID1, MlirTypeID typeID2) |
Checks if two type ids are equal. More... | |
MLIR_CAPI_EXPORTED size_t | mlirTypeIDHashValue (MlirTypeID typeID) |
Returns the hash value of the type id. More... | |
MLIR_CAPI_EXPORTED MlirTypeIDAllocator | mlirTypeIDAllocatorCreate (void) |
Creates a type id allocator for dynamic type id creation. More... | |
MLIR_CAPI_EXPORTED void | mlirTypeIDAllocatorDestroy (MlirTypeIDAllocator allocator) |
Deallocates the allocator and all allocated type ids. More... | |
MLIR_CAPI_EXPORTED MlirTypeID | mlirTypeIDAllocatorAllocateTypeID (MlirTypeIDAllocator allocator) |
Allocates a type id that is valid for the lifetime of the allocator. More... | |
#define DEFINE_C_API_STRUCT | ( | name, | |
storage | |||
) |
#define MLIR_CAPI_EXPORTED __attribute__((visibility("default"))) |
typedef struct MlirLogicalResult MlirLogicalResult |
typedef void(* MlirStringCallback) (MlirStringRef, void *) |
A callback for returning string references.
This function is called back by the functions that need to return a reference to the portion of the string with the following arguments:
typedef struct MlirStringRef MlirStringRef |
DEFINE_C_API_STRUCT | ( | MlirLlvmThreadPool | , |
void | |||
) |
Re-export llvm::ThreadPool so as to avoid including the LLVM C API directly.
DEFINE_C_API_STRUCT | ( | MlirTypeID | , |
const void | |||
) |
DEFINE_C_API_STRUCT | ( | MlirTypeIDAllocator | , |
void | |||
) |
MLIR_CAPI_EXPORTED MlirLlvmThreadPool mlirLlvmThreadPoolCreate | ( | void | ) |
Create an LLVM thread pool.
This is reexported here to avoid directly pulling in the LLVM headers directly.
Definition at line 27 of file Support.cpp.
References wrap().
MLIR_CAPI_EXPORTED void mlirLlvmThreadPoolDestroy | ( | MlirLlvmThreadPool | pool | ) |
Destroy an LLVM thread pool.
Definition at line 31 of file Support.cpp.
|
inlinestatic |
Creates a logical result representing a failure.
Definition at line 138 of file Support.h.
Referenced by mlir::python::PyMlirContext::attachDiagnosticHandler(), mlirInferShapedTypeOpInterfaceInferReturnTypes(), mlirInferTypeOpInterfaceInferReturnTypes(), mlirMemRefTypeGetStridesAndOffset(), mlirTransformApplyNamedSequence(), and wrap().
|
inlinestatic |
Checks if the given logical result represents a failure.
Definition at line 127 of file Support.h.
References MlirLogicalResult::value.
Referenced by mlir::python::PyInferShapedTypeOpInterface::inferReturnTypeComponents(), mlir::python::PyInferTypeOpInterface::inferReturnTypes(), mlir::python::PySymbolTable::replaceAllSymbolUses(), and mlir::python::PyOperationBase::writeBytecode().
|
inlinestatic |
Checks if the given logical result represents a success.
Definition at line 122 of file Support.h.
References MlirLogicalResult::value.
Referenced by unwrap().
|
inlinestatic |
Creates a logical result representing a success.
Definition at line 132 of file Support.h.
Referenced by mlir::python::PyMlirContext::attachDiagnosticHandler(), mlirInferShapedTypeOpInterfaceInferReturnTypes(), mlirInferTypeOpInterfaceInferReturnTypes(), mlirMemRefTypeGetStridesAndOffset(), and wrap().
|
inlinestatic |
Constructs a string reference from the pointer and length.
The pointer need not reference to a null-terminated string.
Definition at line 82 of file Support.h.
References MlirStringRef::data, and MlirStringRef::length.
Referenced by mlir::python::PySymbolTable::dunderGetItem(), mlir::python::PyInferShapedTypeOpInterface::inferReturnTypeComponents(), mlir::python::PyInferTypeOpInterface::inferReturnTypes(), mlirGPUObjectAttrGetObject(), mlirStringRefCreateFromCString(), mlir::python::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface(), toMlirStringRef(), wrap(), and mlir::detail::CallbackOstream::write_impl().
MLIR_CAPI_EXPORTED MlirStringRef mlirStringRefCreateFromCString | ( | const char * | str | ) |
Constructs a string reference from a null-terminated C string.
Prefer mlirStringRefCreate if the length of the string is known.
Definition at line 15 of file Support.cpp.
References mlirStringRefCreate().
MLIR_CAPI_EXPORTED bool mlirStringRefEqual | ( | MlirStringRef | string, |
MlirStringRef | other | ||
) |
Returns true if two string references are equal, false otherwise.
Definition at line 19 of file Support.cpp.
References MlirStringRef::data, and MlirStringRef::length.
MLIR_CAPI_EXPORTED MlirTypeID mlirTypeIDAllocatorAllocateTypeID | ( | MlirTypeIDAllocator | allocator | ) |
Allocates a type id that is valid for the lifetime of the allocator.
Definition at line 67 of file Support.cpp.
MLIR_CAPI_EXPORTED MlirTypeIDAllocator mlirTypeIDAllocatorCreate | ( | void | ) |
Creates a type id allocator for dynamic type id creation.
Definition at line 59 of file Support.cpp.
References wrap().
MLIR_CAPI_EXPORTED void mlirTypeIDAllocatorDestroy | ( | MlirTypeIDAllocator | allocator | ) |
Deallocates the allocator and all allocated type ids.
Definition at line 63 of file Support.cpp.
References unwrap().
MLIR_CAPI_EXPORTED MlirTypeID mlirTypeIDCreate | ( | const void * | ptr | ) |
ptr
must be 8 byte aligned and unique to a type valid for the duration of the returned type id's usage
Definition at line 38 of file Support.cpp.
References mlir::TypeID::getFromOpaquePointer(), and wrap().
Referenced by llvm::DenseMapInfo< MlirTypeID >::getEmptyKey(), and llvm::DenseMapInfo< MlirTypeID >::getTombstoneKey().
MLIR_CAPI_EXPORTED bool mlirTypeIDEqual | ( | MlirTypeID | typeID1, |
MlirTypeID | typeID2 | ||
) |
Checks if two type ids are equal.
Definition at line 47 of file Support.cpp.
References unwrap().
Referenced by llvm::DenseMapInfo< MlirTypeID >::isEqual(), and mlir::python::PyTypeID::operator==().
MLIR_CAPI_EXPORTED size_t mlirTypeIDHashValue | ( | MlirTypeID | typeID | ) |
Returns the hash value of the type id.
Definition at line 51 of file Support.cpp.
References mlir::polynomial::hash_value(), and unwrap().
Referenced by llvm::DenseMapInfo< MlirTypeID >::getHashValue().
|
inlinestatic |
Checks whether a type id is null.
Definition at line 163 of file Support.h.
Referenced by mlir::python::PyTypeID::createFromCapsule(), nanobind::detail::type_caster< MlirTypeID >::from_python(), pybind11::detail::type_caster< MlirTypeID >::load(), and mlir::python::PyValue::maybeDownCast().