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 bit width of the integer attribute's underlying APInt value.
169/// This is useful for determining the size of the integer, especially for
170/// values larger than 64 bits.
171MLIR_CAPI_EXPORTED unsigned mlirIntegerAttrGetValueBitWidth(MlirAttribute attr);
172
173/// Returns the number of 64-bit words that make up the integer attribute's
174/// underlying APInt value. For integers <= 64 bits, this returns 1.
175MLIR_CAPI_EXPORTED unsigned mlirIntegerAttrGetValueNumWords(MlirAttribute attr);
176
177/// Copies the 64-bit words making up the integer attribute's APInt value into
178/// the provided buffer. The buffer must have space for at least
179/// mlirIntegerAttrGetValueNumWords(attr) elements. Words are stored in
180/// little-endian order (least significant word first). The sign information
181/// is not encoded in the words themselves; use the type's signedness to
182/// interpret the value correctly.
184 uint64_t *words);
185
186/// Creates an integer attribute of the given type from an array of 64-bit
187/// words. This is useful for creating integer attributes with values with
188/// widths larger than 64 bits. Words are in little-endian order (least
189/// significant word first). The number of words must match the bit width of the
190/// type: numWords = ceil(bitWidth / 64).
192 MlirType type, unsigned numWords, const uint64_t *words);
193
194/// Returns the typeID of an Integer attribute.
196
197//===----------------------------------------------------------------------===//
198// Bool attribute.
199//===----------------------------------------------------------------------===//
200
201/// Checks whether the given attribute is a bool attribute.
202MLIR_CAPI_EXPORTED bool mlirAttributeIsABool(MlirAttribute attr);
203
204/// Creates a bool attribute in the given context with the given value.
205MLIR_CAPI_EXPORTED MlirAttribute mlirBoolAttrGet(MlirContext ctx, int value);
206
207/// Returns the value stored in the given bool attribute.
208MLIR_CAPI_EXPORTED bool mlirBoolAttrGetValue(MlirAttribute attr);
209
210//===----------------------------------------------------------------------===//
211// Integer set attribute.
212//===----------------------------------------------------------------------===//
213
214/// Checks whether the given attribute is an integer set attribute.
215MLIR_CAPI_EXPORTED bool mlirAttributeIsAIntegerSet(MlirAttribute attr);
216
217/// Creates an integer set attribute wrapping the given set. The attribute
218/// belongs to the same context as the integer set.
219MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerSetAttrGet(MlirIntegerSet set);
220
222
223/// Returns the integer set wrapped in the given integer set attribute.
224MLIR_CAPI_EXPORTED MlirIntegerSet
225mlirIntegerSetAttrGetValue(MlirAttribute attr);
226
227/// Returns the typeID of an IntegerSet attribute.
229
230//===----------------------------------------------------------------------===//
231// Opaque attribute.
232//===----------------------------------------------------------------------===//
233
234/// Checks whether the given attribute is an opaque attribute.
235MLIR_CAPI_EXPORTED bool mlirAttributeIsAOpaque(MlirAttribute attr);
236
237/// Creates an opaque attribute in the given context associated with the dialect
238/// identified by its namespace. The attribute contains opaque byte data of the
239/// specified length (data need not be null-terminated).
240MLIR_CAPI_EXPORTED MlirAttribute
241mlirOpaqueAttrGet(MlirContext ctx, MlirStringRef dialectNamespace,
242 intptr_t dataLength, const char *data, MlirType type);
243
245
246/// Returns the namespace of the dialect with which the given opaque attribute
247/// is associated. The namespace string is owned by the context.
249mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr);
250
251/// Returns the raw data as a string reference. The data remains live as long as
252/// the context in which the attribute lives.
254
255/// Returns the typeID of an Opaque attribute.
257
258//===----------------------------------------------------------------------===//
259// String attribute.
260//===----------------------------------------------------------------------===//
261
262/// Checks whether the given attribute is a string attribute.
263MLIR_CAPI_EXPORTED bool mlirAttributeIsAString(MlirAttribute attr);
264
265/// Creates a string attribute in the given context containing the given string.
266
267MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrGet(MlirContext ctx,
268 MlirStringRef str);
269
271
272/// Creates a string attribute in the given context containing the given string.
273/// Additionally, the attribute has the given type.
274MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrTypedGet(MlirType type,
275 MlirStringRef str);
276
277/// Returns the attribute values as a string reference. The data remains live as
278/// long as the context in which the attribute lives.
280
281/// Returns the typeID of a String attribute.
283
284//===----------------------------------------------------------------------===//
285// SymbolRef attribute.
286//===----------------------------------------------------------------------===//
287
288/// Checks whether the given attribute is a symbol reference attribute.
289MLIR_CAPI_EXPORTED bool mlirAttributeIsASymbolRef(MlirAttribute attr);
290
291/// Creates a symbol reference attribute in the given context referencing a
292/// symbol identified by the given string inside a list of nested references.
293/// Each of the references in the list must not be nested.
294MLIR_CAPI_EXPORTED MlirAttribute
295mlirSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol,
296 intptr_t numReferences, MlirAttribute const *references);
297
299
300/// Returns the string reference to the root referenced symbol. The data remains
301/// live as long as the context in which the attribute lives.
303mlirSymbolRefAttrGetRootReference(MlirAttribute attr);
304
305/// Returns the string reference to the leaf referenced symbol. The data remains
306/// live as long as the context in which the attribute lives.
308mlirSymbolRefAttrGetLeafReference(MlirAttribute attr);
309
310/// Returns the number of references nested in the given symbol reference
311/// attribute.
314
315/// Returns pos-th reference nested in the given symbol reference attribute.
316MLIR_CAPI_EXPORTED MlirAttribute
317mlirSymbolRefAttrGetNestedReference(MlirAttribute attr, intptr_t pos);
318
319/// Returns the typeID of an SymbolRef attribute.
321
322/// Creates a DisctinctAttr with the referenced attribute.
323MLIR_CAPI_EXPORTED MlirAttribute
324mlirDisctinctAttrCreate(MlirAttribute referencedAttr);
325
326//===----------------------------------------------------------------------===//
327// Flat SymbolRef attribute.
328//===----------------------------------------------------------------------===//
329
330/// Checks whether the given attribute is a flat symbol reference attribute.
332
333/// Creates a flat symbol reference attribute in the given context referencing a
334/// symbol identified by the given string.
335MLIR_CAPI_EXPORTED MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx,
336 MlirStringRef symbol);
337
339
340/// Returns the referenced symbol as a string reference. The data remains live
341/// as long as the context in which the attribute lives.
343mlirFlatSymbolRefAttrGetValue(MlirAttribute attr);
344
345//===----------------------------------------------------------------------===//
346// Type attribute.
347//===----------------------------------------------------------------------===//
348
349/// Checks whether the given attribute is a type attribute.
350MLIR_CAPI_EXPORTED bool mlirAttributeIsAType(MlirAttribute attr);
351
352/// Creates a type attribute wrapping the given type in the same context as the
353/// type.
354MLIR_CAPI_EXPORTED MlirAttribute mlirTypeAttrGet(MlirType type);
355
357
358/// Returns the type stored in the given type attribute.
359MLIR_CAPI_EXPORTED MlirType mlirTypeAttrGetValue(MlirAttribute attr);
360
361/// Returns the typeID of a Type attribute.
363
364//===----------------------------------------------------------------------===//
365// Unit attribute.
366//===----------------------------------------------------------------------===//
367
368/// Checks whether the given attribute is a unit attribute.
369MLIR_CAPI_EXPORTED bool mlirAttributeIsAUnit(MlirAttribute attr);
370
371/// Creates a unit attribute in the given context.
372MLIR_CAPI_EXPORTED MlirAttribute mlirUnitAttrGet(MlirContext ctx);
373
375
376/// Returns the typeID of a Unit attribute.
378
379//===----------------------------------------------------------------------===//
380// Elements attributes.
381//===----------------------------------------------------------------------===//
382
383/// Checks whether the given attribute is an elements attribute.
384MLIR_CAPI_EXPORTED bool mlirAttributeIsAElements(MlirAttribute attr);
385
386/// Returns the element at the given rank-dimensional index.
387MLIR_CAPI_EXPORTED MlirAttribute mlirElementsAttrGetValue(MlirAttribute attr,
388 intptr_t rank,
389 uint64_t *idxs);
390
391/// Checks whether the given rank-dimensional index is valid in the given
392/// elements attribute.
394mlirElementsAttrIsValidIndex(MlirAttribute attr, intptr_t rank, uint64_t *idxs);
395
396/// Gets the total number of elements in the given elements attribute. In order
397/// to iterate over the attribute, obtain its type, which must be a statically
398/// shaped type and use its sizes to build a multi-dimensional index.
400
401//===----------------------------------------------------------------------===//
402// Dense array attribute.
403//===----------------------------------------------------------------------===//
404
406
407/// Checks whether the given attribute is a dense array attribute.
409MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseI8Array(MlirAttribute attr);
415
416/// Create a dense array attribute with the given elements.
417MLIR_CAPI_EXPORTED MlirAttribute mlirDenseBoolArrayGet(MlirContext ctx,
418 intptr_t size,
419 int const *values);
420MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI8ArrayGet(MlirContext ctx,
421 intptr_t size,
422 int8_t const *values);
423MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI16ArrayGet(MlirContext ctx,
424 intptr_t size,
425 int16_t const *values);
426MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI32ArrayGet(MlirContext ctx,
427 intptr_t size,
428 int32_t const *values);
429MLIR_CAPI_EXPORTED MlirAttribute mlirDenseI64ArrayGet(MlirContext ctx,
430 intptr_t size,
431 int64_t const *values);
432MLIR_CAPI_EXPORTED MlirAttribute mlirDenseF32ArrayGet(MlirContext ctx,
433 intptr_t size,
434 float const *values);
435MLIR_CAPI_EXPORTED MlirAttribute mlirDenseF64ArrayGet(MlirContext ctx,
436 intptr_t size,
437 double const *values);
438
439/// Get the size of a dense array.
441
442/// Get an element of a dense array.
444 intptr_t pos);
445MLIR_CAPI_EXPORTED int8_t mlirDenseI8ArrayGetElement(MlirAttribute attr,
446 intptr_t pos);
447MLIR_CAPI_EXPORTED int16_t mlirDenseI16ArrayGetElement(MlirAttribute attr,
448 intptr_t pos);
449MLIR_CAPI_EXPORTED int32_t mlirDenseI32ArrayGetElement(MlirAttribute attr,
450 intptr_t pos);
452 intptr_t pos);
453MLIR_CAPI_EXPORTED float mlirDenseF32ArrayGetElement(MlirAttribute attr,
454 intptr_t pos);
455MLIR_CAPI_EXPORTED double mlirDenseF64ArrayGetElement(MlirAttribute attr,
456 intptr_t pos);
457
458//===----------------------------------------------------------------------===//
459// Dense elements attribute.
460//===----------------------------------------------------------------------===//
461
462// TODO: decide on the interface and add support for complex elements.
463// TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
464// relevant functions here.
465
466/// Checks whether the given attribute is a dense elements attribute.
470
471/// Returns the typeID of an DenseIntOrFPElements attribute.
473
474/// Creates a dense elements attribute with the given Shaped type and elements
475/// in the same context as the type.
477 MlirType shapedType, intptr_t numElements, MlirAttribute const *elements);
478
479/// Creates a dense elements attribute with the given Shaped type and elements
480/// populated from a packed, row-major opaque buffer of contents.
481///
482/// The format of the raw buffer is a densely packed array of values that
483/// can be bitcast to the storage format of the element type specified.
484/// Types that are not byte aligned will be:
485/// - For bitwidth > 1: Rounded up to the next byte.
486/// - For bitwidth = 1: Packed into 8bit bytes with bits corresponding to
487/// the linear order of the shape type from MSB to LSB, padded to on the
488/// right.
489///
490/// A raw buffer of a single element (or for 1-bit, a byte of value 0 or 255)
491/// will be interpreted as a splat. User code should be prepared for additional,
492/// conformant patterns to be identified as splats in the future.
494 MlirType shapedType, size_t rawBufferSize, const void *rawBuffer);
495
496/// Creates a dense elements attribute with the given Shaped type containing a
497/// single replicated element (splat).
498MLIR_CAPI_EXPORTED MlirAttribute
499mlirDenseElementsAttrSplatGet(MlirType shapedType, MlirAttribute element);
500MLIR_CAPI_EXPORTED MlirAttribute
501mlirDenseElementsAttrBoolSplatGet(MlirType shapedType, bool element);
502MLIR_CAPI_EXPORTED MlirAttribute
503mlirDenseElementsAttrUInt8SplatGet(MlirType shapedType, uint8_t element);
504MLIR_CAPI_EXPORTED MlirAttribute
505mlirDenseElementsAttrInt8SplatGet(MlirType shapedType, int8_t element);
506MLIR_CAPI_EXPORTED MlirAttribute
507mlirDenseElementsAttrUInt32SplatGet(MlirType shapedType, uint32_t element);
508MLIR_CAPI_EXPORTED MlirAttribute
509mlirDenseElementsAttrInt32SplatGet(MlirType shapedType, int32_t element);
510MLIR_CAPI_EXPORTED MlirAttribute
511mlirDenseElementsAttrUInt64SplatGet(MlirType shapedType, uint64_t element);
512MLIR_CAPI_EXPORTED MlirAttribute
513mlirDenseElementsAttrInt64SplatGet(MlirType shapedType, int64_t element);
514MLIR_CAPI_EXPORTED MlirAttribute
515mlirDenseElementsAttrFloatSplatGet(MlirType shapedType, float element);
516MLIR_CAPI_EXPORTED MlirAttribute
517mlirDenseElementsAttrDoubleSplatGet(MlirType shapedType, double element);
518
519/// Creates a dense elements attribute with the given shaped type from elements
520/// of a specific type. Expects the element type of the shaped type to match the
521/// data element type.
523 MlirType shapedType, intptr_t numElements, const int *elements);
525 MlirType shapedType, intptr_t numElements, const uint8_t *elements);
527 MlirType shapedType, intptr_t numElements, const int8_t *elements);
529 MlirType shapedType, intptr_t numElements, const uint16_t *elements);
531 MlirType shapedType, intptr_t numElements, const int16_t *elements);
533 MlirType shapedType, intptr_t numElements, const uint32_t *elements);
535 MlirType shapedType, intptr_t numElements, const int32_t *elements);
537 MlirType shapedType, intptr_t numElements, const uint64_t *elements);
539 MlirType shapedType, intptr_t numElements, const int64_t *elements);
541 MlirType shapedType, intptr_t numElements, const float *elements);
543 MlirType shapedType, intptr_t numElements, const double *elements);
545 MlirType shapedType, intptr_t numElements, const uint16_t *elements);
547 MlirType shapedType, intptr_t numElements, const uint16_t *elements);
548
549/// Creates a dense elements attribute with the given shaped type from string
550/// elements.
552 MlirType shapedType, intptr_t numElements, MlirStringRef *strs);
553
554/// Creates a dense elements attribute that has the same data as the given dense
555/// elements attribute and a different shaped type. The new type must have the
556/// same total number of elements.
557MLIR_CAPI_EXPORTED MlirAttribute
558mlirDenseElementsAttrReshapeGet(MlirAttribute attr, MlirType shapedType);
559
560/// Checks whether the given dense elements attribute contains a single
561/// replicated value (splat).
562MLIR_CAPI_EXPORTED bool mlirDenseElementsAttrIsSplat(MlirAttribute attr);
563
564/// Returns the single replicated value (splat) of a specific type contained by
565/// the given dense elements attribute.
566MLIR_CAPI_EXPORTED MlirAttribute
567mlirDenseElementsAttrGetSplatValue(MlirAttribute attr);
572MLIR_CAPI_EXPORTED uint8_t
574MLIR_CAPI_EXPORTED int32_t
576MLIR_CAPI_EXPORTED uint32_t
580MLIR_CAPI_EXPORTED uint64_t
588
589/// Returns the pos-th value (flat contiguous indexing) of a specific type
590/// contained by the given dense elements attribute.
592 intptr_t pos);
594 intptr_t pos);
595MLIR_CAPI_EXPORTED uint8_t
596mlirDenseElementsAttrGetUInt8Value(MlirAttribute attr, intptr_t pos);
597MLIR_CAPI_EXPORTED int16_t
598mlirDenseElementsAttrGetInt16Value(MlirAttribute attr, intptr_t pos);
599MLIR_CAPI_EXPORTED uint16_t
600mlirDenseElementsAttrGetUInt16Value(MlirAttribute attr, intptr_t pos);
601MLIR_CAPI_EXPORTED int32_t
602mlirDenseElementsAttrGetInt32Value(MlirAttribute attr, intptr_t pos);
603MLIR_CAPI_EXPORTED uint32_t
604mlirDenseElementsAttrGetUInt32Value(MlirAttribute attr, intptr_t pos);
606mlirDenseElementsAttrGetInt64Value(MlirAttribute attr, intptr_t pos);
607MLIR_CAPI_EXPORTED uint64_t
608mlirDenseElementsAttrGetUInt64Value(MlirAttribute attr, intptr_t pos);
609MLIR_CAPI_EXPORTED uint64_t
610mlirDenseElementsAttrGetIndexValue(MlirAttribute attr, intptr_t pos);
612 intptr_t pos);
614mlirDenseElementsAttrGetDoubleValue(MlirAttribute attr, intptr_t pos);
616mlirDenseElementsAttrGetStringValue(MlirAttribute attr, intptr_t pos);
617
618/// Returns the raw data of the given dense elements attribute.
619MLIR_CAPI_EXPORTED const void *
620mlirDenseElementsAttrGetRawData(MlirAttribute attr);
621
622//===----------------------------------------------------------------------===//
623// Resource blob attributes.
624//===----------------------------------------------------------------------===//
625
627mlirAttributeIsADenseResourceElements(MlirAttribute attr);
628
629/// Unlike the typed accessors below, constructs the attribute with a raw
630/// data buffer and no type/alignment checking. Use a more strongly typed
631/// accessor if possible. If dataIsMutable is false, then an immutable
632/// AsmResourceBlob will be created and that passed data contents will be
633/// treated as const.
634/// If the deleter is non NULL, then it will be called when the data buffer
635/// can no longer be accessed (passing userData to it).
637 MlirType shapedType, MlirStringRef name, void *data, size_t dataLength,
638 size_t dataAlignment, bool dataIsMutable,
639 void (*deleter)(void *userData, const void *data, size_t size,
640 size_t align),
641 void *userData);
642
644
646 MlirType shapedType, MlirStringRef name, intptr_t numElements,
647 const int *elements);
649 MlirType shapedType, MlirStringRef name, intptr_t numElements,
650 const uint8_t *elements);
652 MlirType shapedType, MlirStringRef name, intptr_t numElements,
653 const int8_t *elements);
654MLIR_CAPI_EXPORTED MlirAttribute
656 MlirStringRef name,
657 intptr_t numElements,
658 const uint16_t *elements);
660 MlirType shapedType, MlirStringRef name, intptr_t numElements,
661 const int16_t *elements);
662MLIR_CAPI_EXPORTED MlirAttribute
664 MlirStringRef name,
665 intptr_t numElements,
666 const uint32_t *elements);
668 MlirType shapedType, MlirStringRef name, intptr_t numElements,
669 const int32_t *elements);
670MLIR_CAPI_EXPORTED MlirAttribute
672 MlirStringRef name,
673 intptr_t numElements,
674 const uint64_t *elements);
676 MlirType shapedType, MlirStringRef name, intptr_t numElements,
677 const int64_t *elements);
679 MlirType shapedType, MlirStringRef name, intptr_t numElements,
680 const float *elements);
681MLIR_CAPI_EXPORTED MlirAttribute
683 MlirStringRef name,
684 intptr_t numElements,
685 const double *elements);
686
687/// Returns the pos-th value (flat contiguous indexing) of a specific type
688/// contained by the given dense resource elements attribute.
693MLIR_CAPI_EXPORTED uint8_t
695MLIR_CAPI_EXPORTED int16_t
697MLIR_CAPI_EXPORTED uint16_t
699MLIR_CAPI_EXPORTED int32_t
701MLIR_CAPI_EXPORTED uint32_t
705MLIR_CAPI_EXPORTED uint64_t
711
712//===----------------------------------------------------------------------===//
713// Sparse elements attribute.
714//===----------------------------------------------------------------------===//
715
716/// Checks whether the given attribute is a sparse elements attribute.
718
719/// Creates a sparse elements attribute of the given shape from a list of
720/// indices and a list of associated values. Both lists are expected to be dense
721/// elements attributes with the same number of elements. The list of indices is
722/// expected to contain 64-bit integers. The attribute is created in the same
723/// context as the type.
725 MlirType shapedType, MlirAttribute denseIndices, MlirAttribute denseValues);
726
727/// Returns the dense elements attribute containing 64-bit integer indices of
728/// non-null elements in the given sparse elements attribute.
729MLIR_CAPI_EXPORTED MlirAttribute
730mlirSparseElementsAttrGetIndices(MlirAttribute attr);
731
732/// Returns the dense elements attribute containing the non-null elements in the
733/// given sparse elements attribute.
734MLIR_CAPI_EXPORTED MlirAttribute
735mlirSparseElementsAttrGetValues(MlirAttribute attr);
736
737/// Returns the typeID of a SparseElements attribute.
739
740//===----------------------------------------------------------------------===//
741// Strided layout attribute.
742//===----------------------------------------------------------------------===//
743
744// Checks wheather the given attribute is a strided layout attribute.
746
747// Creates a strided layout attribute from given strides and offset.
748MLIR_CAPI_EXPORTED MlirAttribute
749mlirStridedLayoutAttrGet(MlirContext ctx, int64_t offset, intptr_t numStrides,
750 const int64_t *strides);
751
753
754// Returns the offset in the given strided layout layout attribute.
756
757// Returns the number of strides in the given strided layout attribute.
759mlirStridedLayoutAttrGetNumStrides(MlirAttribute attr);
760
761// Returns the pos-th stride stored in the given strided layout attribute.
763 intptr_t pos);
764
765/// Returns the typeID of a StridedLayout attribute.
767
768#ifdef __cplusplus
769}
770#endif
771
772#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 unsigned mlirIntegerAttrGetValueNumWords(MlirAttribute attr)
Returns the number of 64-bit words that make up the integer attribute's underlying APInt value.
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 void mlirIntegerAttrGetValueWords(MlirAttribute attr, uint64_t *words)
Copies the 64-bit words making up the integer attribute's APInt value into the provided buffer.
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 unsigned mlirIntegerAttrGetValueBitWidth(MlirAttribute attr)
Returns the bit width of the integer attribute's underlying APInt value.
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 MlirAttribute mlirIntegerAttrGetFromWords(MlirType type, unsigned numWords, const uint64_t *words)
Creates an integer attribute of the given type from an array of 64-bit words.
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:78