MLIR 23.0.0git
BuiltinAttributes.h
Go to the documentation of this file.
1//===-- mlir-c/BuiltinAttributes.h - C API for Builtin Attributes -*- 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// This header declares the C interface to MLIR Builtin attributes.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_C_BUILTINATTRIBUTES_H
15#define MLIR_C_BUILTINATTRIBUTES_H
16
17#include "mlir-c/AffineMap.h"
18#include "mlir-c/IR.h"
19#include "mlir-c/IntegerSet.h"
20#include "mlir-c/Support.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/// Returns an empty attribute.
28
29//===----------------------------------------------------------------------===//
30// Location attribute.
31//===----------------------------------------------------------------------===//
32
33MLIR_CAPI_EXPORTED bool mlirAttributeIsALocation(MlirAttribute attr);
34
35//===----------------------------------------------------------------------===//
36// Affine map attribute.
37//===----------------------------------------------------------------------===//
38
39/// Checks whether the given attribute is an affine map attribute.
40MLIR_CAPI_EXPORTED bool mlirAttributeIsAAffineMap(MlirAttribute attr);
41
42/// Creates an affine map attribute wrapping the given map. The attribute
43/// belongs to the same context as the affine map.
44MLIR_CAPI_EXPORTED MlirAttribute mlirAffineMapAttrGet(MlirAffineMap map);
45
47
48/// Returns the affine map wrapped in the given affine map attribute.
49MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr);
50
51/// Returns the typeID of an AffineMap attribute.
53
54//===----------------------------------------------------------------------===//
55// Array attribute.
56//===----------------------------------------------------------------------===//
57
58/// Checks whether the given attribute is an array attribute.
59MLIR_CAPI_EXPORTED bool mlirAttributeIsAArray(MlirAttribute attr);
60
61/// Creates an array element containing the given list of elements in the given
62/// context.
64 MlirContext ctx, intptr_t numElements, MlirAttribute const *elements);
65
67
68/// Returns the number of elements stored in the given array attribute.
70
71/// Returns pos-th element stored in the given array attribute.
72MLIR_CAPI_EXPORTED MlirAttribute mlirArrayAttrGetElement(MlirAttribute attr,
73 intptr_t pos);
74
75/// Returns the typeID of an Array attribute.
77
78//===----------------------------------------------------------------------===//
79// Dictionary attribute.
80//===----------------------------------------------------------------------===//
81
82/// Checks whether the given attribute is a dictionary attribute.
83MLIR_CAPI_EXPORTED bool mlirAttributeIsADictionary(MlirAttribute attr);
84
85/// Creates a dictionary attribute containing the given list of elements in the
86/// provided context.
88 MlirContext ctx, intptr_t numElements, MlirNamedAttribute const *elements);
89
91
92/// Returns the number of attributes contained in a dictionary attribute.
94mlirDictionaryAttrGetNumElements(MlirAttribute attr);
95
96/// Returns pos-th element of the given dictionary attribute.
98mlirDictionaryAttrGetElement(MlirAttribute attr, intptr_t pos);
99
100/// Returns the dictionary attribute element with the given name or NULL if the
101/// given name does not exist in the dictionary.
102MLIR_CAPI_EXPORTED MlirAttribute
103mlirDictionaryAttrGetElementByName(MlirAttribute attr, MlirStringRef name);
104
105/// Returns the typeID of a Dictionary attribute.
107
108//===----------------------------------------------------------------------===//
109// Floating point attribute.
110//===----------------------------------------------------------------------===//
111
112// TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
113// relevant functions here.
114
115/// Checks whether the given attribute is a floating point attribute.
116MLIR_CAPI_EXPORTED bool mlirAttributeIsAFloat(MlirAttribute attr);
117
119
120/// Creates a floating point attribute in the given context with the given
121/// double value and double-precision FP semantics.
122MLIR_CAPI_EXPORTED MlirAttribute mlirFloatAttrDoubleGet(MlirContext ctx,
123 MlirType type,
124 double value);
125
126/// Same as "mlirFloatAttrDoubleGet", but if the type is not valid for a
127/// construction of a FloatAttr, returns a null MlirAttribute.
128MLIR_CAPI_EXPORTED MlirAttribute mlirFloatAttrDoubleGetChecked(MlirLocation loc,
129 MlirType type,
130 double value);
131
132/// Returns the value stored in the given floating point attribute, interpreting
133/// the value as double.
134MLIR_CAPI_EXPORTED double mlirFloatAttrGetValueDouble(MlirAttribute attr);
135
136/// Returns the typeID of a Float attribute.
138
139//===----------------------------------------------------------------------===//
140// Integer attribute.
141//===----------------------------------------------------------------------===//
142
143// TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
144// relevant functions here.
145
146/// Checks whether the given attribute is an integer attribute.
147MLIR_CAPI_EXPORTED bool mlirAttributeIsAInteger(MlirAttribute attr);
148
149/// Creates an integer attribute of the given type with the given integer
150/// value.
151MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerAttrGet(MlirType type,
152 int64_t value);
153
155
156/// Returns the value stored in the given integer attribute, assuming the value
157/// is of signless type and fits into a signed 64-bit integer.
159
160/// Returns the value stored in the given integer attribute, assuming the value
161/// is of signed type and fits into a signed 64-bit integer.
163
164/// Returns the value stored in the given integer attribute, assuming the value
165/// is of unsigned type and fits into an unsigned 64-bit integer.
166MLIR_CAPI_EXPORTED uint64_t mlirIntegerAttrGetValueUInt(MlirAttribute attr);
167
168/// Returns the typeID of an Integer attribute.
170
171//===----------------------------------------------------------------------===//
172// Bool attribute.
173//===----------------------------------------------------------------------===//
174
175/// Checks whether the given attribute is a bool attribute.
176MLIR_CAPI_EXPORTED bool mlirAttributeIsABool(MlirAttribute attr);
177
178/// Creates a bool attribute in the given context with the given value.
179MLIR_CAPI_EXPORTED MlirAttribute mlirBoolAttrGet(MlirContext ctx, int value);
180
181/// Returns the value stored in the given bool attribute.
182MLIR_CAPI_EXPORTED bool mlirBoolAttrGetValue(MlirAttribute attr);
183
184//===----------------------------------------------------------------------===//
185// Integer set attribute.
186//===----------------------------------------------------------------------===//
187
188/// Checks whether the given attribute is an integer set attribute.
189MLIR_CAPI_EXPORTED bool mlirAttributeIsAIntegerSet(MlirAttribute attr);
190
191/// Creates an integer set attribute wrapping the given set. The attribute
192/// belongs to the same context as the integer set.
193MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerSetAttrGet(MlirIntegerSet set);
194
196
197/// Returns the integer set wrapped in the given integer set attribute.
198MLIR_CAPI_EXPORTED MlirIntegerSet
199mlirIntegerSetAttrGetValue(MlirAttribute attr);
200
201/// Returns the typeID of an IntegerSet attribute.
203
204//===----------------------------------------------------------------------===//
205// Opaque attribute.
206//===----------------------------------------------------------------------===//
207
208/// Checks whether the given attribute is an opaque attribute.
209MLIR_CAPI_EXPORTED bool mlirAttributeIsAOpaque(MlirAttribute attr);
210
211/// Creates an opaque attribute in the given context associated with the dialect
212/// identified by its namespace. The attribute contains opaque byte data of the
213/// specified length (data need not be null-terminated).
214MLIR_CAPI_EXPORTED MlirAttribute
215mlirOpaqueAttrGet(MlirContext ctx, MlirStringRef dialectNamespace,
216 intptr_t dataLength, const char *data, MlirType type);
217
219
220/// Returns the namespace of the dialect with which the given opaque attribute
221/// is associated. The namespace string is owned by the context.
223mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr);
224
225/// Returns the raw data as a string reference. The data remains live as long as
226/// the context in which the attribute lives.
228
229/// Returns the typeID of an Opaque attribute.
231
232//===----------------------------------------------------------------------===//
233// String attribute.
234//===----------------------------------------------------------------------===//
235
236/// Checks whether the given attribute is a string attribute.
237MLIR_CAPI_EXPORTED bool mlirAttributeIsAString(MlirAttribute attr);
238
239/// Creates a string attribute in the given context containing the given string.
240
241MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrGet(MlirContext ctx,
242 MlirStringRef str);
243
245
246/// Creates a string attribute in the given context containing the given string.
247/// Additionally, the attribute has the given type.
248MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrTypedGet(MlirType type,
249 MlirStringRef str);
250
251/// Returns the attribute values as a string reference. The data remains live as
252/// long as the context in which the attribute lives.
254
255/// Returns the typeID of a String attribute.
257
258//===----------------------------------------------------------------------===//
259// SymbolRef attribute.
260//===----------------------------------------------------------------------===//
261
262/// Checks whether the given attribute is a symbol reference attribute.
263MLIR_CAPI_EXPORTED bool mlirAttributeIsASymbolRef(MlirAttribute attr);
264
265/// Creates a symbol reference attribute in the given context referencing a
266/// symbol identified by the given string inside a list of nested references.
267/// Each of the references in the list must not be nested.
268MLIR_CAPI_EXPORTED MlirAttribute
269mlirSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol,
270 intptr_t numReferences, MlirAttribute const *references);
271
273
274/// Returns the string reference to the root referenced symbol. The data remains
275/// live as long as the context in which the attribute lives.
277mlirSymbolRefAttrGetRootReference(MlirAttribute attr);
278
279/// Returns the string reference to the leaf referenced symbol. The data remains
280/// live as long as the context in which the attribute lives.
282mlirSymbolRefAttrGetLeafReference(MlirAttribute attr);
283
284/// Returns the number of references nested in the given symbol reference
285/// attribute.
288
289/// Returns pos-th reference nested in the given symbol reference attribute.
290MLIR_CAPI_EXPORTED MlirAttribute
291mlirSymbolRefAttrGetNestedReference(MlirAttribute attr, intptr_t pos);
292
293/// Returns the typeID of an SymbolRef attribute.
295
296/// Creates a DisctinctAttr with the referenced attribute.
297MLIR_CAPI_EXPORTED MlirAttribute
298mlirDisctinctAttrCreate(MlirAttribute referencedAttr);
299
300//===----------------------------------------------------------------------===//
301// Flat SymbolRef attribute.
302//===----------------------------------------------------------------------===//
303
304/// Checks whether the given attribute is a flat symbol reference attribute.
306
307/// Creates a flat symbol reference attribute in the given context referencing a
308/// symbol identified by the given string.
309MLIR_CAPI_EXPORTED MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx,
310 MlirStringRef symbol);
311
313
314/// Returns the referenced symbol as a string reference. The data remains live
315/// as long as the context in which the attribute lives.
317mlirFlatSymbolRefAttrGetValue(MlirAttribute attr);
318
319//===----------------------------------------------------------------------===//
320// Type attribute.
321//===----------------------------------------------------------------------===//
322
323/// Checks whether the given attribute is a type attribute.
324MLIR_CAPI_EXPORTED bool mlirAttributeIsAType(MlirAttribute attr);
325
326/// Creates a type attribute wrapping the given type in the same context as the
327/// type.
328MLIR_CAPI_EXPORTED MlirAttribute mlirTypeAttrGet(MlirType type);
329
331
332/// Returns the type stored in the given type attribute.
333MLIR_CAPI_EXPORTED MlirType mlirTypeAttrGetValue(MlirAttribute attr);
334
335/// Returns the typeID of a Type attribute.
337
338//===----------------------------------------------------------------------===//
339// Unit attribute.
340//===----------------------------------------------------------------------===//
341
342/// Checks whether the given attribute is a unit attribute.
343MLIR_CAPI_EXPORTED bool mlirAttributeIsAUnit(MlirAttribute attr);
344
345/// Creates a unit attribute in the given context.
346MLIR_CAPI_EXPORTED MlirAttribute mlirUnitAttrGet(MlirContext ctx);
347
349
350/// Returns the typeID of a Unit attribute.
352
353//===----------------------------------------------------------------------===//
354// Elements attributes.
355//===----------------------------------------------------------------------===//
356
357/// Checks whether the given attribute is an elements attribute.
358MLIR_CAPI_EXPORTED bool mlirAttributeIsAElements(MlirAttribute attr);
359
360/// Returns the element at the given rank-dimensional index.
361MLIR_CAPI_EXPORTED MlirAttribute mlirElementsAttrGetValue(MlirAttribute attr,
362 intptr_t rank,
363 uint64_t *idxs);
364
365/// Checks whether the given rank-dimensional index is valid in the given
366/// elements attribute.
368mlirElementsAttrIsValidIndex(MlirAttribute attr, intptr_t rank, uint64_t *idxs);
369
370/// Gets the total number of elements in the given elements attribute. In order
371/// to iterate over the attribute, obtain its type, which must be a statically
372/// shaped type and use its sizes to build a multi-dimensional index.
374
375//===----------------------------------------------------------------------===//
376// Dense array attribute.
377//===----------------------------------------------------------------------===//
378
380
381/// Checks whether the given attribute is a dense array attribute.
383MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseI8Array(MlirAttribute attr);
389
390/// Create a dense array attribute with the given elements.
391MLIR_CAPI_EXPORTED MlirAttribute mlirDenseBoolArrayGet(MlirContext ctx,
392 intptr_t size,
393 int const *values);
394MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI8ArrayGet(MlirContext ctx,
395 intptr_t size,
396 int8_t const *values);
397MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI16ArrayGet(MlirContext ctx,
398 intptr_t size,
399 int16_t const *values);
400MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI32ArrayGet(MlirContext ctx,
401 intptr_t size,
402 int32_t const *values);
403MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI64ArrayGet(MlirContext ctx,
404 intptr_t size,
405 int64_t const *values);
406MLIR_CAPI_EXPORTED MlirAttribute mlirDenseF32ArrayGet(MlirContext ctx,
407 intptr_t size,
408 float const *values);
409MLIR_CAPI_EXPORTED MlirAttribute mlirDenseF64ArrayGet(MlirContext ctx,
410 intptr_t size,
411 double const *values);
412
413/// Get the size of a dense array.
415
416/// Get an element of a dense array.
418 intptr_t pos);
419MLIR_CAPI_EXPORTED int8_t mlirDenseI8ArrayGetElement(MlirAttribute attr,
420 intptr_t pos);
421MLIR_CAPI_EXPORTED int16_t mlirDenseI16ArrayGetElement(MlirAttribute attr,
422 intptr_t pos);
423MLIR_CAPI_EXPORTED int32_t mlirDenseI32ArrayGetElement(MlirAttribute attr,
424 intptr_t pos);
426 intptr_t pos);
427MLIR_CAPI_EXPORTED float mlirDenseF32ArrayGetElement(MlirAttribute attr,
428 intptr_t pos);
429MLIR_CAPI_EXPORTED double mlirDenseF64ArrayGetElement(MlirAttribute attr,
430 intptr_t pos);
431
432//===----------------------------------------------------------------------===//
433// Dense elements attribute.
434//===----------------------------------------------------------------------===//
435
436// TODO: decide on the interface and add support for complex elements.
437// TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
438// relevant functions here.
439
440/// Checks whether the given attribute is a dense elements attribute.
444
445/// Returns the typeID of an DenseIntOrFPElements attribute.
447
448/// Creates a dense elements attribute with the given Shaped type and elements
449/// in the same context as the type.
451 MlirType shapedType, intptr_t numElements, MlirAttribute const *elements);
452
453/// Creates a dense elements attribute with the given Shaped type and elements
454/// populated from a packed, row-major opaque buffer of contents.
455///
456/// The format of the raw buffer is a densely packed array of values that
457/// can be bitcast to the storage format of the element type specified.
458/// Types that are not byte aligned will be:
459/// - For bitwidth > 1: Rounded up to the next byte.
460/// - For bitwidth = 1: Packed into 8bit bytes with bits corresponding to
461/// the linear order of the shape type from MSB to LSB, padded to on the
462/// right.
463///
464/// A raw buffer of a single element (or for 1-bit, a byte of value 0 or 255)
465/// will be interpreted as a splat. User code should be prepared for additional,
466/// conformant patterns to be identified as splats in the future.
468 MlirType shapedType, size_t rawBufferSize, const void *rawBuffer);
469
470/// Creates a dense elements attribute with the given Shaped type containing a
471/// single replicated element (splat).
472MLIR_CAPI_EXPORTED MlirAttribute
473mlirDenseElementsAttrSplatGet(MlirType shapedType, MlirAttribute element);
474MLIR_CAPI_EXPORTED MlirAttribute
475mlirDenseElementsAttrBoolSplatGet(MlirType shapedType, bool element);
476MLIR_CAPI_EXPORTED MlirAttribute
477mlirDenseElementsAttrUInt8SplatGet(MlirType shapedType, uint8_t element);
478MLIR_CAPI_EXPORTED MlirAttribute
479mlirDenseElementsAttrInt8SplatGet(MlirType shapedType, int8_t element);
480MLIR_CAPI_EXPORTED MlirAttribute
481mlirDenseElementsAttrUInt32SplatGet(MlirType shapedType, uint32_t element);
482MLIR_CAPI_EXPORTED MlirAttribute
483mlirDenseElementsAttrInt32SplatGet(MlirType shapedType, int32_t element);
484MLIR_CAPI_EXPORTED MlirAttribute
485mlirDenseElementsAttrUInt64SplatGet(MlirType shapedType, uint64_t element);
486MLIR_CAPI_EXPORTED MlirAttribute
487mlirDenseElementsAttrInt64SplatGet(MlirType shapedType, int64_t element);
488MLIR_CAPI_EXPORTED MlirAttribute
489mlirDenseElementsAttrFloatSplatGet(MlirType shapedType, float element);
490MLIR_CAPI_EXPORTED MlirAttribute
491mlirDenseElementsAttrDoubleSplatGet(MlirType shapedType, double element);
492
493/// Creates a dense elements attribute with the given shaped type from elements
494/// of a specific type. Expects the element type of the shaped type to match the
495/// data element type.
497 MlirType shapedType, intptr_t numElements, const int *elements);
499 MlirType shapedType, intptr_t numElements, const uint8_t *elements);
501 MlirType shapedType, intptr_t numElements, const int8_t *elements);
503 MlirType shapedType, intptr_t numElements, const uint16_t *elements);
505 MlirType shapedType, intptr_t numElements, const int16_t *elements);
507 MlirType shapedType, intptr_t numElements, const uint32_t *elements);
509 MlirType shapedType, intptr_t numElements, const int32_t *elements);
511 MlirType shapedType, intptr_t numElements, const uint64_t *elements);
513 MlirType shapedType, intptr_t numElements, const int64_t *elements);
515 MlirType shapedType, intptr_t numElements, const float *elements);
517 MlirType shapedType, intptr_t numElements, const double *elements);
519 MlirType shapedType, intptr_t numElements, const uint16_t *elements);
521 MlirType shapedType, intptr_t numElements, const uint16_t *elements);
522
523/// Creates a dense elements attribute with the given shaped type from string
524/// elements.
526 MlirType shapedType, intptr_t numElements, MlirStringRef *strs);
527
528/// Creates a dense elements attribute that has the same data as the given dense
529/// elements attribute and a different shaped type. The new type must have the
530/// same total number of elements.
531MLIR_CAPI_EXPORTED MlirAttribute
532mlirDenseElementsAttrReshapeGet(MlirAttribute attr, MlirType shapedType);
533
534/// Checks whether the given dense elements attribute contains a single
535/// replicated value (splat).
536MLIR_CAPI_EXPORTED bool mlirDenseElementsAttrIsSplat(MlirAttribute attr);
537
538/// Returns the single replicated value (splat) of a specific type contained by
539/// the given dense elements attribute.
540MLIR_CAPI_EXPORTED MlirAttribute
541mlirDenseElementsAttrGetSplatValue(MlirAttribute attr);
546MLIR_CAPI_EXPORTED uint8_t
548MLIR_CAPI_EXPORTED int32_t
550MLIR_CAPI_EXPORTED uint32_t
554MLIR_CAPI_EXPORTED uint64_t
562
563/// Returns the pos-th value (flat contiguous indexing) of a specific type
564/// contained by the given dense elements attribute.
566 intptr_t pos);
568 intptr_t pos);
569MLIR_CAPI_EXPORTED uint8_t
570mlirDenseElementsAttrGetUInt8Value(MlirAttribute attr, intptr_t pos);
571MLIR_CAPI_EXPORTED int16_t
572mlirDenseElementsAttrGetInt16Value(MlirAttribute attr, intptr_t pos);
573MLIR_CAPI_EXPORTED uint16_t
574mlirDenseElementsAttrGetUInt16Value(MlirAttribute attr, intptr_t pos);
575MLIR_CAPI_EXPORTED int32_t
576mlirDenseElementsAttrGetInt32Value(MlirAttribute attr, intptr_t pos);
577MLIR_CAPI_EXPORTED uint32_t
578mlirDenseElementsAttrGetUInt32Value(MlirAttribute attr, intptr_t pos);
580mlirDenseElementsAttrGetInt64Value(MlirAttribute attr, intptr_t pos);
581MLIR_CAPI_EXPORTED uint64_t
582mlirDenseElementsAttrGetUInt64Value(MlirAttribute attr, intptr_t pos);
583MLIR_CAPI_EXPORTED uint64_t
584mlirDenseElementsAttrGetIndexValue(MlirAttribute attr, intptr_t pos);
586 intptr_t pos);
588mlirDenseElementsAttrGetDoubleValue(MlirAttribute attr, intptr_t pos);
590mlirDenseElementsAttrGetStringValue(MlirAttribute attr, intptr_t pos);
591
592/// Returns the raw data of the given dense elements attribute.
593MLIR_CAPI_EXPORTED const void *
594mlirDenseElementsAttrGetRawData(MlirAttribute attr);
595
596//===----------------------------------------------------------------------===//
597// Resource blob attributes.
598//===----------------------------------------------------------------------===//
599
601mlirAttributeIsADenseResourceElements(MlirAttribute attr);
602
603/// Unlike the typed accessors below, constructs the attribute with a raw
604/// data buffer and no type/alignment checking. Use a more strongly typed
605/// accessor if possible. If dataIsMutable is false, then an immutable
606/// AsmResourceBlob will be created and that passed data contents will be
607/// treated as const.
608/// If the deleter is non NULL, then it will be called when the data buffer
609/// can no longer be accessed (passing userData to it).
611 MlirType shapedType, MlirStringRef name, void *data, size_t dataLength,
612 size_t dataAlignment, bool dataIsMutable,
613 void (*deleter)(void *userData, const void *data, size_t size,
614 size_t align),
615 void *userData);
616
618
620 MlirType shapedType, MlirStringRef name, intptr_t numElements,
621 const int *elements);
623 MlirType shapedType, MlirStringRef name, intptr_t numElements,
624 const uint8_t *elements);
626 MlirType shapedType, MlirStringRef name, intptr_t numElements,
627 const int8_t *elements);
628MLIR_CAPI_EXPORTED MlirAttribute
630 MlirStringRef name,
631 intptr_t numElements,
632 const uint16_t *elements);
634 MlirType shapedType, MlirStringRef name, intptr_t numElements,
635 const int16_t *elements);
636MLIR_CAPI_EXPORTED MlirAttribute
638 MlirStringRef name,
639 intptr_t numElements,
640 const uint32_t *elements);
642 MlirType shapedType, MlirStringRef name, intptr_t numElements,
643 const int32_t *elements);
644MLIR_CAPI_EXPORTED MlirAttribute
646 MlirStringRef name,
647 intptr_t numElements,
648 const uint64_t *elements);
650 MlirType shapedType, MlirStringRef name, intptr_t numElements,
651 const int64_t *elements);
653 MlirType shapedType, MlirStringRef name, intptr_t numElements,
654 const float *elements);
655MLIR_CAPI_EXPORTED MlirAttribute
657 MlirStringRef name,
658 intptr_t numElements,
659 const double *elements);
660
661/// Returns the pos-th value (flat contiguous indexing) of a specific type
662/// contained by the given dense resource elements attribute.
667MLIR_CAPI_EXPORTED uint8_t
669MLIR_CAPI_EXPORTED int16_t
671MLIR_CAPI_EXPORTED uint16_t
673MLIR_CAPI_EXPORTED int32_t
675MLIR_CAPI_EXPORTED uint32_t
679MLIR_CAPI_EXPORTED uint64_t
685
686//===----------------------------------------------------------------------===//
687// Sparse elements attribute.
688//===----------------------------------------------------------------------===//
689
690/// Checks whether the given attribute is a sparse elements attribute.
692
693/// Creates a sparse elements attribute of the given shape from a list of
694/// indices and a list of associated values. Both lists are expected to be dense
695/// elements attributes with the same number of elements. The list of indices is
696/// expected to contain 64-bit integers. The attribute is created in the same
697/// context as the type.
699 MlirType shapedType, MlirAttribute denseIndices, MlirAttribute denseValues);
700
701/// Returns the dense elements attribute containing 64-bit integer indices of
702/// non-null elements in the given sparse elements attribute.
703MLIR_CAPI_EXPORTED MlirAttribute
704mlirSparseElementsAttrGetIndices(MlirAttribute attr);
705
706/// Returns the dense elements attribute containing the non-null elements in the
707/// given sparse elements attribute.
708MLIR_CAPI_EXPORTED MlirAttribute
709mlirSparseElementsAttrGetValues(MlirAttribute attr);
710
711/// Returns the typeID of a SparseElements attribute.
713
714//===----------------------------------------------------------------------===//
715// Strided layout attribute.
716//===----------------------------------------------------------------------===//
717
718// Checks wheather the given attribute is a strided layout attribute.
720
721// Creates a strided layout attribute from given strides and offset.
722MLIR_CAPI_EXPORTED MlirAttribute
723mlirStridedLayoutAttrGet(MlirContext ctx, int64_t offset, intptr_t numStrides,
724 const int64_t *strides);
725
727
728// Returns the offset in the given strided layout layout attribute.
730
731// Returns the number of strides in the given strided layout attribute.
733mlirStridedLayoutAttrGetNumStrides(MlirAttribute attr);
734
735// Returns the pos-th stride stored in the given strided layout attribute.
737 intptr_t pos);
738
739/// Returns the typeID of a StridedLayout attribute.
741
742#ifdef __cplusplus
743}
744#endif
745
746#endif // MLIR_C_BUILTINATTRIBUTES_H
MLIR_CAPI_EXPORTED MlirAttribute mlirAffineMapAttrGet(MlirAffineMap map)
Creates an affine map attribute wrapping the given map.
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseFPElements(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirOpaqueAttrGet(MlirContext ctx, MlirStringRef dialectNamespace, intptr_t dataLength, const char *data, MlirType type)
Creates an opaque attribute in the given context associated with the dialect identified by its namesp...
MLIR_CAPI_EXPORTED MlirAttribute mlirFloatAttrDoubleGetChecked(MlirLocation loc, MlirType type, double value)
Same as "mlirFloatAttrDoubleGet", but if the type is not valid for a construction of a FloatAttr,...
MLIR_CAPI_EXPORTED int16_t mlirDenseI16ArrayGetElement(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED bool mlirAttributeIsAStridedLayout(MlirAttribute attr)
MLIR_CAPI_EXPORTED uint8_t mlirDenseElementsAttrGetUInt8Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED int64_t mlirStridedLayoutAttrGetOffset(MlirAttribute attr)
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseI64Array(MlirAttribute attr)
MLIR_CAPI_EXPORTED uint64_t mlirDenseElementsAttrGetUInt64SplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr)
Returns the affine map wrapped in the given affine map attribute.
MLIR_CAPI_EXPORTED int64_t mlirStridedLayoutAttrGetStride(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirSparseElementsAttrGetValues(MlirAttribute attr)
Returns the dense elements attribute containing the non-null elements in the given sparse elements at...
MLIR_CAPI_EXPORTED MlirStringRef mlirStridedLayoutAttrGetName(void)
MLIR_CAPI_EXPORTED MlirStringRef mlirTypeAttrGetName(void)
MLIR_CAPI_EXPORTED MlirStringRef mlirIntegerAttrGetName(void)
MLIR_CAPI_EXPORTED int8_t mlirDenseElementsAttrGetInt8Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirStridedLayoutAttrGet(MlirContext ctx, int64_t offset, intptr_t numStrides, const int64_t *strides)
MLIR_CAPI_EXPORTED int32_t mlirDenseInt32ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt8ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int8_t *elements)
MLIR_CAPI_EXPORTED bool mlirDenseBoolResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
Returns the pos-th value (flat contiguous indexing) of a specific type contained by the given dense r...
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrStringGet(MlirType shapedType, intptr_t numElements, MlirStringRef *strs)
Creates a dense elements attribute with the given shaped type from string elements.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrInt64SplatGet(MlirType shapedType, int64_t element)
MLIR_CAPI_EXPORTED MlirTypeID mlirStringAttrGetTypeID(void)
Returns the typeID of a String attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAUnit(MlirAttribute attr)
Checks whether the given attribute is a unit attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseElements(MlirAttribute attr)
Checks whether the given attribute is a dense elements attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAIntegerSet(MlirAttribute attr)
Checks whether the given attribute is an integer set attribute.
MLIR_CAPI_EXPORTED MlirStringRef mlirIntegerSetAttrGetName(void)
MLIR_CAPI_EXPORTED bool mlirAttributeIsAAffineMap(MlirAttribute attr)
Checks whether the given attribute is an affine map attribute.
MLIR_CAPI_EXPORTED int32_t mlirDenseI32ArrayGetElement(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED double mlirDenseF64ArrayGetElement(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirStringRef mlirUnitAttrGetName(void)
MLIR_CAPI_EXPORTED MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol)
Creates a flat symbol reference attribute in the given context referencing a symbol identified by the...
MLIR_CAPI_EXPORTED MlirTypeID mlirStridedLayoutAttrGetTypeID(void)
Returns the typeID of a StridedLayout attribute.
MLIR_CAPI_EXPORTED uint64_t mlirDenseElementsAttrGetIndexValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED const void * mlirDenseElementsAttrGetRawData(MlirAttribute attr)
Returns the raw data of the given dense elements attribute.
MLIR_CAPI_EXPORTED MlirTypeID mlirIntegerAttrGetTypeID(void)
Returns the typeID of an Integer attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt8ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint8_t *elements)
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseResourceElements(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt8SplatGet(MlirType shapedType, uint8_t element)
MLIR_CAPI_EXPORTED int16_t mlirDenseElementsAttrGetInt16Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrFloatSplatGet(MlirType shapedType, float element)
MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolRefAttrGetRootReference(MlirAttribute attr)
Returns the string reference to the root referenced symbol.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrReshapeGet(MlirAttribute attr, MlirType shapedType)
Creates a dense elements attribute that has the same data as the given dense elements attribute and a...
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrInt8SplatGet(MlirType shapedType, int8_t element)
MLIR_CAPI_EXPORTED bool mlirAttributeIsAType(MlirAttribute attr)
Checks whether the given attribute is a type attribute.
MLIR_CAPI_EXPORTED MlirTypeID mlirDenseIntOrFPElementsAttrGetTypeID(void)
Returns the typeID of an DenseIntOrFPElements attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseIntElements(MlirAttribute attr)
MLIR_CAPI_EXPORTED bool mlirAttributeIsAArray(MlirAttribute attr)
Checks whether the given attribute is an array attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrInt32Get(MlirType shapedType, intptr_t numElements, const int32_t *elements)
MLIR_CAPI_EXPORTED bool mlirAttributeIsAInteger(MlirAttribute attr)
Checks whether the given attribute is an integer attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirElementsAttrGetValue(MlirAttribute attr, intptr_t rank, uint64_t *idxs)
Returns the element at the given rank-dimensional index.
MLIR_CAPI_EXPORTED intptr_t mlirDictionaryAttrGetNumElements(MlirAttribute attr)
Returns the number of attributes contained in a dictionary attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerSetAttrGet(MlirIntegerSet set)
Creates an integer set attribute wrapping the given set.
MLIR_CAPI_EXPORTED MlirStringRef mlirArrayAttrGetName(void)
MLIR_CAPI_EXPORTED bool mlirAttributeIsALocation(MlirAttribute attr)
MLIR_CAPI_EXPORTED int8_t mlirDenseInt8ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirStringRef mlirDictionaryAttrGetName(void)
MLIR_CAPI_EXPORTED uint16_t mlirDenseElementsAttrGetUInt16Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrInt16Get(MlirType shapedType, intptr_t numElements, const int16_t *elements)
MLIR_CAPI_EXPORTED uint64_t mlirDenseElementsAttrGetUInt64Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED bool mlirBoolAttrGetValue(MlirAttribute attr)
Returns the value stored in the given bool attribute.
MLIR_CAPI_EXPORTED double mlirDenseDoubleResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt16Get(MlirType shapedType, intptr_t numElements, const uint16_t *elements)
MLIR_CAPI_EXPORTED MlirAttribute mlirDisctinctAttrCreate(MlirAttribute referencedAttr)
Creates a DisctinctAttr with the referenced attribute.
MLIR_CAPI_EXPORTED int64_t mlirDenseI64ArrayGetElement(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerAttrGet(MlirType type, int64_t value)
Creates an integer attribute of the given type with the given integer value.
MLIR_CAPI_EXPORTED MlirTypeID mlirIntegerSetAttrGetTypeID(void)
Returns the typeID of an IntegerSet attribute.
MLIR_CAPI_EXPORTED bool mlirDenseElementsAttrGetBoolValue(MlirAttribute attr, intptr_t pos)
Returns the pos-th value (flat contiguous indexing) of a specific type contained by the given dense e...
MLIR_CAPI_EXPORTED MlirStringRef mlirDenseElementsAttrGetStringValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDictionaryAttrGet(MlirContext ctx, intptr_t numElements, MlirNamedAttribute const *elements)
Creates a dictionary attribute containing the given list of elements in the provided context.
MLIR_CAPI_EXPORTED uint64_t mlirDenseUInt64ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED int8_t mlirDenseElementsAttrGetInt8SplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt32Get(MlirType shapedType, intptr_t numElements, const uint32_t *elements)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, void *data, size_t dataLength, size_t dataAlignment, bool dataIsMutable, void(*deleter)(void *userData, const void *data, size_t size, size_t align), void *userData)
Unlike the typed accessors below, constructs the attribute with a raw data buffer and no type/alignme...
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrFloat16Get(MlirType shapedType, intptr_t numElements, const uint16_t *elements)
MLIR_CAPI_EXPORTED MlirIntegerSet mlirIntegerSetAttrGetValue(MlirAttribute attr)
Returns the integer set wrapped in the given integer set attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsABool(MlirAttribute attr)
Checks whether the given attribute is a bool attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsASparseElements(MlirAttribute attr)
Checks whether the given attribute is a sparse elements attribute.
MLIR_CAPI_EXPORTED bool mlirDenseBoolArrayGetElement(MlirAttribute attr, intptr_t pos)
Get an element of a dense array.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI64ArrayGet(MlirContext ctx, intptr_t size, int64_t const *values)
MLIR_CAPI_EXPORTED MlirTypeID mlirAffineMapAttrGetTypeID(void)
Returns the typeID of an AffineMap attribute.
MLIR_CAPI_EXPORTED MlirTypeID mlirSparseElementsAttrGetTypeID(void)
Returns the typeID of a SparseElements attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirSymbolRefAttrGetNestedReference(MlirAttribute attr, intptr_t pos)
Returns pos-th reference nested in the given symbol reference attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrBFloat16Get(MlirType shapedType, intptr_t numElements, const uint16_t *elements)
MLIR_CAPI_EXPORTED MlirTypeID mlirArrayAttrGetTypeID(void)
Returns the typeID of an Array attribute.
MLIR_CAPI_EXPORTED float mlirDenseF32ArrayGetElement(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseF64ArrayGet(MlirContext ctx, intptr_t size, double const *values)
MLIR_CAPI_EXPORTED MlirAttribute mlirSparseElementsAttribute(MlirType shapedType, MlirAttribute denseIndices, MlirAttribute denseValues)
Creates a sparse elements attribute of the given shape from a list of indices and a list of associate...
MLIR_CAPI_EXPORTED int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr)
Returns the value stored in the given integer attribute, assuming the value is of signless type and f...
MLIR_CAPI_EXPORTED intptr_t mlirSymbolRefAttrGetNumNestedReferences(MlirAttribute attr)
Returns the number of references nested in the given symbol reference attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrInt64Get(MlirType shapedType, intptr_t numElements, const int64_t *elements)
MLIR_CAPI_EXPORTED MlirType mlirTypeAttrGetValue(MlirAttribute attr)
Returns the type stored in the given type attribute.
MLIR_CAPI_EXPORTED MlirStringRef mlirFloatAttrGetName(void)
MLIR_CAPI_EXPORTED bool mlirDenseElementsAttrIsSplat(MlirAttribute attr)
Checks whether the given dense elements attribute contains a single replicated value (splat).
MLIR_CAPI_EXPORTED MlirStringRef mlirFlatSymbolRefAttrGetName(void)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrGet(MlirType shapedType, intptr_t numElements, MlirAttribute const *elements)
Creates a dense elements attribute with the given Shaped type and elements in the same context as the...
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseBoolArray(MlirAttribute attr)
Checks whether the given attribute is a dense array attribute.
MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueAttrGetData(MlirAttribute attr)
Returns the raw data as a string reference.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt16ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint16_t *elements)
MLIR_CAPI_EXPORTED uint8_t mlirDenseElementsAttrGetUInt8SplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED double mlirDenseElementsAttrGetDoubleSplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirAttributeGetNull(void)
Returns an empty attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirBoolAttrGet(MlirContext ctx, int value)
Creates a bool attribute in the given context with the given value.
MLIR_CAPI_EXPORTED MlirTypeID mlirFloatAttrGetTypeID(void)
Returns the typeID of a Float attribute.
MLIR_CAPI_EXPORTED int64_t mlirIntegerAttrGetValueSInt(MlirAttribute attr)
Returns the value stored in the given integer attribute, assuming the value is of signed type and fit...
MLIR_CAPI_EXPORTED int8_t mlirDenseI8ArrayGetElement(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt32SplatGet(MlirType shapedType, uint32_t element)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI32ArrayGet(MlirContext ctx, intptr_t size, int32_t const *values)
MLIR_CAPI_EXPORTED int64_t mlirDenseElementsAttrGetInt64Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirNamedAttribute mlirDictionaryAttrGetElement(MlirAttribute attr, intptr_t pos)
Returns pos-th element of the given dictionary attribute.
MLIR_CAPI_EXPORTED MlirTypeID mlirUnitAttrGetTypeID(void)
Returns the typeID of a Unit attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseF32ArrayGet(MlirContext ctx, intptr_t size, float const *values)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseBoolArrayGet(MlirContext ctx, intptr_t size, int const *values)
Create a dense array attribute with the given elements.
MLIR_CAPI_EXPORTED MlirAttribute mlirSparseElementsAttrGetIndices(MlirAttribute attr)
Returns the dense elements attribute containing 64-bit integer indices of non-null elements in the gi...
MLIR_CAPI_EXPORTED bool mlirAttributeIsAOpaque(MlirAttribute attr)
Checks whether the given attribute is an opaque attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirArrayAttrGetElement(MlirAttribute attr, intptr_t pos)
Returns pos-th element stored in the given array attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirDictionaryAttrGetElementByName(MlirAttribute attr, MlirStringRef name)
Returns the dictionary attribute element with the given name or NULL if the given name does not exist...
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrDoubleSplatGet(MlirType shapedType, double element)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt64ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint64_t *elements)
MLIR_CAPI_EXPORTED MlirStringRef mlirAffineMapAttrGetName(void)
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseF32Array(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirTypeID mlirSymbolRefAttrGetTypeID(void)
Returns the typeID of an SymbolRef attribute.
MLIR_CAPI_EXPORTED MlirTypeID mlirDenseArrayAttrGetTypeID(void)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrGetSplatValue(MlirAttribute attr)
Returns the single replicated value (splat) of a specific type contained by the given dense elements ...
MLIR_CAPI_EXPORTED bool mlirAttributeIsASymbolRef(MlirAttribute attr)
Checks whether the given attribute is a symbol reference attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt8Get(MlirType shapedType, intptr_t numElements, const uint8_t *elements)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt16ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int16_t *elements)
MLIR_CAPI_EXPORTED float mlirDenseElementsAttrGetFloatValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED bool mlirAttributeIsAString(MlirAttribute attr)
Checks whether the given attribute is a string attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt32ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int32_t *elements)
MLIR_CAPI_EXPORTED int64_t mlirElementsAttrGetNumElements(MlirAttribute attr)
Gets the total number of elements in the given elements attribute.
MLIR_CAPI_EXPORTED int16_t mlirDenseInt16ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrInt8Get(MlirType shapedType, intptr_t numElements, const int8_t *elements)
MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr)
Returns the namespace of the dialect with which the given opaque attribute is associated.
MLIR_CAPI_EXPORTED bool mlirAttributeIsADictionary(MlirAttribute attr)
Checks whether the given attribute is a dictionary attribute.
MLIR_CAPI_EXPORTED int32_t mlirDenseElementsAttrGetInt32Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirStringRef mlirStringAttrGetValue(MlirAttribute attr)
Returns the attribute values as a string reference.
MLIR_CAPI_EXPORTED uint32_t mlirDenseUInt32ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED uint16_t mlirDenseUInt16ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrBoolGet(MlirType shapedType, intptr_t numElements, const int *elements)
Creates a dense elements attribute with the given shaped type from elements of a specific type.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI16ArrayGet(MlirContext ctx, intptr_t size, int16_t const *values)
MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueAttrGetName(void)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrInt32SplatGet(MlirType shapedType, int32_t element)
MLIR_CAPI_EXPORTED uint32_t mlirDenseElementsAttrGetUInt32SplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirStringRef mlirDenseElementsAttrGetStringSplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirTypeID mlirOpaqueAttrGetTypeID(void)
Returns the typeID of an Opaque attribute.
MLIR_CAPI_EXPORTED int64_t mlirDenseInt64ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED double mlirFloatAttrGetValueDouble(MlirAttribute attr)
Returns the value stored in the given floating point attribute, interpreting the value as double.
MLIR_CAPI_EXPORTED uint64_t mlirIntegerAttrGetValueUInt(MlirAttribute attr)
Returns the value stored in the given integer attribute, assuming the value is of unsigned type and f...
MLIR_CAPI_EXPORTED uint8_t mlirDenseUInt8ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrFloatGet(MlirType shapedType, intptr_t numElements, const float *elements)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt64Get(MlirType shapedType, intptr_t numElements, const uint64_t *elements)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI8ArrayGet(MlirContext ctx, intptr_t size, int8_t const *values)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnitAttrGet(MlirContext ctx)
Creates a unit attribute in the given context.
MLIR_CAPI_EXPORTED double mlirDenseElementsAttrGetDoubleValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseFloatResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const float *elements)
MLIR_CAPI_EXPORTED MlirStringRef mlirDenseResourceElementsAttrGetName(void)
MLIR_CAPI_EXPORTED intptr_t mlirStridedLayoutAttrGetNumStrides(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseBoolResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int *elements)
MLIR_CAPI_EXPORTED MlirAttribute mlirFloatAttrDoubleGet(MlirContext ctx, MlirType type, double value)
Creates a floating point attribute in the given context with the given double value and double-precis...
MLIR_CAPI_EXPORTED int64_t mlirDenseElementsAttrGetInt64SplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements, MlirAttribute const *elements)
Creates an array element containing the given list of elements in the given context.
MLIR_CAPI_EXPORTED intptr_t mlirDenseArrayGetNumElements(MlirAttribute attr)
Get the size of a dense array.
MLIR_CAPI_EXPORTED MlirStringRef mlirStringAttrGetName(void)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrBoolSplatGet(MlirType shapedType, bool element)
MLIR_CAPI_EXPORTED bool mlirElementsAttrIsValidIndex(MlirAttribute attr, intptr_t rank, uint64_t *idxs)
Checks whether the given rank-dimensional index is valid in the given elements attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAFloat(MlirAttribute attr)
Checks whether the given attribute is a floating point attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol, intptr_t numReferences, MlirAttribute const *references)
Creates a symbol reference attribute in the given context referencing a symbol identified by the give...
MLIR_CAPI_EXPORTED int32_t mlirDenseElementsAttrGetInt32SplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirTypeID mlirTypeAttrGetTypeID(void)
Returns the typeID of a Type attribute.
MLIR_CAPI_EXPORTED float mlirDenseFloatResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrSplatGet(MlirType shapedType, MlirAttribute element)
Creates a dense elements attribute with the given Shaped type containing a single replicated element ...
MLIR_CAPI_EXPORTED MlirTypeID mlirDictionaryAttrGetTypeID(void)
Returns the typeID of a Dictionary attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAElements(MlirAttribute attr)
Checks whether the given attribute is an elements attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrGet(MlirContext ctx, MlirStringRef str)
Creates a string attribute in the given context containing the given string.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt64SplatGet(MlirType shapedType, uint64_t element)
MLIR_CAPI_EXPORTED MlirAttribute mlirTypeAttrGet(MlirType type)
Creates a type attribute wrapping the given type in the same context as the type.
MLIR_CAPI_EXPORTED intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr)
Returns the number of elements stored in the given array attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrRawBufferGet(MlirType shapedType, size_t rawBufferSize, const void *rawBuffer)
Creates a dense elements attribute with the given Shaped type and elements populated from a packed,...
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt64ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int64_t *elements)
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseI32Array(MlirAttribute attr)
MLIR_CAPI_EXPORTED int mlirDenseElementsAttrGetBoolSplatValue(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseDoubleResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const double *elements)
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseI8Array(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrTypedGet(MlirType type, MlirStringRef str)
Creates a string attribute in the given context containing the given string.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAFlatSymbolRef(MlirAttribute attr)
Checks whether the given attribute is a flat symbol reference attribute.
MLIR_CAPI_EXPORTED MlirStringRef mlirFlatSymbolRefAttrGetValue(MlirAttribute attr)
Returns the referenced symbol as a string reference.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt32ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint32_t *elements)
MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolRefAttrGetLeafReference(MlirAttribute attr)
Returns the string reference to the leaf referenced symbol.
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseI16Array(MlirAttribute attr)
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrDoubleGet(MlirType shapedType, intptr_t numElements, const double *elements)
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseF64Array(MlirAttribute attr)
MLIR_CAPI_EXPORTED uint32_t mlirDenseElementsAttrGetUInt32Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolRefAttrGetName(void)
MLIR_CAPI_EXPORTED float mlirDenseElementsAttrGetFloatSplatValue(MlirAttribute attr)
#define MLIR_CAPI_EXPORTED
Definition Support.h:46
Named MLIR attribute.
Definition IR.h:76
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition Support.h:75