29 static int mlirTypeIsAIntegerOrFloat(MlirType type) {
37 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
39 static constexpr
const char *pyClassName =
"IntegerType";
42 static void bindDerived(ClassTy &c) {
47 return PyIntegerType(context->getRef(), t);
49 py::arg(
"width"), py::arg(
"context") = py::none(),
50 "Create a signless integer type");
55 return PyIntegerType(context->getRef(), t);
57 py::arg(
"width"), py::arg(
"context") = py::none(),
58 "Create a signed integer type");
63 return PyIntegerType(context->getRef(), t);
65 py::arg(
"width"), py::arg(
"context") = py::none(),
66 "Create an unsigned integer type");
67 c.def_property_readonly(
70 "Returns the width of the integer type");
71 c.def_property_readonly(
73 [](PyIntegerType &
self) ->
bool {
76 "Returns whether this is a signless integer");
77 c.def_property_readonly(
79 [](PyIntegerType &
self) ->
bool {
82 "Returns whether this is a signed integer");
83 c.def_property_readonly(
85 [](PyIntegerType &
self) ->
bool {
88 "Returns whether this is an unsigned integer");
96 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
98 static constexpr
const char *pyClassName =
"IndexType";
101 static void bindDerived(ClassTy &c) {
106 return PyIndexType(context->getRef(), t);
108 py::arg(
"context") = py::none(),
"Create a index type.");
115 static constexpr
const char *pyClassName =
"FloatType";
118 static void bindDerived(ClassTy &c) {
119 c.def_property_readonly(
121 "Returns the width of the floating-point type");
126 class PyFloat8E4M3FNType
130 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
132 static constexpr
const char *pyClassName =
"Float8E4M3FNType";
135 static void bindDerived(ClassTy &c) {
140 return PyFloat8E4M3FNType(context->getRef(), t);
142 py::arg(
"context") = py::none(),
"Create a float8_e4m3fn type.");
147 class PyFloat8E5M2Type :
public PyConcreteType<PyFloat8E5M2Type, PyFloatType> {
150 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
152 static constexpr
const char *pyClassName =
"Float8E5M2Type";
155 static void bindDerived(ClassTy &c) {
160 return PyFloat8E5M2Type(context->getRef(), t);
162 py::arg(
"context") = py::none(),
"Create a float8_e5m2 type.");
167 class PyFloat8E4M3FNUZType
171 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
173 static constexpr
const char *pyClassName =
"Float8E4M3FNUZType";
176 static void bindDerived(ClassTy &c) {
181 return PyFloat8E4M3FNUZType(context->getRef(), t);
183 py::arg(
"context") = py::none(),
"Create a float8_e4m3fnuz type.");
188 class PyFloat8E4M3B11FNUZType
192 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
194 static constexpr
const char *pyClassName =
"Float8E4M3B11FNUZType";
197 static void bindDerived(ClassTy &c) {
202 return PyFloat8E4M3B11FNUZType(context->getRef(), t);
204 py::arg(
"context") = py::none(),
"Create a float8_e4m3b11fnuz type.");
209 class PyFloat8E5M2FNUZType
213 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
215 static constexpr
const char *pyClassName =
"Float8E5M2FNUZType";
218 static void bindDerived(ClassTy &c) {
223 return PyFloat8E5M2FNUZType(context->getRef(), t);
225 py::arg(
"context") = py::none(),
"Create a float8_e5m2fnuz type.");
230 class PyBF16Type :
public PyConcreteType<PyBF16Type, PyFloatType> {
233 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
235 static constexpr
const char *pyClassName =
"BF16Type";
238 static void bindDerived(ClassTy &c) {
243 return PyBF16Type(context->getRef(), t);
245 py::arg(
"context") = py::none(),
"Create a bf16 type.");
253 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
255 static constexpr
const char *pyClassName =
"F16Type";
258 static void bindDerived(ClassTy &c) {
263 return PyF16Type(context->getRef(), t);
265 py::arg(
"context") = py::none(),
"Create a f16 type.");
270 class PyTF32Type :
public PyConcreteType<PyTF32Type, PyFloatType> {
273 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
275 static constexpr
const char *pyClassName =
"FloatTF32Type";
278 static void bindDerived(ClassTy &c) {
283 return PyTF32Type(context->getRef(), t);
285 py::arg(
"context") = py::none(),
"Create a tf32 type.");
293 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
295 static constexpr
const char *pyClassName =
"F32Type";
298 static void bindDerived(ClassTy &c) {
303 return PyF32Type(context->getRef(), t);
305 py::arg(
"context") = py::none(),
"Create a f32 type.");
313 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
315 static constexpr
const char *pyClassName =
"F64Type";
318 static void bindDerived(ClassTy &c) {
323 return PyF64Type(context->getRef(), t);
325 py::arg(
"context") = py::none(),
"Create a f64 type.");
333 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
335 static constexpr
const char *pyClassName =
"NoneType";
338 static void bindDerived(ClassTy &c) {
343 return PyNoneType(context->getRef(), t);
345 py::arg(
"context") = py::none(),
"Create a none type.");
353 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
355 static constexpr
const char *pyClassName =
"ComplexType";
358 static void bindDerived(ClassTy &c) {
363 if (mlirTypeIsAIntegerOrFloat(elementType)) {
365 return PyComplexType(elementType.
getContext(), t);
367 throw py::value_error(
368 (Twine(
"invalid '") +
369 py::repr(py::cast(elementType)).cast<std::string>() +
370 "' and expected floating point or integer type.")
373 "Create a complex type");
374 c.def_property_readonly(
377 "Returns element type.");
384 static constexpr
const char *pyClassName =
"ShapedType";
387 static void bindDerived(ClassTy &c) {
388 c.def_property_readonly(
391 "Returns the element type of the shaped type.");
392 c.def_property_readonly(
395 "Returns whether the given shaped type is ranked.");
396 c.def_property_readonly(
398 [](PyShapedType &
self) {
399 self.requireHasRank();
402 "Returns the rank of the given ranked shaped type.");
403 c.def_property_readonly(
405 [](PyShapedType &
self) ->
bool {
408 "Returns whether the given shaped type has a static shape.");
411 [](PyShapedType &
self, intptr_t dim) ->
bool {
412 self.requireHasRank();
416 "Returns whether the dim-th dimension of the given shaped type is "
420 [](PyShapedType &
self, intptr_t dim) {
421 self.requireHasRank();
425 "Returns the dim-th dimension of the given ranked shaped type.");
430 "Returns whether the given dimension size indicates a dynamic "
433 "is_dynamic_stride_or_offset",
434 [](PyShapedType &
self, int64_t val) ->
bool {
435 self.requireHasRank();
439 "Returns whether the given value is used as a placeholder for dynamic "
440 "strides and offsets in shaped types.");
441 c.def_property_readonly(
443 [](PyShapedType &
self) {
444 self.requireHasRank();
446 std::vector<int64_t> shape;
449 for (int64_t i = 0; i < rank; ++i)
453 "Returns the shape of the ranked shaped type as a list of integers.");
456 "Returns the value used to indicate dynamic dimensions in shaped "
459 "get_dynamic_stride_or_offset",
461 "Returns the value used to indicate dynamic strides or offsets in "
466 void requireHasRank() {
468 throw py::value_error(
469 "calling this method requires that the type has a rank.");
475 class PyVectorType :
public PyConcreteType<PyVectorType, PyShapedType> {
478 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
480 static constexpr
const char *pyClassName =
"VectorType";
483 static void bindDerived(ClassTy &c) {
485 py::arg(
"element_type"), py::kw_only(),
486 py::arg(
"scalable") = py::none(),
487 py::arg(
"scalable_dims") = py::none(),
488 py::arg(
"loc") = py::none(),
"Create a vector type")
489 .def_property_readonly(
492 .def_property_readonly(
"scalable_dims", [](MlirType
self) {
493 std::vector<bool> scalableDims;
495 scalableDims.reserve(rank);
496 for (
size_t i = 0; i < rank; ++i)
503 static PyVectorType
get(std::vector<int64_t> shape,
PyType &elementType,
504 std::optional<py::list> scalable,
505 std::optional<std::vector<int64_t>> scalableDims,
507 if (scalable && scalableDims) {
508 throw py::value_error(
"'scalable' and 'scalable_dims' kwargs "
509 "are mutually exclusive.");
515 if (scalable->size() != shape.size())
516 throw py::value_error(
"Expected len(scalable) == len(shape).");
519 *scalable, [](
const py::handle &h) {
return h.cast<
bool>(); }));
521 scalableDimFlags.data(),
523 }
else if (scalableDims) {
525 for (int64_t dim : *scalableDims) {
526 if (
static_cast<size_t>(dim) >= scalableDimFlags.size() || dim < 0)
527 throw py::value_error(
"Scalable dimension index out of bounds.");
528 scalableDimFlags[dim] =
true;
531 scalableDimFlags.data(),
538 throw MLIRError(
"Invalid type", errors.take());
539 return PyVectorType(elementType.
getContext(), type);
544 class PyRankedTensorType
548 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
550 static constexpr
const char *pyClassName =
"RankedTensorType";
553 static void bindDerived(ClassTy &c) {
556 [](std::vector<int64_t> shape,
PyType &elementType,
560 loc, shape.size(), shape.data(), elementType,
563 throw MLIRError(
"Invalid type", errors.take());
564 return PyRankedTensorType(elementType.
getContext(), t);
566 py::arg(
"shape"), py::arg(
"element_type"),
567 py::arg(
"encoding") = py::none(), py::arg(
"loc") = py::none(),
568 "Create a ranked tensor type");
569 c.def_property_readonly(
571 [](PyRankedTensorType &
self) -> std::optional<MlirAttribute> {
581 class PyUnrankedTensorType
585 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
587 static constexpr
const char *pyClassName =
"UnrankedTensorType";
590 static void bindDerived(ClassTy &c) {
597 throw MLIRError(
"Invalid type", errors.take());
598 return PyUnrankedTensorType(elementType.
getContext(), t);
600 py::arg(
"element_type"), py::arg(
"loc") = py::none(),
601 "Create a unranked tensor type");
606 class PyMemRefType :
public PyConcreteType<PyMemRefType, PyShapedType> {
609 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
611 static constexpr
const char *pyClassName =
"MemRefType";
614 static void bindDerived(ClassTy &c) {
617 [](std::vector<int64_t> shape,
PyType &elementType,
622 MlirAttribute memSpaceAttr =
626 shape.data(), layoutAttr, memSpaceAttr);
628 throw MLIRError(
"Invalid type", errors.take());
629 return PyMemRefType(elementType.
getContext(), t);
631 py::arg(
"shape"), py::arg(
"element_type"),
632 py::arg(
"layout") = py::none(), py::arg(
"memory_space") = py::none(),
633 py::arg(
"loc") = py::none(),
"Create a memref type")
634 .def_property_readonly(
636 [](PyMemRefType &
self) -> MlirAttribute {
639 "The layout of the MemRef type.")
641 "get_strides_and_offset",
642 [](PyMemRefType &
self) -> std::pair<std::vector<int64_t>, int64_t> {
646 self, strides.data(), &offset)))
647 throw std::runtime_error(
648 "Failed to extract strides and offset from memref.");
649 return {strides, offset};
651 "The strides and offset of the MemRef type.")
652 .def_property_readonly(
658 "The layout of the MemRef type as an affine map.")
659 .def_property_readonly(
661 [](PyMemRefType &
self) -> std::optional<MlirAttribute> {
667 "Returns the memory space of the given MemRef type.");
672 class PyUnrankedMemRefType
676 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
678 static constexpr
const char *pyClassName =
"UnrankedMemRefType";
681 static void bindDerived(ClassTy &c) {
687 MlirAttribute memSpaceAttr = {};
689 memSpaceAttr = *memorySpace;
694 throw MLIRError(
"Invalid type", errors.take());
695 return PyUnrankedMemRefType(elementType.
getContext(), t);
697 py::arg(
"element_type"), py::arg(
"memory_space"),
698 py::arg(
"loc") = py::none(),
"Create a unranked memref type")
699 .def_property_readonly(
701 [](PyUnrankedMemRefType &
self) -> std::optional<MlirAttribute> {
707 "Returns the memory space of the given Unranked MemRef type.");
715 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
717 static constexpr
const char *pyClassName =
"TupleType";
720 static void bindDerived(ClassTy &c) {
726 return PyTupleType(context->getRef(), t);
728 py::arg(
"elements"), py::arg(
"context") = py::none(),
729 "Create a tuple type");
732 [](PyTupleType &
self, intptr_t pos) {
735 py::arg(
"pos"),
"Returns the pos-th type in the tuple type.");
736 c.def_property_readonly(
738 [](PyTupleType &
self) -> intptr_t {
741 "Returns the number of types contained in a tuple.");
749 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
751 static constexpr
const char *pyClassName =
"FunctionType";
754 static void bindDerived(ClassTy &c) {
757 [](std::vector<MlirType> inputs, std::vector<MlirType> results,
761 results.size(), results.data());
762 return PyFunctionType(context->getRef(), t);
764 py::arg(
"inputs"), py::arg(
"results"), py::arg(
"context") = py::none(),
765 "Gets a FunctionType from a list of input and result types");
766 c.def_property_readonly(
768 [](PyFunctionType &
self) {
777 "Returns the list of input types in the FunctionType.");
778 c.def_property_readonly(
780 [](PyFunctionType &
self) {
788 "Returns the list of result types in the FunctionType.");
800 static constexpr GetTypeIDFunctionTy getTypeIdFunction =
802 static constexpr
const char *pyClassName =
"OpaqueType";
805 static void bindDerived(ClassTy &c) {
808 [](std::string dialectNamespace, std::string typeData,
813 return PyOpaqueType(context->getRef(), type);
815 py::arg(
"dialect_namespace"), py::arg(
"buffer"),
816 py::arg(
"context") = py::none(),
817 "Create an unregistered (opaque) dialect type.");
818 c.def_property_readonly(
820 [](PyOpaqueType &
self) {
822 return py::str(stringRef.
data, stringRef.
length);
824 "Returns the dialect namespace for the Opaque type as a string.");
825 c.def_property_readonly(
827 [](PyOpaqueType &
self) {
829 return py::str(stringRef.
data, stringRef.
length);
831 "Returns the data for the Opaque type as a string.");
838 PyIntegerType::bind(m);
839 PyFloatType::bind(m);
840 PyIndexType::bind(m);
841 PyFloat8E4M3FNType::bind(m);
842 PyFloat8E5M2Type::bind(m);
843 PyFloat8E4M3FNUZType::bind(m);
844 PyFloat8E4M3B11FNUZType::bind(m);
845 PyFloat8E5M2FNUZType::bind(m);
852 PyComplexType::bind(m);
853 PyShapedType::bind(m);
854 PyVectorType::bind(m);
855 PyRankedTensorType::bind(m);
856 PyUnrankedTensorType::bind(m);
857 PyMemRefType::bind(m);
858 PyUnrankedMemRefType::bind(m);
859 PyTupleType::bind(m);
860 PyFunctionType::bind(m);
861 PyOpaqueType::bind(m);
static MlirStringRef toMlirStringRef(const std::string &s)
static MLIRContext * getContext(OpFoldResult val)
PyMlirContextRef & getContext()
Accesses the context reference.
Used in function arguments when None should resolve to the current context manager set instance.
Used in function arguments when None should resolve to the current context manager set instance.
ReferrentTy * get() const
Wrapper around the generic MlirAttribute.
CRTP base classes for Python types that subclass Type and should be castable from it (i....
Wrapper around the generic MlirType.
MLIR_CAPI_EXPORTED MlirAttribute mlirAttributeGetNull(void)
Returns an empty attribute.
MLIR_CAPI_EXPORTED bool mlirIntegerTypeIsSignless(MlirType type)
Checks whether the given integer type is signless.
MLIR_CAPI_EXPORTED bool mlirTypeIsAMemRef(MlirType type)
Checks whether the given type is a MemRef type.
MLIR_CAPI_EXPORTED MlirAttribute mlirRankedTensorTypeGetEncoding(MlirType type)
Gets the 'encoding' attribute from the ranked tensor type, returning a null attribute if none.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat16TypeGetTypeID(void)
Returns the typeID of an Float16 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAInteger(MlirType type)
Checks whether the given type is an integer type.
MLIR_CAPI_EXPORTED MlirAffineMap mlirMemRefTypeGetAffineMap(MlirType type)
Returns the affine map of the given MemRef type.
MLIR_CAPI_EXPORTED unsigned mlirFloatTypeGetWidth(MlirType type)
Returns the bitwidth of a floating-point type.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloatTF32TypeGetTypeID(void)
Returns the typeID of a TF32 type.
MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDimSize(MlirType type, intptr_t dim)
Returns the dim-th dimension of the given ranked shaped type.
MLIR_CAPI_EXPORTED MlirTypeID mlirNoneTypeGetTypeID(void)
Returns the typeID of an None type.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat8E4M3FNUZTypeGetTypeID(void)
Returns the typeID of an Float8E4M3FNUZ type.
MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeGet(MlirContext ctx, unsigned bitwidth)
Creates a signless integer type of the given bitwidth in the context.
MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueTypeGetData(MlirType type)
Returns the raw data as a string reference.
MLIR_CAPI_EXPORTED bool mlirTypeIsAVector(MlirType type)
Checks whether the given type is a Vector type.
MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGetInput(MlirType type, intptr_t pos)
Returns the pos-th input type.
MLIR_CAPI_EXPORTED MlirType mlirIndexTypeGet(MlirContext ctx)
Creates an index type in the given context.
MLIR_CAPI_EXPORTED MlirTypeID mlirVectorTypeGetTypeID(void)
Returns the typeID of an Vector type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFunction(MlirType type)
Checks whether the given type is a function type.
MLIR_CAPI_EXPORTED MlirType mlirFloat8E5M2FNUZTypeGet(MlirContext ctx)
Creates an f8E5M2FNUZ type in the given context.
MLIR_CAPI_EXPORTED MlirTypeID mlirUnrankedTensorTypeGetTypeID(void)
Returns the typeID of an UnrankedTensor type.
MLIR_CAPI_EXPORTED bool mlirIntegerTypeIsUnsigned(MlirType type)
Checks whether the given integer type is unsigned.
MLIR_CAPI_EXPORTED MlirTypeID mlirMemRefTypeGetTypeID(void)
Returns the typeID of an MemRef type.
MLIR_CAPI_EXPORTED unsigned mlirIntegerTypeGetWidth(MlirType type)
Returns the bitwidth of an integer type.
MLIR_CAPI_EXPORTED MlirType mlirFloat8E5M2TypeGet(MlirContext ctx)
Creates an f8E5M2 type in the given context.
MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetRank(MlirType type)
Returns the rank of the given ranked shaped type.
MLIR_CAPI_EXPORTED MlirType mlirF64TypeGet(MlirContext ctx)
Creates a f64 type in the given context.
MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeSignedGet(MlirContext ctx, unsigned bitwidth)
Creates a signed integer type of the given bitwidth in the context.
MLIR_CAPI_EXPORTED MlirType mlirUnrankedTensorTypeGetChecked(MlirLocation loc, MlirType elementType)
Same as "mlirUnrankedTensorTypeGet" but returns a nullptr wrapping MlirType on illegal arguments,...
MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGetScalableChecked(MlirLocation loc, intptr_t rank, const int64_t *shape, const bool *scalable, MlirType elementType)
Same as "mlirVectorTypeGetScalable" but returns a nullptr wrapping MlirType on illegal arguments,...
MLIR_CAPI_EXPORTED MlirType mlirF16TypeGet(MlirContext ctx)
Creates an f16 type in the given context.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E5M2(MlirType type)
Checks whether the given type is an f8E5M2 type.
MLIR_CAPI_EXPORTED MlirAttribute mlirMemRefTypeGetMemorySpace(MlirType type)
Returns the memory space of the given MemRef type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAF64(MlirType type)
Checks whether the given type is an f64 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAF16(MlirType type)
Checks whether the given type is an f16 type.
MLIR_CAPI_EXPORTED bool mlirIntegerTypeIsSigned(MlirType type)
Checks whether the given integer type is signed.
MLIR_CAPI_EXPORTED MlirType mlirRankedTensorTypeGetChecked(MlirLocation loc, intptr_t rank, const int64_t *shape, MlirType elementType, MlirAttribute encoding)
Same as "mlirRankedTensorTypeGet" but returns a nullptr wrapping MlirType on illegal arguments,...
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat8E5M2FNUZTypeGetTypeID(void)
Returns the typeID of an Float8E5M2FNUZ type.
MLIR_CAPI_EXPORTED MlirType mlirShapedTypeGetElementType(MlirType type)
Returns the element type of the shaped type.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat64TypeGetTypeID(void)
Returns the typeID of an Float64 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsATuple(MlirType type)
Checks whether the given type is a tuple type.
MLIR_CAPI_EXPORTED intptr_t mlirFunctionTypeGetNumInputs(MlirType type)
Returns the number of input types.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat8E5M2TypeGetTypeID(void)
Returns the typeID of an Float8E5M2 type.
MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGetChecked(MlirLocation loc, intptr_t rank, const int64_t *shape, MlirType elementType)
Same as "mlirVectorTypeGet" but returns a nullptr wrapping MlirType on illegal arguments,...
MLIR_CAPI_EXPORTED MlirType mlirNoneTypeGet(MlirContext ctx)
Creates a None type in the given context.
MLIR_CAPI_EXPORTED MlirType mlirComplexTypeGet(MlirType elementType)
Creates a complex type with the given element type in the same context as the element type.
MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueTypeGetDialectNamespace(MlirType type)
Returns the namespace of the dialect with which the given opaque type is associated.
MLIR_CAPI_EXPORTED MlirTypeID mlirTupleTypeGetTypeID(void)
Returns the typeID of an Tuple type.
MLIR_CAPI_EXPORTED bool mlirShapedTypeHasStaticShape(MlirType type)
Checks whether the given shaped type has a static shape.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E4M3FN(MlirType type)
Checks whether the given type is an f8E4M3FN type.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat8E4M3FNTypeGetTypeID(void)
Returns the typeID of an Float8E4M3FN type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAOpaque(MlirType type)
Checks whether the given type is an opaque type.
MLIR_CAPI_EXPORTED MlirType mlirBF16TypeGet(MlirContext ctx)
Creates a bf16 type in the given context.
MLIR_CAPI_EXPORTED MlirType mlirF32TypeGet(MlirContext ctx)
Creates an f32 type in the given context.
MLIR_CAPI_EXPORTED bool mlirShapedTypeHasRank(MlirType type)
Checks whether the given shaped type is ranked.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirMemRefTypeGetStridesAndOffset(MlirType type, int64_t *strides, int64_t *offset)
Returns the strides of the MemRef if the layout map is in strided form.
MLIR_CAPI_EXPORTED bool mlirTypeIsAShaped(MlirType type)
Checks whether the given type is a Shaped type.
MLIR_CAPI_EXPORTED intptr_t mlirTupleTypeGetNumTypes(MlirType type)
Returns the number of types contained in a tuple.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat(MlirType type)
Checks whether the given type is a floating-point type.
MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeUnsignedGet(MlirContext ctx, unsigned bitwidth)
Creates an unsigned integer type of the given bitwidth in the context.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E4M3FNUZ(MlirType type)
Checks whether the given type is an f8E4M3FNUZ type.
MLIR_CAPI_EXPORTED MlirTypeID mlirBFloat16TypeGetTypeID(void)
Returns the typeID of an BFloat16 type.
MLIR_CAPI_EXPORTED MlirType mlirFloat8E4M3FNTypeGet(MlirContext ctx)
Creates an f8E4M3FN type in the given context.
MLIR_CAPI_EXPORTED bool mlirTypeIsAF32(MlirType type)
Checks whether the given type is an f32 type.
MLIR_CAPI_EXPORTED MlirTypeID mlirRankedTensorTypeGetTypeID(void)
Returns the typeID of an RankedTensor type.
MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGet(MlirContext ctx, intptr_t numInputs, MlirType const *inputs, intptr_t numResults, MlirType const *results)
Creates a function type, mapping a list of input types to result types.
MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicStrideOrOffset(int64_t val)
Checks whether the given value is used as a placeholder for dynamic strides and offsets in shaped typ...
MLIR_CAPI_EXPORTED MlirType mlirTupleTypeGetType(MlirType type, intptr_t pos)
Returns the pos-th type in the tuple type.
MLIR_CAPI_EXPORTED bool mlirTypeIsARankedTensor(MlirType type)
Checks whether the given type is a ranked tensor type.
MLIR_CAPI_EXPORTED bool mlirVectorTypeIsDimScalable(MlirType type, intptr_t dim)
Checks whether the "dim"-th dimension of the given vector is scalable.
MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicDim(MlirType type, intptr_t dim)
Checks wither the dim-th dimension of the given shaped type is dynamic.
MLIR_CAPI_EXPORTED bool mlirTypeIsATF32(MlirType type)
Checks whether the given type is an TF32 type.
MLIR_CAPI_EXPORTED MlirTypeID mlirComplexTypeGetTypeID(void)
Returns the typeID of an Complex type.
MLIR_CAPI_EXPORTED MlirTypeID mlirIntegerTypeGetTypeID(void)
Returns the typeID of an Integer type.
MLIR_CAPI_EXPORTED MlirTypeID mlirOpaqueTypeGetTypeID(void)
Returns the typeID of an Opaque type.
MLIR_CAPI_EXPORTED MlirTypeID mlirIndexTypeGetTypeID(void)
Returns the typeID of an Index type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAComplex(MlirType type)
Checks whether the given type is a Complex type.
MLIR_CAPI_EXPORTED MlirTypeID mlirUnrankedMemRefTypeGetTypeID(void)
Returns the typeID of an UnrankedMemRef type.
MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGetChecked(MlirLocation loc, MlirType elementType, intptr_t rank, const int64_t *shape, MlirAttribute layout, MlirAttribute memorySpace)
Same as "mlirMemRefTypeGet" but returns a nullptr-wrapping MlirType o illegal arguments,...
MLIR_CAPI_EXPORTED bool mlirTypeIsABF16(MlirType type)
Checks whether the given type is a bf16 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAIndex(MlirType type)
Checks whether the given type is an index type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E4M3B11FNUZ(MlirType type)
Checks whether the given type is an f8E4M3B11FNUZ type.
MLIR_CAPI_EXPORTED MlirType mlirOpaqueTypeGet(MlirContext ctx, MlirStringRef dialectNamespace, MlirStringRef typeData)
Creates an opaque type in the given context associated with the dialect identified by its namespace.
MLIR_CAPI_EXPORTED intptr_t mlirFunctionTypeGetNumResults(MlirType type)
Returns the number of result types.
MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicSize(int64_t size)
Checks whether the given value is used as a placeholder for dynamic sizes in shaped types.
MLIR_CAPI_EXPORTED bool mlirTypeIsAUnrankedMemRef(MlirType type)
Checks whether the given type is an UnrankedMemRef type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E5M2FNUZ(MlirType type)
Checks whether the given type is an f8E5M2FNUZ type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAUnrankedTensor(MlirType type)
Checks whether the given type is an unranked tensor type.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat32TypeGetTypeID(void)
Returns the typeID of an Float32 type.
MLIR_CAPI_EXPORTED MlirType mlirUnrankedMemRefTypeGetChecked(MlirLocation loc, MlirType elementType, MlirAttribute memorySpace)
Same as "mlirUnrankedMemRefTypeGet" but returns a nullptr wrapping MlirType on illegal arguments,...
MLIR_CAPI_EXPORTED bool mlirVectorTypeIsScalable(MlirType type)
Checks whether the given vector type is scalable, i.e., has at least one scalable dimension.
MLIR_CAPI_EXPORTED MlirType mlirComplexTypeGetElementType(MlirType type)
Returns the element type of the given complex type.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnrankedMemrefGetMemorySpace(MlirType type)
Returns the memory spcae of the given Unranked MemRef type.
MLIR_CAPI_EXPORTED bool mlirTypeIsANone(MlirType type)
Checks whether the given type is a None type.
MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDynamicStrideOrOffset(void)
Returns the value indicating a dynamic stride or offset in a shaped type.
MLIR_CAPI_EXPORTED MlirTypeID mlirFunctionTypeGetTypeID(void)
Returns the typeID of an Function type.
MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDynamicSize(void)
Returns the value indicating a dynamic size in a shaped type.
MLIR_CAPI_EXPORTED MlirAttribute mlirMemRefTypeGetLayout(MlirType type)
Returns the layout of the given MemRef type.
MLIR_CAPI_EXPORTED MlirType mlirFloat8E4M3B11FNUZTypeGet(MlirContext ctx)
Creates an f8E4M3B11FNUZ type in the given context.
MLIR_CAPI_EXPORTED MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements, MlirType const *elements)
Creates a tuple type that consists of the given list of elemental types.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat8E4M3B11FNUZTypeGetTypeID(void)
Returns the typeID of an Float8E4M3B11FNUZ type.
MLIR_CAPI_EXPORTED MlirType mlirFloat8E4M3FNUZTypeGet(MlirContext ctx)
Creates an f8E4M3FNUZ type in the given context.
MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGetResult(MlirType type, intptr_t pos)
Returns the pos-th result type.
MLIR_CAPI_EXPORTED MlirType mlirTF32TypeGet(MlirContext ctx)
Creates a TF32 type in the given context.
static bool mlirAttributeIsNull(MlirAttribute attr)
Checks whether an attribute is null.
static bool mlirTypeIsNull(MlirType type)
Checks whether a type is null.
static MlirStringRef mlirStringRefCreate(const char *str, size_t length)
Constructs a string reference from the pointer and length.
static bool mlirLogicalResultIsFailure(MlirLogicalResult res)
Checks if the given logical result represents a failure.
void populateIRTypes(pybind11::module &m)
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
A pointer to a sized fragment of a string, not necessarily null-terminated.
const char * data
Pointer to the first symbol.
size_t length
Length of the fragment.
Custom exception that allows access to error diagnostic information.
RAII object that captures any error diagnostics emitted to the provided context.