MLIR 22.0.0git
BuiltinTypes.h
Go to the documentation of this file.
1//===-- mlir-c/BuiltinTypes.h - C API for MLIR Builtin types ------*- C -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM
4// Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef MLIR_C_BUILTINTYPES_H
11#define MLIR_C_BUILTINTYPES_H
12
13#include "mlir-c/AffineMap.h"
14#include "mlir-c/IR.h"
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21//===----------------------------------------------------------------------===//
22// Integer types.
23//===----------------------------------------------------------------------===//
24
25/// Returns the typeID of an Integer type.
27
28/// Checks whether the given type is an integer type.
29MLIR_CAPI_EXPORTED bool mlirTypeIsAInteger(MlirType type);
30
31/// Creates a signless integer type of the given bitwidth in the context. The
32/// type is owned by the context.
33MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeGet(MlirContext ctx,
34 unsigned bitwidth);
35
36/// Creates a signed integer type of the given bitwidth in the context. The type
37/// is owned by the context.
38MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeSignedGet(MlirContext ctx,
39 unsigned bitwidth);
40
41/// Creates an unsigned integer type of the given bitwidth in the context. The
42/// type is owned by the context.
43MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeUnsignedGet(MlirContext ctx,
44 unsigned bitwidth);
45
46/// Returns the bitwidth of an integer type.
47MLIR_CAPI_EXPORTED unsigned mlirIntegerTypeGetWidth(MlirType type);
48
49/// Checks whether the given integer type is signless.
51
52/// Checks whether the given integer type is signed.
54
55/// Checks whether the given integer type is unsigned.
57
58//===----------------------------------------------------------------------===//
59// Index type.
60//===----------------------------------------------------------------------===//
61
62/// Returns the typeID of an Index type.
64
65/// Checks whether the given type is an index type.
66MLIR_CAPI_EXPORTED bool mlirTypeIsAIndex(MlirType type);
67
68/// Creates an index type in the given context. The type is owned by the
69/// context.
70MLIR_CAPI_EXPORTED MlirType mlirIndexTypeGet(MlirContext ctx);
71
72//===----------------------------------------------------------------------===//
73// Floating-point types.
74//===----------------------------------------------------------------------===//
75
76/// Checks whether the given type is a floating-point type.
77MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat(MlirType type);
78
79/// Returns the bitwidth of a floating-point type.
80MLIR_CAPI_EXPORTED unsigned mlirFloatTypeGetWidth(MlirType type);
81
82/// Returns the typeID of an Float4E2M1FN type.
84
85/// Checks whether the given type is an f4E2M1FN type.
87
88/// Creates an f4E2M1FN type in the given context. The type is owned by the
89/// context.
90MLIR_CAPI_EXPORTED MlirType mlirFloat4E2M1FNTypeGet(MlirContext ctx);
91
92/// Returns the typeID of an Float6E2M3FN type.
94
95/// Checks whether the given type is an f6E2M3FN type.
97
98/// Creates an f6E2M3FN type in the given context. The type is owned by the
99/// context.
100MLIR_CAPI_EXPORTED MlirType mlirFloat6E2M3FNTypeGet(MlirContext ctx);
101
102/// Returns the typeID of an Float6E3M2FN type.
104
105/// Checks whether the given type is an f6E3M2FN type.
107
108/// Creates an f6E3M2FN type in the given context. The type is owned by the
109/// context.
110MLIR_CAPI_EXPORTED MlirType mlirFloat6E3M2FNTypeGet(MlirContext ctx);
111
112/// Returns the typeID of an Float8E5M2 type.
114
115/// Checks whether the given type is an f8E5M2 type.
116MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E5M2(MlirType type);
117
118/// Creates an f8E5M2 type in the given context. The type is owned by the
119/// context.
120MLIR_CAPI_EXPORTED MlirType mlirFloat8E5M2TypeGet(MlirContext ctx);
121
122/// Returns the typeID of an Float8E4M3 type.
124
125/// Checks whether the given type is an f8E4M3 type.
126MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E4M3(MlirType type);
127
128/// Creates an f8E4M3 type in the given context. The type is owned by the
129/// context.
130MLIR_CAPI_EXPORTED MlirType mlirFloat8E4M3TypeGet(MlirContext ctx);
131
132/// Returns the typeID of an Float8E4M3FN type.
134
135/// Checks whether the given type is an f8E4M3FN type.
137
138/// Creates an f8E4M3FN type in the given context. The type is owned by the
139/// context.
140MLIR_CAPI_EXPORTED MlirType mlirFloat8E4M3FNTypeGet(MlirContext ctx);
141
142/// Returns the typeID of an Float8E5M2FNUZ type.
144
145/// Checks whether the given type is an f8E5M2FNUZ type.
147
148/// Creates an f8E5M2FNUZ type in the given context. The type is owned by the
149/// context.
150MLIR_CAPI_EXPORTED MlirType mlirFloat8E5M2FNUZTypeGet(MlirContext ctx);
151
152/// Returns the typeID of an Float8E4M3FNUZ type.
154
155/// Checks whether the given type is an f8E4M3FNUZ type.
157
158/// Creates an f8E4M3FNUZ type in the given context. The type is owned by the
159/// context.
160MLIR_CAPI_EXPORTED MlirType mlirFloat8E4M3FNUZTypeGet(MlirContext ctx);
161
162/// Returns the typeID of an Float8E4M3B11FNUZ type.
164
165/// Checks whether the given type is an f8E4M3B11FNUZ type.
167
168/// Creates an f8E4M3B11FNUZ type in the given context. The type is owned by the
169/// context.
170MLIR_CAPI_EXPORTED MlirType mlirFloat8E4M3B11FNUZTypeGet(MlirContext ctx);
171
172/// Returns the typeID of an Float8E3M4 type.
174
175/// Checks whether the given type is an f8E3M4 type.
176MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E3M4(MlirType type);
177
178/// Creates an f8E3M4 type in the given context. The type is owned by the
179/// context.
180MLIR_CAPI_EXPORTED MlirType mlirFloat8E3M4TypeGet(MlirContext ctx);
181
182/// Returns the typeID of an Float8E8M0FNU type.
184
185/// Checks whether the given type is an f8E8M0FNU type.
187
188/// Creates an f8E8M0FNU type in the given context. The type is owned by the
189/// context.
190MLIR_CAPI_EXPORTED MlirType mlirFloat8E8M0FNUTypeGet(MlirContext ctx);
191
192/// Returns the typeID of an BFloat16 type.
194
195/// Checks whether the given type is a bf16 type.
196MLIR_CAPI_EXPORTED bool mlirTypeIsABF16(MlirType type);
197
198/// Creates a bf16 type in the given context. The type is owned by the
199/// context.
200MLIR_CAPI_EXPORTED MlirType mlirBF16TypeGet(MlirContext ctx);
201
202/// Returns the typeID of an Float16 type.
204
205/// Checks whether the given type is an f16 type.
206MLIR_CAPI_EXPORTED bool mlirTypeIsAF16(MlirType type);
207
208/// Creates an f16 type in the given context. The type is owned by the
209/// context.
210MLIR_CAPI_EXPORTED MlirType mlirF16TypeGet(MlirContext ctx);
211
212/// Returns the typeID of an Float32 type.
214
215/// Checks whether the given type is an f32 type.
216MLIR_CAPI_EXPORTED bool mlirTypeIsAF32(MlirType type);
217
218/// Creates an f32 type in the given context. The type is owned by the
219/// context.
220MLIR_CAPI_EXPORTED MlirType mlirF32TypeGet(MlirContext ctx);
221
222/// Returns the typeID of an Float64 type.
224
225/// Checks whether the given type is an f64 type.
226MLIR_CAPI_EXPORTED bool mlirTypeIsAF64(MlirType type);
227
228/// Creates a f64 type in the given context. The type is owned by the
229/// context.
230MLIR_CAPI_EXPORTED MlirType mlirF64TypeGet(MlirContext ctx);
231
232/// Returns the typeID of a TF32 type.
234
235/// Checks whether the given type is an TF32 type.
236MLIR_CAPI_EXPORTED bool mlirTypeIsATF32(MlirType type);
237
238/// Creates a TF32 type in the given context. The type is owned by the
239/// context.
240MLIR_CAPI_EXPORTED MlirType mlirTF32TypeGet(MlirContext ctx);
241
242//===----------------------------------------------------------------------===//
243// None type.
244//===----------------------------------------------------------------------===//
245
246/// Returns the typeID of an None type.
248
249/// Checks whether the given type is a None type.
250MLIR_CAPI_EXPORTED bool mlirTypeIsANone(MlirType type);
251
252/// Creates a None type in the given context. The type is owned by the
253/// context.
254MLIR_CAPI_EXPORTED MlirType mlirNoneTypeGet(MlirContext ctx);
255
256//===----------------------------------------------------------------------===//
257// Complex type.
258//===----------------------------------------------------------------------===//
259
260/// Returns the typeID of an Complex type.
262
263/// Checks whether the given type is a Complex type.
264MLIR_CAPI_EXPORTED bool mlirTypeIsAComplex(MlirType type);
265
266/// Creates a complex type with the given element type in the same context as
267/// the element type. The type is owned by the context.
268MLIR_CAPI_EXPORTED MlirType mlirComplexTypeGet(MlirType elementType);
269
270/// Returns the element type of the given complex type.
272
273//===----------------------------------------------------------------------===//
274// Shaped type.
275//===----------------------------------------------------------------------===//
276
277/// Checks whether the given type is a Shaped type.
278MLIR_CAPI_EXPORTED bool mlirTypeIsAShaped(MlirType type);
279
280/// Returns the element type of the shaped type.
282
283/// Checks whether the given shaped type is ranked.
284MLIR_CAPI_EXPORTED bool mlirShapedTypeHasRank(MlirType type);
285
286/// Returns the rank of the given ranked shaped type.
288
289/// Checks whether the given shaped type has a static shape.
291
292/// Checks whether the dim-th dimension of the given shaped type is dynamic.
293MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicDim(MlirType type, intptr_t dim);
294
295/// Checks whether the dim-th dimension of the given shaped type is static.
296MLIR_CAPI_EXPORTED bool mlirShapedTypeIsStaticDim(MlirType type, intptr_t dim);
297
298/// Returns the dim-th dimension of the given ranked shaped type.
300 intptr_t dim);
301
302/// Checks whether the given value is used as a placeholder for dynamic sizes
303/// in shaped types.
305
306/// Checks whether the given shaped type dimension value is statically-sized.
308
309/// Returns the value indicating a dynamic size in a shaped type. Prefer
310/// mlirShapedTypeIsDynamicSize and mlirShapedTypeIsStaticSize to direct
311/// comparisons with this value.
313
314/// Checks whether the given value is used as a placeholder for dynamic strides
315/// and offsets in shaped types.
317
318/// Checks whether the given dimension value of a stride or an offset is
319/// statically-sized.
321
322/// Returns the value indicating a dynamic stride or offset in a shaped type.
323/// Prefer mlirShapedTypeIsDynamicStrideOrOffset and
324/// mlirShapedTypeIsStaticStrideOrOffset to direct comparisons with this value.
326
327//===----------------------------------------------------------------------===//
328// Vector type.
329//===----------------------------------------------------------------------===//
330
331/// Returns the typeID of an Vector type.
333
334/// Checks whether the given type is a Vector type.
335MLIR_CAPI_EXPORTED bool mlirTypeIsAVector(MlirType type);
336
337/// Creates a vector type of the shape identified by its rank and dimensions,
338/// with the given element type in the same context as the element type. The
339/// type is owned by the context.
340MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGet(intptr_t rank,
341 const int64_t *shape,
342 MlirType elementType);
343
344/// Same as "mlirVectorTypeGet" but returns a nullptr wrapping MlirType on
345/// illegal arguments, emitting appropriate diagnostics.
346MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGetChecked(MlirLocation loc,
347 intptr_t rank,
348 const int64_t *shape,
349 MlirType elementType);
350
351/// Creates a scalable vector type with the shape identified by its rank and
352/// dimensions. A subset of dimensions may be marked as scalable via the
353/// corresponding flag list, which is expected to have as many entries as the
354/// rank of the vector. The vector is created in the same context as the element
355/// type.
356MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGetScalable(intptr_t rank,
357 const int64_t *shape,
358 const bool *scalable,
359 MlirType elementType);
360
361/// Same as "mlirVectorTypeGetScalable" but returns a nullptr wrapping MlirType
362/// on illegal arguments, emitting appropriate diagnostics.
364MlirType mlirVectorTypeGetScalableChecked(MlirLocation loc, intptr_t rank,
365 const int64_t *shape,
366 const bool *scalable,
367 MlirType elementType);
368
369/// Checks whether the given vector type is scalable, i.e., has at least one
370/// scalable dimension.
372
373/// Checks whether the "dim"-th dimension of the given vector is scalable.
375 intptr_t dim);
376
377//===----------------------------------------------------------------------===//
378// Ranked / Unranked Tensor type.
379//===----------------------------------------------------------------------===//
380
381/// Checks whether the given type is a Tensor type.
382MLIR_CAPI_EXPORTED bool mlirTypeIsATensor(MlirType type);
383
384/// Returns the typeID of an RankedTensor type.
386
387/// Checks whether the given type is a ranked tensor type.
389
390/// Returns the typeID of an UnrankedTensor type.
392
393/// Checks whether the given type is an unranked tensor type.
395
396/// Creates a tensor type of a fixed rank with the given shape, element type,
397/// and optional encoding in the same context as the element type. The type is
398/// owned by the context. Tensor types without any specific encoding field
399/// should assign mlirAttributeGetNull() to this parameter.
400MLIR_CAPI_EXPORTED MlirType mlirRankedTensorTypeGet(intptr_t rank,
401 const int64_t *shape,
402 MlirType elementType,
403 MlirAttribute encoding);
404
405/// Same as "mlirRankedTensorTypeGet" but returns a nullptr wrapping MlirType on
406/// illegal arguments, emitting appropriate diagnostics.
408 MlirLocation loc, intptr_t rank, const int64_t *shape, MlirType elementType,
409 MlirAttribute encoding);
410
411/// Gets the 'encoding' attribute from the ranked tensor type, returning a null
412/// attribute if none.
413MLIR_CAPI_EXPORTED MlirAttribute mlirRankedTensorTypeGetEncoding(MlirType type);
414
415/// Creates an unranked tensor type with the given element type in the same
416/// context as the element type. The type is owned by the context.
417MLIR_CAPI_EXPORTED MlirType mlirUnrankedTensorTypeGet(MlirType elementType);
418
419/// Same as "mlirUnrankedTensorTypeGet" but returns a nullptr wrapping MlirType
420/// on illegal arguments, emitting appropriate diagnostics.
421MLIR_CAPI_EXPORTED MlirType
422mlirUnrankedTensorTypeGetChecked(MlirLocation loc, MlirType elementType);
423
424//===----------------------------------------------------------------------===//
425// Ranked / Unranked MemRef type.
426//===----------------------------------------------------------------------===//
427
428/// Returns the typeID of an MemRef type.
430
431/// Checks whether the given type is a MemRef type.
432MLIR_CAPI_EXPORTED bool mlirTypeIsAMemRef(MlirType type);
433
434/// Returns the typeID of an UnrankedMemRef type.
436
437/// Checks whether the given type is an UnrankedMemRef type.
439
440/// Creates a MemRef type with the given rank and shape, a potentially empty
441/// list of affine layout maps, the given memory space and element type, in the
442/// same context as element type. The type is owned by the context.
443MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGet(MlirType elementType,
444 intptr_t rank,
445 const int64_t *shape,
446 MlirAttribute layout,
447 MlirAttribute memorySpace);
448
449/// Same as "mlirMemRefTypeGet" but returns a nullptr-wrapping MlirType o
450/// illegal arguments, emitting appropriate diagnostics.
452 MlirLocation loc, MlirType elementType, intptr_t rank, const int64_t *shape,
453 MlirAttribute layout, MlirAttribute memorySpace);
454
455/// Creates a MemRef type with the given rank, shape, memory space and element
456/// type in the same context as the element type. The type has no affine maps,
457/// i.e. represents a default row-major contiguous memref. The type is owned by
458/// the context.
459MLIR_CAPI_EXPORTED MlirType
460mlirMemRefTypeContiguousGet(MlirType elementType, intptr_t rank,
461 const int64_t *shape, MlirAttribute memorySpace);
462
463/// Same as "mlirMemRefTypeContiguousGet" but returns a nullptr wrapping
464/// MlirType on illegal arguments, emitting appropriate diagnostics.
466 MlirLocation loc, MlirType elementType, intptr_t rank, const int64_t *shape,
467 MlirAttribute memorySpace);
468
469/// Creates an Unranked MemRef type with the given element type and in the given
470/// memory space. The type is owned by the context of element type.
471MLIR_CAPI_EXPORTED MlirType
472mlirUnrankedMemRefTypeGet(MlirType elementType, MlirAttribute memorySpace);
473
474/// Same as "mlirUnrankedMemRefTypeGet" but returns a nullptr wrapping
475/// MlirType on illegal arguments, emitting appropriate diagnostics.
477 MlirLocation loc, MlirType elementType, MlirAttribute memorySpace);
478
479/// Returns the layout of the given MemRef type.
480MLIR_CAPI_EXPORTED MlirAttribute mlirMemRefTypeGetLayout(MlirType type);
481
482/// Returns the affine map of the given MemRef type.
483MLIR_CAPI_EXPORTED MlirAffineMap mlirMemRefTypeGetAffineMap(MlirType type);
484
485/// Returns the memory space of the given MemRef type.
486MLIR_CAPI_EXPORTED MlirAttribute mlirMemRefTypeGetMemorySpace(MlirType type);
487
488/// Returns the strides of the MemRef if the layout map is in strided form.
489/// Both strides and offset are out params. strides must point to pre-allocated
490/// memory of length equal to the rank of the memref.
492 MlirType type, int64_t *strides, int64_t *offset);
493
494/// Returns the memory spcae of the given Unranked MemRef type.
495MLIR_CAPI_EXPORTED MlirAttribute
497
498//===----------------------------------------------------------------------===//
499// Tuple type.
500//===----------------------------------------------------------------------===//
501
502/// Returns the typeID of an Tuple type.
504
505/// Checks whether the given type is a tuple type.
506MLIR_CAPI_EXPORTED bool mlirTypeIsATuple(MlirType type);
507
508/// Creates a tuple type that consists of the given list of elemental types. The
509/// type is owned by the context.
510MLIR_CAPI_EXPORTED MlirType mlirTupleTypeGet(MlirContext ctx,
511 intptr_t numElements,
512 MlirType const *elements);
513
514/// Returns the number of types contained in a tuple.
515MLIR_CAPI_EXPORTED intptr_t mlirTupleTypeGetNumTypes(MlirType type);
516
517/// Returns the pos-th type in the tuple type.
518MLIR_CAPI_EXPORTED MlirType mlirTupleTypeGetType(MlirType type, intptr_t pos);
519
520//===----------------------------------------------------------------------===//
521// Function type.
522//===----------------------------------------------------------------------===//
523
524/// Returns the typeID of an Function type.
526
527/// Checks whether the given type is a function type.
528MLIR_CAPI_EXPORTED bool mlirTypeIsAFunction(MlirType type);
529
530/// Creates a function type, mapping a list of input types to result types.
531MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGet(MlirContext ctx,
532 intptr_t numInputs,
533 MlirType const *inputs,
534 intptr_t numResults,
535 MlirType const *results);
536
537/// Returns the number of input types.
539
540/// Returns the number of result types.
542
543/// Returns the pos-th input type.
544MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGetInput(MlirType type,
545 intptr_t pos);
546
547/// Returns the pos-th result type.
548MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGetResult(MlirType type,
549 intptr_t pos);
550
551//===----------------------------------------------------------------------===//
552// Opaque type.
553//===----------------------------------------------------------------------===//
554
555/// Returns the typeID of an Opaque type.
557
558/// Checks whether the given type is an opaque type.
559MLIR_CAPI_EXPORTED bool mlirTypeIsAOpaque(MlirType type);
560
561/// Creates an opaque type in the given context associated with the dialect
562/// identified by its namespace. The type contains opaque byte data of the
563/// specified length (data need not be null-terminated).
564MLIR_CAPI_EXPORTED MlirType mlirOpaqueTypeGet(MlirContext ctx,
565 MlirStringRef dialectNamespace,
566 MlirStringRef typeData);
567
568/// Returns the namespace of the dialect with which the given opaque type
569/// is associated. The namespace string is owned by the context.
572
573/// Returns the raw data as a string reference. The data remains live as long as
574/// the context in which the type lives.
576
577#ifdef __cplusplus
578}
579#endif
580
581#endif // MLIR_C_BUILTINTYPES_H
MLIR_CAPI_EXPORTED 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...
MLIR_CAPI_EXPORTED MlirTypeID mlirFloat8E8M0FNUTypeGetTypeID(void)
Returns the typeID of an Float8E8M0FNU type.
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 mlirFloat4E2M1FNTypeGetTypeID(void)
Returns the typeID of an Float4E2M1FN type.
MLIR_CAPI_EXPORTED 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...
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 bool mlirTypeIsAFloat8E8M0FNU(MlirType type)
Checks whether the given type is an f8E8M0FNU 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 mlirTypeIsAFloat6E3M2FN(MlirType type)
Checks whether the given type is an f6E3M2FN type.
MLIR_CAPI_EXPORTED bool mlirShapedTypeIsStaticDim(MlirType type, intptr_t dim)
Checks whether the dim-th dimension of the given shaped type is static.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFunction(MlirType type)
Checks whether the given type is a function type.
MLIR_CAPI_EXPORTED MlirType mlirFloat8E3M4TypeGet(MlirContext ctx)
Creates an f8E3M4 type in the given context.
MLIR_CAPI_EXPORTED bool mlirTypeIsAFloat8E3M4(MlirType type)
Checks whether the given type is an f8E3M4 type.
MLIR_CAPI_EXPORTED bool mlirShapedTypeIsStaticStrideOrOffset(int64_t val)
Checks whether the given dimension value of a stride or an offset is statically-sized.
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 MlirType mlirFloat8E8M0FNUTypeGet(MlirContext ctx)
Creates an f8E8M0FNU type in the given context.
MLIR_CAPI_EXPORTED bool mlirIntegerTypeIsUnsigned(MlirType type)
Checks whether the given integer type is unsigned.
MLIR_CAPI_EXPORTED bool mlirTypeIsATensor(MlirType type)
Checks whether the given type is a Tensor type.
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 bool mlirTypeIsAFloat8E4M3(MlirType type)
Checks whether the given type is an f8E4M3 type.
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 MlirType mlirFloat6E2M3FNTypeGet(MlirContext ctx)
Creates an f6E2M3FN type in the given context.
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 MlirType mlirVectorTypeGetScalable(intptr_t rank, const int64_t *shape, const bool *scalable, MlirType elementType)
Creates a scalable vector type with the shape identified by its rank and dimensions.
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 MlirType mlirFloat8E4M3TypeGet(MlirContext ctx)
Creates an f8E4M3 type in the given context.
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 MlirTypeID mlirFloat6E2M3FNTypeGetTypeID(void)
Returns the typeID of an Float6E2M3FN 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 bool mlirTypeIsAFloat6E2M3FN(MlirType type)
Checks whether the given type is an f6E2M3FN type.
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 MlirTypeID mlirFloat8E3M4TypeGetTypeID(void)
Returns the typeID of an Float8E3M4 type.
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 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...
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 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,...
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 whether 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 MlirType mlirFloat6E3M2FNTypeGet(MlirContext ctx)
Creates an f6E3M2FN type in the given context.
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 mlirUnrankedMemRefTypeGet(MlirType elementType, MlirAttribute memorySpace)
Creates an Unranked MemRef type with the given element type and in the given memory space.
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 MlirTypeID mlirFloat8E4M3TypeGetTypeID(void)
Returns the typeID of an Float8E4M3 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 mlirShapedTypeIsStaticSize(int64_t size)
Checks whether the given shaped type dimension value is statically-sized.
MLIR_CAPI_EXPORTED 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,...
MLIR_CAPI_EXPORTED MlirType mlirUnrankedTensorTypeGet(MlirType elementType)
Creates an unranked tensor type with the given element type in the same context as the element type.
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 bool mlirTypeIsAFloat4E2M1FN(MlirType type)
Checks whether the given type is an f4E2M1FN type.
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 MlirTypeID mlirFloat6E3M2FNTypeGetTypeID(void)
Returns the typeID of an Float6E3M2FN type.
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.
MLIR_CAPI_EXPORTED MlirType mlirFloat4E2M1FNTypeGet(MlirContext ctx)
Creates an f4E2M1FN type in the given context.
#define MLIR_CAPI_EXPORTED
Definition Support.h:46
A logical result value, essentially a boolean with named states.
Definition Support.h:116
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition Support.h:73