MLIR  16.0.0git
BuiltinTypes.cpp
Go to the documentation of this file.
1 //===- BuiltinTypes.cpp - C Interface to MLIR Builtin Types ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir-c/BuiltinTypes.h"
10 #include "mlir-c/AffineMap.h"
11 #include "mlir-c/IR.h"
12 #include "mlir/CAPI/AffineMap.h"
13 #include "mlir/CAPI/IR.h"
14 #include "mlir/CAPI/Support.h"
15 #include "mlir/IR/AffineMap.h"
16 #include "mlir/IR/BuiltinTypes.h"
17 #include "mlir/IR/Types.h"
18 
19 using namespace mlir;
20 
21 //===----------------------------------------------------------------------===//
22 // Integer types.
23 //===----------------------------------------------------------------------===//
24 
25 bool mlirTypeIsAInteger(MlirType type) {
26  return unwrap(type).isa<IntegerType>();
27 }
28 
29 MlirType mlirIntegerTypeGet(MlirContext ctx, unsigned bitwidth) {
30  return wrap(IntegerType::get(unwrap(ctx), bitwidth));
31 }
32 
33 MlirType mlirIntegerTypeSignedGet(MlirContext ctx, unsigned bitwidth) {
34  return wrap(IntegerType::get(unwrap(ctx), bitwidth, IntegerType::Signed));
35 }
36 
37 MlirType mlirIntegerTypeUnsignedGet(MlirContext ctx, unsigned bitwidth) {
38  return wrap(IntegerType::get(unwrap(ctx), bitwidth, IntegerType::Unsigned));
39 }
40 
41 unsigned mlirIntegerTypeGetWidth(MlirType type) {
42  return unwrap(type).cast<IntegerType>().getWidth();
43 }
44 
45 bool mlirIntegerTypeIsSignless(MlirType type) {
46  return unwrap(type).cast<IntegerType>().isSignless();
47 }
48 
49 bool mlirIntegerTypeIsSigned(MlirType type) {
50  return unwrap(type).cast<IntegerType>().isSigned();
51 }
52 
53 bool mlirIntegerTypeIsUnsigned(MlirType type) {
54  return unwrap(type).cast<IntegerType>().isUnsigned();
55 }
56 
57 //===----------------------------------------------------------------------===//
58 // Index type.
59 //===----------------------------------------------------------------------===//
60 
61 bool mlirTypeIsAIndex(MlirType type) { return unwrap(type).isa<IndexType>(); }
62 
63 MlirType mlirIndexTypeGet(MlirContext ctx) {
64  return wrap(IndexType::get(unwrap(ctx)));
65 }
66 
67 //===----------------------------------------------------------------------===//
68 // Floating-point types.
69 //===----------------------------------------------------------------------===//
70 
71 bool mlirTypeIsABF16(MlirType type) { return unwrap(type).isBF16(); }
72 
73 MlirType mlirBF16TypeGet(MlirContext ctx) {
74  return wrap(FloatType::getBF16(unwrap(ctx)));
75 }
76 
77 bool mlirTypeIsAF16(MlirType type) { return unwrap(type).isF16(); }
78 
79 MlirType mlirF16TypeGet(MlirContext ctx) {
80  return wrap(FloatType::getF16(unwrap(ctx)));
81 }
82 
83 bool mlirTypeIsAF32(MlirType type) { return unwrap(type).isF32(); }
84 
85 MlirType mlirF32TypeGet(MlirContext ctx) {
86  return wrap(FloatType::getF32(unwrap(ctx)));
87 }
88 
89 bool mlirTypeIsAF64(MlirType type) { return unwrap(type).isF64(); }
90 
91 MlirType mlirF64TypeGet(MlirContext ctx) {
92  return wrap(FloatType::getF64(unwrap(ctx)));
93 }
94 
95 //===----------------------------------------------------------------------===//
96 // None type.
97 //===----------------------------------------------------------------------===//
98 
99 bool mlirTypeIsANone(MlirType type) { return unwrap(type).isa<NoneType>(); }
100 
101 MlirType mlirNoneTypeGet(MlirContext ctx) {
102  return wrap(NoneType::get(unwrap(ctx)));
103 }
104 
105 //===----------------------------------------------------------------------===//
106 // Complex type.
107 //===----------------------------------------------------------------------===//
108 
109 bool mlirTypeIsAComplex(MlirType type) {
110  return unwrap(type).isa<ComplexType>();
111 }
112 
113 MlirType mlirComplexTypeGet(MlirType elementType) {
114  return wrap(ComplexType::get(unwrap(elementType)));
115 }
116 
117 MlirType mlirComplexTypeGetElementType(MlirType type) {
118  return wrap(unwrap(type).cast<ComplexType>().getElementType());
119 }
120 
121 //===----------------------------------------------------------------------===//
122 // Shaped type.
123 //===----------------------------------------------------------------------===//
124 
125 bool mlirTypeIsAShaped(MlirType type) { return unwrap(type).isa<ShapedType>(); }
126 
127 MlirType mlirShapedTypeGetElementType(MlirType type) {
128  return wrap(unwrap(type).cast<ShapedType>().getElementType());
129 }
130 
131 bool mlirShapedTypeHasRank(MlirType type) {
132  return unwrap(type).cast<ShapedType>().hasRank();
133 }
134 
135 int64_t mlirShapedTypeGetRank(MlirType type) {
136  return unwrap(type).cast<ShapedType>().getRank();
137 }
138 
139 bool mlirShapedTypeHasStaticShape(MlirType type) {
140  return unwrap(type).cast<ShapedType>().hasStaticShape();
141 }
142 
143 bool mlirShapedTypeIsDynamicDim(MlirType type, intptr_t dim) {
144  return unwrap(type).cast<ShapedType>().isDynamicDim(
145  static_cast<unsigned>(dim));
146 }
147 
148 int64_t mlirShapedTypeGetDimSize(MlirType type, intptr_t dim) {
149  return unwrap(type).cast<ShapedType>().getDimSize(static_cast<unsigned>(dim));
150 }
151 
152 int64_t mlirShapedTypeGetDynamicSize() { return ShapedType::kDynamicSize; }
153 
154 bool mlirShapedTypeIsDynamicSize(int64_t size) {
155  return ShapedType::isDynamic(size);
156 }
157 
159  return ShapedType::isDynamicStrideOrOffset(val);
160 }
161 
163  return ShapedType::kDynamicStrideOrOffset;
164 }
165 
166 //===----------------------------------------------------------------------===//
167 // Vector type.
168 //===----------------------------------------------------------------------===//
169 
170 bool mlirTypeIsAVector(MlirType type) { return unwrap(type).isa<VectorType>(); }
171 
172 MlirType mlirVectorTypeGet(intptr_t rank, const int64_t *shape,
173  MlirType elementType) {
174  return wrap(
175  VectorType::get(llvm::makeArrayRef(shape, static_cast<size_t>(rank)),
176  unwrap(elementType)));
177 }
178 
179 MlirType mlirVectorTypeGetChecked(MlirLocation loc, intptr_t rank,
180  const int64_t *shape, MlirType elementType) {
181  return wrap(VectorType::getChecked(
182  unwrap(loc), llvm::makeArrayRef(shape, static_cast<size_t>(rank)),
183  unwrap(elementType)));
184 }
185 
186 //===----------------------------------------------------------------------===//
187 // Ranked / Unranked tensor type.
188 //===----------------------------------------------------------------------===//
189 
190 bool mlirTypeIsATensor(MlirType type) { return unwrap(type).isa<TensorType>(); }
191 
192 bool mlirTypeIsARankedTensor(MlirType type) {
193  return unwrap(type).isa<RankedTensorType>();
194 }
195 
196 bool mlirTypeIsAUnrankedTensor(MlirType type) {
197  return unwrap(type).isa<UnrankedTensorType>();
198 }
199 
200 MlirType mlirRankedTensorTypeGet(intptr_t rank, const int64_t *shape,
201  MlirType elementType, MlirAttribute encoding) {
202  return wrap(RankedTensorType::get(
203  llvm::makeArrayRef(shape, static_cast<size_t>(rank)), unwrap(elementType),
204  unwrap(encoding)));
205 }
206 
207 MlirType mlirRankedTensorTypeGetChecked(MlirLocation loc, intptr_t rank,
208  const int64_t *shape,
209  MlirType elementType,
210  MlirAttribute encoding) {
211  return wrap(RankedTensorType::getChecked(
212  unwrap(loc), llvm::makeArrayRef(shape, static_cast<size_t>(rank)),
213  unwrap(elementType), unwrap(encoding)));
214 }
215 
216 MlirAttribute mlirRankedTensorTypeGetEncoding(MlirType type) {
217  return wrap(unwrap(type).cast<RankedTensorType>().getEncoding());
218 }
219 
220 MlirType mlirUnrankedTensorTypeGet(MlirType elementType) {
221  return wrap(UnrankedTensorType::get(unwrap(elementType)));
222 }
223 
224 MlirType mlirUnrankedTensorTypeGetChecked(MlirLocation loc,
225  MlirType elementType) {
226  return wrap(UnrankedTensorType::getChecked(unwrap(loc), unwrap(elementType)));
227 }
228 
229 //===----------------------------------------------------------------------===//
230 // Ranked / Unranked MemRef type.
231 //===----------------------------------------------------------------------===//
232 
233 bool mlirTypeIsAMemRef(MlirType type) { return unwrap(type).isa<MemRefType>(); }
234 
235 MlirType mlirMemRefTypeGet(MlirType elementType, intptr_t rank,
236  const int64_t *shape, MlirAttribute layout,
237  MlirAttribute memorySpace) {
238  return wrap(MemRefType::get(
239  llvm::makeArrayRef(shape, static_cast<size_t>(rank)), unwrap(elementType),
240  mlirAttributeIsNull(layout)
241  ? MemRefLayoutAttrInterface()
242  : unwrap(layout).cast<MemRefLayoutAttrInterface>(),
243  unwrap(memorySpace)));
244 }
245 
246 MlirType mlirMemRefTypeGetChecked(MlirLocation loc, MlirType elementType,
247  intptr_t rank, const int64_t *shape,
248  MlirAttribute layout,
249  MlirAttribute memorySpace) {
250  return wrap(MemRefType::getChecked(
251  unwrap(loc), llvm::makeArrayRef(shape, static_cast<size_t>(rank)),
252  unwrap(elementType),
253  mlirAttributeIsNull(layout)
254  ? MemRefLayoutAttrInterface()
255  : unwrap(layout).cast<MemRefLayoutAttrInterface>(),
256  unwrap(memorySpace)));
257 }
258 
259 MlirType mlirMemRefTypeContiguousGet(MlirType elementType, intptr_t rank,
260  const int64_t *shape,
261  MlirAttribute memorySpace) {
262  return wrap(MemRefType::get(
263  llvm::makeArrayRef(shape, static_cast<size_t>(rank)), unwrap(elementType),
264  MemRefLayoutAttrInterface(), unwrap(memorySpace)));
265 }
266 
267 MlirType mlirMemRefTypeContiguousGetChecked(MlirLocation loc,
268  MlirType elementType, intptr_t rank,
269  const int64_t *shape,
270  MlirAttribute memorySpace) {
271  return wrap(MemRefType::getChecked(
272  unwrap(loc), llvm::makeArrayRef(shape, static_cast<size_t>(rank)),
273  unwrap(elementType), MemRefLayoutAttrInterface(), unwrap(memorySpace)));
274 }
275 
276 MlirAttribute mlirMemRefTypeGetLayout(MlirType type) {
277  return wrap(unwrap(type).cast<MemRefType>().getLayout());
278 }
279 
280 MlirAffineMap mlirMemRefTypeGetAffineMap(MlirType type) {
281  return wrap(unwrap(type).cast<MemRefType>().getLayout().getAffineMap());
282 }
283 
284 MlirAttribute mlirMemRefTypeGetMemorySpace(MlirType type) {
285  return wrap(unwrap(type).cast<MemRefType>().getMemorySpace());
286 }
287 
288 bool mlirTypeIsAUnrankedMemRef(MlirType type) {
289  return unwrap(type).isa<UnrankedMemRefType>();
290 }
291 
292 MlirType mlirUnrankedMemRefTypeGet(MlirType elementType,
293  MlirAttribute memorySpace) {
294  return wrap(
295  UnrankedMemRefType::get(unwrap(elementType), unwrap(memorySpace)));
296 }
297 
298 MlirType mlirUnrankedMemRefTypeGetChecked(MlirLocation loc,
299  MlirType elementType,
300  MlirAttribute memorySpace) {
301  return wrap(UnrankedMemRefType::getChecked(unwrap(loc), unwrap(elementType),
302  unwrap(memorySpace)));
303 }
304 
305 MlirAttribute mlirUnrankedMemrefGetMemorySpace(MlirType type) {
306  return wrap(unwrap(type).cast<UnrankedMemRefType>().getMemorySpace());
307 }
308 
309 //===----------------------------------------------------------------------===//
310 // Tuple type.
311 //===----------------------------------------------------------------------===//
312 
313 bool mlirTypeIsATuple(MlirType type) { return unwrap(type).isa<TupleType>(); }
314 
315 MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements,
316  MlirType const *elements) {
317  SmallVector<Type, 4> types;
318  ArrayRef<Type> typeRef = unwrapList(numElements, elements, types);
319  return wrap(TupleType::get(unwrap(ctx), typeRef));
320 }
321 
322 intptr_t mlirTupleTypeGetNumTypes(MlirType type) {
323  return unwrap(type).cast<TupleType>().size();
324 }
325 
326 MlirType mlirTupleTypeGetType(MlirType type, intptr_t pos) {
327  return wrap(unwrap(type).cast<TupleType>().getType(static_cast<size_t>(pos)));
328 }
329 
330 //===----------------------------------------------------------------------===//
331 // Function type.
332 //===----------------------------------------------------------------------===//
333 
334 bool mlirTypeIsAFunction(MlirType type) {
335  return unwrap(type).isa<FunctionType>();
336 }
337 
338 MlirType mlirFunctionTypeGet(MlirContext ctx, intptr_t numInputs,
339  MlirType const *inputs, intptr_t numResults,
340  MlirType const *results) {
341  SmallVector<Type, 4> inputsList;
342  SmallVector<Type, 4> resultsList;
343  (void)unwrapList(numInputs, inputs, inputsList);
344  (void)unwrapList(numResults, results, resultsList);
345  return wrap(FunctionType::get(unwrap(ctx), inputsList, resultsList));
346 }
347 
348 intptr_t mlirFunctionTypeGetNumInputs(MlirType type) {
349  return unwrap(type).cast<FunctionType>().getNumInputs();
350 }
351 
352 intptr_t mlirFunctionTypeGetNumResults(MlirType type) {
353  return unwrap(type).cast<FunctionType>().getNumResults();
354 }
355 
356 MlirType mlirFunctionTypeGetInput(MlirType type, intptr_t pos) {
357  assert(pos >= 0 && "pos in array must be positive");
358  return wrap(
359  unwrap(type).cast<FunctionType>().getInput(static_cast<unsigned>(pos)));
360 }
361 
362 MlirType mlirFunctionTypeGetResult(MlirType type, intptr_t pos) {
363  assert(pos >= 0 && "pos in array must be positive");
364  return wrap(
365  unwrap(type).cast<FunctionType>().getResult(static_cast<unsigned>(pos)));
366 }
367 
368 //===----------------------------------------------------------------------===//
369 // Opaque type.
370 //===----------------------------------------------------------------------===//
371 
372 bool mlirTypeIsAOpaque(MlirType type) { return unwrap(type).isa<OpaqueType>(); }
373 
374 MlirType mlirOpaqueTypeGet(MlirContext ctx, MlirStringRef dialectNamespace,
375  MlirStringRef typeData) {
376  return wrap(
377  OpaqueType::get(StringAttr::get(unwrap(ctx), unwrap(dialectNamespace)),
378  unwrap(typeData)));
379 }
380 
382  return wrap(unwrap(type).cast<OpaqueType>().getDialectNamespace().strref());
383 }
384 
386  return wrap(unwrap(type).cast<OpaqueType>().getTypeData());
387 }
Include the generated interface declarations.
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, emitting appropriate diagnostics.
bool mlirTypeIsAUnrankedMemRef(MlirType type)
Checks whether the given type is an UnrankedMemRef type.
int64_t mlirShapedTypeGetDimSize(MlirType type, intptr_t dim)
Returns the dim-th dimension of the given ranked shaped type.
MlirStringRef mlirOpaqueTypeGetDialectNamespace(MlirType type)
Returns the namespace of the dialect with which the given opaque type is associated.
MlirType mlirMemRefTypeContiguousGetChecked(MlirLocation loc, MlirType elementType, intptr_t rank, const int64_t *shape, MlirAttribute memorySpace)
Same as "mlirMemRefTypeContiguousGet" but returns a nullptr wrapping MlirType on illegal arguments...
bool mlirShapedTypeIsDynamicDim(MlirType type, intptr_t dim)
Checks wither the dim-th dimension of the given shaped type is dynamic.
bool mlirTypeIsAVector(MlirType type)
Checks whether the given type is a Vector type.
MlirType mlirIntegerTypeSignedGet(MlirContext ctx, unsigned bitwidth)
Creates a signed integer type of the given bitwidth in the context.
static bool mlirAttributeIsNull(MlirAttribute attr)
Checks whether an attribute is null.
Definition: IR.h:771
bool mlirShapedTypeHasRank(MlirType type)
Checks whether the given shaped type is ranked.
static Type getElementType(Type type, ArrayRef< int32_t > indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
Walks the given type hierarchy with the given indices, potentially down to component granularity...
Definition: SPIRVOps.cpp:685
static FloatType getF32(MLIRContext *ctx)
Definition: BuiltinTypes.h:391
bool mlirTypeIsAMemRef(MlirType type)
Checks whether the given type is a MemRef type.
intptr_t mlirFunctionTypeGetNumResults(MlirType type)
Returns the number of result types.
MlirAttribute mlirRankedTensorTypeGetEncoding(MlirType type)
Gets the &#39;encoding&#39; attribute from the ranked tensor type, returning a null attribute if none...
bool mlirTypeIsANone(MlirType type)
Checks whether the given type is a None type.
static FloatType getBF16(MLIRContext *ctx)
Definition: BuiltinTypes.h:383
bool mlirTypeIsAUnrankedTensor(MlirType type)
Checks whether the given type is an unranked tensor type.
MlirType mlirComplexTypeGetElementType(MlirType type)
Returns the element type of the given complex type.
MlirType mlirFunctionTypeGetResult(MlirType type, intptr_t pos)
Returns the pos-th result type.
MlirType mlirMemRefTypeContiguousGet(MlirType elementType, intptr_t rank, const int64_t *shape, MlirAttribute memorySpace)
Creates a MemRef type with the given rank, shape, memory space and element type in the same context a...
bool mlirShapedTypeIsDynamicStrideOrOffset(int64_t val)
Checks whether the given value is used as a placeholder for dynamic strides and offsets in shaped typ...
MlirAttribute mlirUnrankedMemrefGetMemorySpace(MlirType type)
Returns the memory spcae of the given Unranked MemRef type.
MlirType mlirUnrankedTensorTypeGet(MlirType elementType)
Creates an unranked tensor type with the given element type in the same context as the element type...
MlirType mlirF32TypeGet(MlirContext ctx)
Creates an f32 type in the given context.
MlirAttribute mlirMemRefTypeGetLayout(MlirType type)
Returns the layout of the given MemRef type.
MlirType mlirMemRefTypeGet(MlirType elementType, intptr_t rank, const int64_t *shape, MlirAttribute layout, MlirAttribute memorySpace)
Creates a MemRef type with the given rank and shape, a potentially empty list of affine layout maps...
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, emitting appropriate diagnostics.
int64_t mlirShapedTypeGetDynamicSize()
Returns the value indicating a dynamic size in a shaped type.
intptr_t mlirTupleTypeGetNumTypes(MlirType type)
Returns the number of types contained in a tuple.
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
Definition: Wrap.h:40
intptr_t mlirFunctionTypeGetNumInputs(MlirType type)
Returns the number of input types.
MlirAffineMap mlirMemRefTypeGetAffineMap(MlirType type)
Returns the affine map of the given MemRef type.
unsigned mlirIntegerTypeGetWidth(MlirType type)
Returns the bitwidth of an integer type.
MlirStringRef mlirOpaqueTypeGetData(MlirType type)
Returns the raw data as a string reference.
MlirType mlirIndexTypeGet(MlirContext ctx)
Creates an index type in the given context.
Tensor types represent multi-dimensional arrays, and have two variants: RankedTensorType and Unranked...
Definition: BuiltinTypes.h:76
bool mlirTypeIsATuple(MlirType type)
Checks whether the given type is a tuple type.
bool mlirTypeIsABF16(MlirType type)
Checks whether the given type is a bf16 type.
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...
bool mlirIntegerTypeIsSignless(MlirType type)
Checks whether the given integer type is signless.
bool mlirShapedTypeHasStaticShape(MlirType type)
Checks whether the given shaped type has a static shape.
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition: Support.h:71
MlirType mlirIntegerTypeUnsignedGet(MlirContext ctx, unsigned bitwidth)
Creates an unsigned integer type of the given bitwidth in the context.
MlirType mlirNoneTypeGet(MlirContext ctx)
Creates a None type in the given context.
MlirType mlirTupleTypeGetType(MlirType type, intptr_t pos)
Returns the pos-th type in the tuple type.
bool mlirIntegerTypeIsSigned(MlirType type)
Checks whether the given integer type is signed.
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
Definition: Diagnostics.h:24
bool mlirTypeIsAOpaque(MlirType type)
Checks whether the given type is an opaque type.
bool mlirTypeIsAF32(MlirType type)
Checks whether the given type is an f32 type.
MlirType mlirF64TypeGet(MlirContext ctx)
Creates a f64 type in the given context.
MlirType mlirIntegerTypeGet(MlirContext ctx, unsigned bitwidth)
Creates a signless integer type of the given bitwidth in the context.
static FloatType getF16(MLIRContext *ctx)
Definition: BuiltinTypes.h:387
bool mlirTypeIsAComplex(MlirType type)
Checks whether the given type is a Complex type.
bool mlirTypeIsATensor(MlirType type)
Checks whether the given type is a Tensor type.
bool mlirShapedTypeIsDynamicSize(int64_t size)
Checks whether the given value is used as a placeholder for dynamic sizes in shaped types...
bool mlirIntegerTypeIsUnsigned(MlirType type)
Checks whether the given integer type is unsigned.
bool mlirTypeIsAShaped(MlirType type)
Checks whether the given type is a Shaped type.
MlirAttribute mlirMemRefTypeGetMemorySpace(MlirType type)
Returns the memory space of the given MemRef type.
bool mlirTypeIsARankedTensor(MlirType type)
Checks whether the given type is a ranked tensor type.
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.
bool mlirTypeIsAF64(MlirType type)
Checks whether the given type is an f64 type.
MlirType mlirUnrankedMemRefTypeGet(MlirType elementType, MlirAttribute memorySpace)
Creates an Unranked MemRef type with the given element type and in the given memory space...
MlirType mlirUnrankedMemRefTypeGetChecked(MlirLocation loc, MlirType elementType, MlirAttribute memorySpace)
Same as "mlirUnrankedMemRefTypeGet" but returns a nullptr wrapping MlirType on illegal arguments...
bool mlirTypeIsAF16(MlirType type)
Checks whether the given type is an f16 type.
MlirType mlirBF16TypeGet(MlirContext ctx)
Creates a bf16 type in the given context.
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
Definition: Diagnostics.h:19
MlirType mlirUnrankedTensorTypeGetChecked(MlirLocation loc, MlirType elementType)
Same as "mlirUnrankedTensorTypeGet" but returns a nullptr wrapping MlirType on illegal arguments...
MlirType mlirShapedTypeGetElementType(MlirType type)
Returns the element type of the shaped type.
bool mlirTypeIsAIndex(MlirType type)
Checks whether the given type is an index type.
MlirType mlirComplexTypeGet(MlirType elementType)
Creates a complex type with the given element type in the same context as the element type...
bool mlirTypeIsAFunction(MlirType type)
Checks whether the given type is a function type.
MlirType mlirVectorTypeGet(intptr_t rank, const int64_t *shape, MlirType elementType)
Creates a vector type of the shape identified by its rank and dimensions, with the given element type...
MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements, MlirType const *elements)
Creates a tuple type that consists of the given list of elemental types.
int64_t mlirShapedTypeGetRank(MlirType type)
Returns the rank of the given ranked shaped type.
bool mlirTypeIsAInteger(MlirType type)
Checks whether the given type is an integer type.
static FloatType getF64(MLIRContext *ctx)
Definition: BuiltinTypes.h:395
int64_t mlirShapedTypeGetDynamicStrideOrOffset()
Returns the value indicating a dynamic stride or offset in a shaped type.
MlirType mlirOpaqueTypeGet(MlirContext ctx, MlirStringRef dialectNamespace, MlirStringRef typeData)
Creates an opaque type in the given context associated with the dialect identified by its namespace...
MlirType mlirFunctionTypeGetInput(MlirType type, intptr_t pos)
Returns the pos-th input type.
MlirType mlirRankedTensorTypeGet(intptr_t rank, const int64_t *shape, MlirType elementType, MlirAttribute encoding)
Creates a tensor type of a fixed rank with the given shape, element type, and optional encoding in th...
MlirType mlirF16TypeGet(MlirContext ctx)
Creates an f16 type in the given context.