28 return llvm::isa<LocationAttr>(
unwrap(attr));
36 return llvm::isa<AffineMapAttr>(
unwrap(attr));
44 return wrap(llvm::cast<AffineMapAttr>(
unwrap(attr)).getValue());
52 return llvm::isa<ArrayAttr>(
unwrap(attr));
56 MlirAttribute
const *elements) {
64 return static_cast<intptr_t
>(llvm::cast<ArrayAttr>(
unwrap(attr)).size());
68 return wrap(llvm::cast<ArrayAttr>(
unwrap(attr)).getValue()[pos]);
76 return llvm::isa<DictionaryAttr>(
unwrap(attr));
82 attributes.reserve(numElements);
83 for (intptr_t i = 0; i < numElements; ++i)
84 attributes.emplace_back(
unwrap(elements[i].name),
85 unwrap(elements[i].attribute));
90 return static_cast<intptr_t
>(llvm::cast<DictionaryAttr>(
unwrap(attr)).size());
110 return llvm::isa<FloatAttr>(
unwrap(attr));
124 return llvm::cast<FloatAttr>(
unwrap(attr)).getValueAsDouble();
132 return llvm::isa<IntegerAttr>(
unwrap(attr));
140 return llvm::cast<IntegerAttr>(
unwrap(attr)).getInt();
144 return llvm::cast<IntegerAttr>(
unwrap(attr)).getSInt();
148 return llvm::cast<IntegerAttr>(
unwrap(attr)).getUInt();
156 return llvm::isa<BoolAttr>(
unwrap(attr));
164 return llvm::cast<BoolAttr>(
unwrap(attr)).getValue();
172 return llvm::isa<IntegerSetAttr>(
unwrap(attr));
180 return llvm::isa<OpaqueAttr>(
unwrap(attr));
184 intptr_t dataLength,
const char *data,
188 StringRef(data, dataLength),
unwrap(type)));
193 llvm::cast<OpaqueAttr>(
unwrap(attr)).getDialectNamespace().strref());
197 return wrap(llvm::cast<OpaqueAttr>(
unwrap(attr)).getAttrData());
205 return llvm::isa<StringAttr>(
unwrap(attr));
217 return wrap(llvm::cast<StringAttr>(
unwrap(attr)).getValue());
225 return llvm::isa<SymbolRefAttr>(
unwrap(attr));
229 intptr_t numReferences,
230 MlirAttribute
const *references) {
232 refs.reserve(numReferences);
233 for (intptr_t i = 0; i < numReferences; ++i)
234 refs.push_back(llvm::cast<FlatSymbolRefAttr>(
unwrap(references[i])));
241 llvm::cast<SymbolRefAttr>(
unwrap(attr)).getRootReference().getValue());
246 llvm::cast<SymbolRefAttr>(
unwrap(attr)).getLeafReference().getValue());
250 return static_cast<intptr_t
>(
251 llvm::cast<SymbolRefAttr>(
unwrap(attr)).getNestedReferences().size());
257 llvm::cast<SymbolRefAttr>(
unwrap(attr)).getNestedReferences()[pos]);
265 return llvm::isa<FlatSymbolRefAttr>(
unwrap(attr));
273 return wrap(llvm::cast<FlatSymbolRefAttr>(
unwrap(attr)).getValue());
281 return llvm::isa<TypeAttr>(
unwrap(attr));
289 return wrap(llvm::cast<TypeAttr>(
unwrap(attr)).getValue());
297 return llvm::isa<UnitAttr>(
unwrap(attr));
309 return llvm::isa<ElementsAttr>(
unwrap(attr));
314 return wrap(llvm::cast<ElementsAttr>(
unwrap(attr))
320 return llvm::cast<ElementsAttr>(
unwrap(attr))
325 return llvm::cast<ElementsAttr>(
unwrap(attr)).getNumElements();
336 return llvm::isa<DenseBoolArrayAttr>(
unwrap(attr));
339 return llvm::isa<DenseI8ArrayAttr>(
unwrap(attr));
342 return llvm::isa<DenseI16ArrayAttr>(
unwrap(attr));
345 return llvm::isa<DenseI32ArrayAttr>(
unwrap(attr));
348 return llvm::isa<DenseI64ArrayAttr>(
unwrap(attr));
351 return llvm::isa<DenseF32ArrayAttr>(
unwrap(attr));
354 return llvm::isa<DenseF64ArrayAttr>(
unwrap(attr));
366 int8_t
const *values) {
371 int16_t
const *values) {
376 int32_t
const *values) {
381 int64_t
const *values) {
386 float const *values) {
391 double const *values) {
400 return llvm::cast<DenseArrayAttr>(
unwrap(attr)).size();
407 return llvm::cast<DenseBoolArrayAttr>(
unwrap(attr))[pos];
410 return llvm::cast<DenseI8ArrayAttr>(
unwrap(attr))[pos];
413 return llvm::cast<DenseI16ArrayAttr>(
unwrap(attr))[pos];
416 return llvm::cast<DenseI32ArrayAttr>(
unwrap(attr))[pos];
419 return llvm::cast<DenseI64ArrayAttr>(
unwrap(attr))[pos];
422 return llvm::cast<DenseF32ArrayAttr>(
unwrap(attr))[pos];
425 return llvm::cast<DenseF64ArrayAttr>(
unwrap(attr))[pos];
436 return llvm::isa<DenseElementsAttr>(
unwrap(attr));
439 return llvm::isa<DenseIntElementsAttr>(
unwrap(attr));
442 return llvm::isa<DenseFPElementsAttr>(
unwrap(attr));
449 intptr_t numElements,
450 MlirAttribute
const *elements) {
454 unwrapList(numElements, elements, attributes)));
458 size_t rawBufferSize,
459 const void *rawBuffer) {
460 auto shapedTypeCpp = llvm::cast<ShapedType>(
unwrap(shapedType));
463 bool isSplat =
false;
471 MlirAttribute element) {
522 intptr_t numElements,
523 const int *elements) {
530 template <
typename T>
532 intptr_t numElements,
539 intptr_t numElements,
540 const uint8_t *elements) {
544 intptr_t numElements,
545 const int8_t *elements) {
549 intptr_t numElements,
550 const uint16_t *elements) {
554 intptr_t numElements,
555 const int16_t *elements) {
559 intptr_t numElements,
560 const uint32_t *elements) {
564 intptr_t numElements,
565 const int32_t *elements) {
569 intptr_t numElements,
570 const uint64_t *elements) {
574 intptr_t numElements,
575 const int64_t *elements) {
579 intptr_t numElements,
580 const float *elements) {
584 intptr_t numElements,
585 const double *elements) {
589 intptr_t numElements,
590 const uint16_t *elements) {
591 size_t bufferSize = numElements * 2;
592 const void *buffer =
static_cast<const void *
>(elements);
596 intptr_t numElements,
597 const uint16_t *elements) {
598 size_t bufferSize = numElements * 2;
599 const void *buffer =
static_cast<const void *
>(elements);
604 intptr_t numElements,
607 values.reserve(numElements);
608 for (intptr_t i = 0; i < numElements; ++i)
609 values.push_back(
unwrap(strs[i]));
616 MlirType shapedType) {
617 return wrap(llvm::cast<DenseElementsAttr>(
unwrap(attr))
618 .reshape(llvm::cast<ShapedType>(
unwrap(shapedType))));
625 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).isSplat();
630 llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<Attribute>());
633 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<
bool>();
636 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<int8_t>();
639 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<uint8_t>();
642 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<int32_t>();
645 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<uint32_t>();
648 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<int64_t>();
651 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<uint64_t>();
654 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<
float>();
657 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<
double>();
661 llvm::cast<DenseElementsAttr>(
unwrap(attr)).getSplatValue<StringRef>());
668 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<
bool>()[pos];
671 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<int8_t>()[pos];
674 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<uint8_t>()[pos];
677 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<int16_t>()[pos];
680 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<uint16_t>()[pos];
683 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<int32_t>()[pos];
686 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<uint32_t>()[pos];
689 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<int64_t>()[pos];
692 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<uint64_t>()[pos];
695 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<
float>()[pos];
698 return llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<
double>()[pos];
703 llvm::cast<DenseElementsAttr>(
unwrap(attr)).getValues<StringRef>()[pos]);
710 return static_cast<const void *
>(
711 llvm::cast<DenseElementsAttr>(
unwrap(attr)).getRawData().data());
718 template <
typename U,
typename T>
720 intptr_t numElements,
const T *elements) {
727 MlirType shapedType,
MlirStringRef name, intptr_t numElements,
728 const int *elements) {
729 return getDenseResource<DenseBoolResourceElementsAttr>(shapedType, name,
730 numElements, elements);
733 MlirType shapedType,
MlirStringRef name, intptr_t numElements,
734 const uint8_t *elements) {
735 return getDenseResource<DenseUI8ResourceElementsAttr>(shapedType, name,
736 numElements, elements);
741 intptr_t numElements,
742 const uint16_t *elements) {
743 return getDenseResource<DenseUI16ResourceElementsAttr>(shapedType, name,
744 numElements, elements);
749 intptr_t numElements,
750 const uint32_t *elements) {
751 return getDenseResource<DenseUI32ResourceElementsAttr>(shapedType, name,
752 numElements, elements);
757 intptr_t numElements,
758 const uint64_t *elements) {
759 return getDenseResource<DenseUI64ResourceElementsAttr>(shapedType, name,
760 numElements, elements);
763 MlirType shapedType,
MlirStringRef name, intptr_t numElements,
764 const int8_t *elements) {
765 return getDenseResource<DenseUI8ResourceElementsAttr>(shapedType, name,
766 numElements, elements);
769 MlirType shapedType,
MlirStringRef name, intptr_t numElements,
770 const int16_t *elements) {
771 return getDenseResource<DenseUI16ResourceElementsAttr>(shapedType, name,
772 numElements, elements);
775 MlirType shapedType,
MlirStringRef name, intptr_t numElements,
776 const int32_t *elements) {
777 return getDenseResource<DenseUI32ResourceElementsAttr>(shapedType, name,
778 numElements, elements);
781 MlirType shapedType,
MlirStringRef name, intptr_t numElements,
782 const int64_t *elements) {
783 return getDenseResource<DenseUI64ResourceElementsAttr>(shapedType, name,
784 numElements, elements);
787 MlirType shapedType,
MlirStringRef name, intptr_t numElements,
788 const float *elements) {
789 return getDenseResource<DenseF32ResourceElementsAttr>(shapedType, name,
790 numElements, elements);
795 intptr_t numElements,
796 const double *elements) {
797 return getDenseResource<DenseF64ResourceElementsAttr>(shapedType, name,
798 numElements, elements);
801 template <
typename U,
typename T>
803 return (*llvm::cast<U>(
unwrap(attr)).tryGetAsArrayRef())[pos];
808 return getDenseResourceVal<DenseBoolResourceElementsAttr, uint8_t>(attr, pos);
812 return getDenseResourceVal<DenseUI8ResourceElementsAttr, uint8_t>(attr, pos);
816 return getDenseResourceVal<DenseUI16ResourceElementsAttr, uint16_t>(attr,
821 return getDenseResourceVal<DenseUI32ResourceElementsAttr, uint32_t>(attr,
826 return getDenseResourceVal<DenseUI64ResourceElementsAttr, uint64_t>(attr,
831 return getDenseResourceVal<DenseUI8ResourceElementsAttr, int8_t>(attr, pos);
835 return getDenseResourceVal<DenseUI16ResourceElementsAttr, int16_t>(attr, pos);
839 return getDenseResourceVal<DenseUI32ResourceElementsAttr, int32_t>(attr, pos);
843 return getDenseResourceVal<DenseUI64ResourceElementsAttr, int64_t>(attr, pos);
847 return getDenseResourceVal<DenseF32ResourceElementsAttr, float>(attr, pos);
851 return getDenseResourceVal<DenseF64ResourceElementsAttr, double>(attr, pos);
859 return llvm::isa<SparseElementsAttr>(
unwrap(attr));
863 MlirAttribute denseIndices,
864 MlirAttribute denseValues) {
866 llvm::cast<ShapedType>(
unwrap(shapedType)),
867 llvm::cast<DenseElementsAttr>(
unwrap(denseIndices)),
868 llvm::cast<DenseElementsAttr>(
unwrap(denseValues))));
876 return wrap(llvm::cast<SparseElementsAttr>(
unwrap(attr)).getValues());
884 return llvm::isa<StridedLayoutAttr>(
unwrap(attr));
889 const int64_t *strides) {
895 return llvm::cast<StridedLayoutAttr>(
unwrap(attr)).getOffset();
899 return static_cast<intptr_t
>(
900 llvm::cast<StridedLayoutAttr>(
unwrap(attr)).getStrides().size());
904 return llvm::cast<StridedLayoutAttr>(
unwrap(attr)).getStrides()[pos];
bool mlirAttributeIsAFlatSymbolRef(MlirAttribute attr)
Checks whether the given attribute is a flat symbol reference attribute.
MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr)
Returns the affine map wrapped in the given affine map attribute.
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...
intptr_t mlirDictionaryAttrGetNumElements(MlirAttribute attr)
Returns the number of attributes contained in a dictionary attribute.
MlirAttribute mlirBoolAttrGet(MlirContext ctx, int value)
Creates a bool attribute in the given context with the given value.
float mlirDenseElementsAttrGetFloatValue(MlirAttribute attr, intptr_t pos)
MlirStringRef mlirFlatSymbolRefAttrGetValue(MlirAttribute attr)
Returns the referenced symbol as a string reference.
MlirAttribute mlirDenseF32ArrayGet(MlirContext ctx, intptr_t size, float const *values)
int16_t mlirDenseElementsAttrGetInt16Value(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirSparseElementsAttrGetIndices(MlirAttribute attr)
Returns the dense elements attribute containing 64-bit integer indices of non-null elements in the gi...
uint32_t mlirDenseElementsAttrGetUInt32SplatValue(MlirAttribute attr)
bool mlirAttributeIsALocation(MlirAttribute attr)
bool mlirAttributeIsAString(MlirAttribute attr)
Checks whether the given attribute is a string attribute.
MlirStringRef mlirDenseElementsAttrGetStringValue(MlirAttribute attr, intptr_t pos)
int8_t mlirDenseI8ArrayGetElement(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED int32_t mlirDenseInt32ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
uint32_t mlirDenseElementsAttrGetUInt32Value(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...
bool mlirAttributeIsADenseI32Array(MlirAttribute attr)
int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr)
Returns the value stored in the given integer attribute, assuming the value is of signless type and f...
MlirStringRef mlirSymbolRefAttrGetRootReference(MlirAttribute attr)
Returns the string reference to the root referenced symbol.
MlirAttribute mlirAffineMapAttrGet(MlirAffineMap map)
Creates an affine map attribute wrapping the given map.
int mlirDenseElementsAttrGetBoolSplatValue(MlirAttribute attr)
MlirAttribute mlirStridedLayoutAttrGet(MlirContext ctx, int64_t offset, intptr_t numStrides, const int64_t *strides)
uint16_t mlirDenseElementsAttrGetUInt16Value(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirDenseElementsAttrFloat16Get(MlirType shapedType, intptr_t numElements, const uint16_t *elements)
float mlirDenseF32ArrayGetElement(MlirAttribute attr, intptr_t pos)
uint8_t mlirDenseElementsAttrGetUInt8SplatValue(MlirAttribute attr)
uint64_t mlirIntegerAttrGetValueUInt(MlirAttribute attr)
Returns the value stored in the given integer attribute, assuming the value is of unsigned type and f...
bool mlirDenseBoolArrayGetElement(MlirAttribute attr, intptr_t pos)
Get an element of a dense array.
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...
bool mlirAttributeIsADictionary(MlirAttribute attr)
Checks whether the given attribute is a dictionary attribute.
MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol)
Creates a flat symbol reference attribute in the given context referencing a symbol identified by the...
MlirAttribute mlirDenseElementsAttrInt16Get(MlirType shapedType, intptr_t numElements, const int16_t *elements)
bool mlirAttributeIsADenseElements(MlirAttribute attr)
Checks whether the given attribute is a dense elements attribute.
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 MlirAttribute mlirUnmanagedDenseUInt8ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint8_t *elements)
const void * mlirDenseElementsAttrGetRawData(MlirAttribute attr)
Returns the raw data of the given dense elements attribute.
bool mlirAttributeIsASparseElements(MlirAttribute attr)
Checks whether the given attribute is a sparse elements attribute.
bool mlirBoolAttrGetValue(MlirAttribute attr)
Returns the value stored in the given bool attribute.
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.
uint64_t mlirDenseElementsAttrGetUInt64SplatValue(MlirAttribute attr)
int64_t mlirIntegerAttrGetValueSInt(MlirAttribute attr)
Returns the value stored in the given integer attribute, assuming the value is of signed type and fit...
MlirAttribute mlirDenseI32ArrayGet(MlirContext ctx, intptr_t size, int32_t const *values)
MlirAttribute mlirSymbolRefAttrGetNestedReference(MlirAttribute attr, intptr_t pos)
Returns pos-th reference nested in the given symbol reference attribute.
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 int8_t mlirDenseInt8ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED double mlirDenseDoubleResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirDenseElementsAttrDoubleGet(MlirType shapedType, intptr_t numElements, const double *elements)
intptr_t mlirSymbolRefAttrGetNumNestedReferences(MlirAttribute attr)
Returns the number of references nested in the given symbol reference attribute.
bool mlirAttributeIsADenseI16Array(MlirAttribute attr)
MLIR_CAPI_EXPORTED uint64_t mlirDenseUInt64ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirDenseElementsAttrDoubleSplatGet(MlirType shapedType, double element)
intptr_t mlirDenseArrayGetNumElements(MlirAttribute attr)
Get the size of a dense array.
bool mlirAttributeIsADenseBoolArray(MlirAttribute attr)
Checks whether the given attribute is a dense array attribute.
bool mlirAttributeIsADenseI64Array(MlirAttribute attr)
MlirStringRef mlirStringAttrGetValue(MlirAttribute attr)
Returns the attribute values as a string reference.
bool mlirAttributeIsAElements(MlirAttribute attr)
Checks whether the given attribute is an elements attribute.
MlirAttribute mlirStringAttrTypedGet(MlirType type, MlirStringRef str)
Creates a string attribute in the given context containing the given string.
uint8_t mlirDenseElementsAttrGetUInt8Value(MlirAttribute attr, intptr_t pos)
uint64_t mlirDenseElementsAttrGetUInt64Value(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirDenseElementsAttrUInt8SplatGet(MlirType shapedType, uint8_t element)
MlirAttribute mlirDictionaryAttrGet(MlirContext ctx, intptr_t numElements, MlirNamedAttribute const *elements)
Creates a dictionary attribute containing the given list of elements in the provided context.
int8_t mlirDenseElementsAttrGetInt8SplatValue(MlirAttribute attr)
MlirAttribute mlirDenseElementsAttrUInt16Get(MlirType shapedType, intptr_t numElements, const uint16_t *elements)
MlirNamedAttribute mlirDictionaryAttrGetElement(MlirAttribute attr, intptr_t pos)
Returns pos-th element of the given dictionary attribute.
MlirAttribute mlirDenseElementsAttrBFloat16Get(MlirType shapedType, intptr_t numElements, const uint16_t *elements)
int16_t mlirDenseI16ArrayGetElement(MlirAttribute attr, intptr_t pos)
int32_t mlirDenseI32ArrayGetElement(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirStringAttrGet(MlirContext ctx, MlirStringRef str)
Creates a string attribute in the given context containing the given string.
bool mlirAttributeIsADenseFPElements(MlirAttribute attr)
bool mlirAttributeIsADenseI8Array(MlirAttribute attr)
MlirStringRef mlirSymbolRefAttrGetLeafReference(MlirAttribute attr)
Returns the string reference to the leaf referenced symbol.
bool mlirAttributeIsAType(MlirAttribute attr)
Checks whether the given attribute is a type attribute.
MlirAttribute mlirIntegerAttrGet(MlirType type, int64_t value)
Creates an integer attribute of the given type with the given integer value.
MlirType mlirTypeAttrGetValue(MlirAttribute attr)
Returns the type stored in the given type attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt16ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint16_t *elements)
MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements, MlirAttribute const *elements)
Creates an array element containing the given list of elements in the given context.
double mlirDenseElementsAttrGetDoubleSplatValue(MlirAttribute attr)
MlirAttribute mlirDenseElementsAttrInt64SplatGet(MlirType shapedType, int64_t element)
double mlirFloatAttrGetValueDouble(MlirAttribute attr)
Returns the value stored in the given floating point attribute, interpreting the value as double.
bool mlirAttributeIsAArray(MlirAttribute attr)
Checks whether the given attribute is an array attribute.
bool mlirAttributeIsAOpaque(MlirAttribute attr)
Checks whether the given attribute is an opaque attribute.
MlirAttribute mlirDenseElementsAttrFloatSplatGet(MlirType shapedType, float element)
MlirAttribute mlirDenseF64ArrayGet(MlirContext ctx, intptr_t size, double const *values)
bool mlirAttributeIsAAffineMap(MlirAttribute attr)
Checks whether the given attribute is an affine map attribute.
MlirAttribute mlirDenseElementsAttrFloatGet(MlirType shapedType, intptr_t numElements, const float *elements)
MlirAttribute mlirSparseElementsAttrGetValues(MlirAttribute attr)
Returns the dense elements attribute containing the non-null elements in the given sparse elements at...
int64_t mlirStridedLayoutAttrGetStride(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirArrayAttrGetElement(MlirAttribute attr, intptr_t pos)
Returns pos-th element stored in the given array attribute.
MlirStringRef mlirDenseElementsAttrGetStringSplatValue(MlirAttribute attr)
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...
int32_t mlirDenseElementsAttrGetInt32Value(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt64ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint64_t *elements)
intptr_t mlirStridedLayoutAttrGetNumStrides(MlirAttribute attr)
bool mlirAttributeIsADenseIntElements(MlirAttribute attr)
bool mlirAttributeIsADenseF64Array(MlirAttribute attr)
MlirAttribute mlirDenseBoolArrayGet(MlirContext ctx, intptr_t size, int const *values)
Create a dense array attribute with the given elements.
MlirAttribute mlirDenseElementsAttrUInt32Get(MlirType shapedType, intptr_t numElements, const uint32_t *elements)
bool mlirAttributeIsABool(MlirAttribute attr)
Checks whether the given attribute is a bool attribute.
bool mlirAttributeIsADenseF32Array(MlirAttribute attr)
MlirAttribute mlirUnitAttrGet(MlirContext ctx)
Creates a unit attribute in the given context.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt16ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int16_t *elements)
MlirAttribute mlirDenseI16ArrayGet(MlirContext ctx, intptr_t size, int16_t const *values)
int32_t mlirDenseElementsAttrGetInt32SplatValue(MlirAttribute attr)
int64_t mlirElementsAttrGetNumElements(MlirAttribute attr)
Gets the total number of elements in the given elements attribute.
double mlirDenseElementsAttrGetDoubleValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt32ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int32_t *elements)
bool mlirElementsAttrIsValidIndex(MlirAttribute attr, intptr_t rank, uint64_t *idxs)
Checks whether the given rank-dimensional index is valid in the given elements attribute.
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,...
bool mlirAttributeIsAFloat(MlirAttribute attr)
Checks whether the given attribute is a floating point attribute.
MLIR_CAPI_EXPORTED int16_t mlirDenseInt16ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
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...
intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr)
Returns the number of elements stored in the given array attribute.
MlirAttribute mlirDenseI64ArrayGet(MlirContext ctx, intptr_t size, int64_t const *values)
int64_t mlirDenseElementsAttrGetInt64Value(MlirAttribute attr, intptr_t pos)
bool mlirAttributeIsAStridedLayout(MlirAttribute attr)
MLIR_CAPI_EXPORTED uint32_t mlirDenseUInt32ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
bool mlirAttributeIsAIntegerSet(MlirAttribute attr)
Checks whether the given attribute is an integer set attribute.
MlirAttribute mlirDenseElementsAttrGetSplatValue(MlirAttribute attr)
Returns the single replicated value (splat) of a specific type contained by the given dense elements ...
MLIR_CAPI_EXPORTED uint16_t mlirDenseUInt16ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
static MlirAttribute getDenseResource(MlirType shapedType, MlirStringRef name, intptr_t numElements, const T *elements)
MLIR_CAPI_EXPORTED int64_t mlirDenseInt64ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirDenseElementsAttrUInt8Get(MlirType shapedType, intptr_t numElements, const uint8_t *elements)
MLIR_CAPI_EXPORTED uint8_t mlirDenseUInt8ResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseFloatResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const float *elements)
static MlirAttribute getDenseAttribute(MlirType shapedType, intptr_t numElements, const T *elements)
Creates a dense attribute with elements of the type deduced by templates.
bool mlirDenseElementsAttrIsSplat(MlirAttribute attr)
Checks whether the given dense elements attribute contains a single replicated value (splat).
MlirAttribute mlirElementsAttrGetValue(MlirAttribute attr, intptr_t rank, uint64_t *idxs)
Returns the element at the given rank-dimensional index.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseBoolResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int *elements)
MlirAttribute mlirDictionaryAttrGetElementByName(MlirAttribute attr, MlirStringRef name)
Returns the dictionary attribute element with the given name or NULL if the given name does not exist...
double mlirDenseF64ArrayGetElement(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirDenseElementsAttrInt8SplatGet(MlirType shapedType, int8_t element)
MlirAttribute mlirDenseElementsAttrInt32Get(MlirType shapedType, intptr_t numElements, const int32_t *elements)
MlirAttribute mlirDenseElementsAttrReshapeGet(MlirAttribute attr, MlirType shapedType)
Creates a dense elements attribute that has the same data as the given dense elements attribute and a...
MlirAttribute mlirDenseElementsAttrSplatGet(MlirType shapedType, MlirAttribute element)
Creates a dense elements attribute with the given Shaped type containing a single replicated element ...
MlirStringRef mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr)
Returns the namespace of the dialect with which the given opaque attribute is associated.
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...
int64_t mlirDenseI64ArrayGetElement(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirFloatAttrDoubleGetChecked(MlirLocation loc, MlirType type, double value)
Same as "mlirFloatAttrDoubleGet", but if the type is not valid for a construction of a FloatAttr,...
int64_t mlirDenseElementsAttrGetInt64SplatValue(MlirAttribute attr)
MlirAttribute mlirDenseElementsAttrInt8Get(MlirType shapedType, intptr_t numElements, const int8_t *elements)
MlirAttribute mlirDenseElementsAttrUInt64Get(MlirType shapedType, intptr_t numElements, const uint64_t *elements)
float mlirDenseElementsAttrGetFloatSplatValue(MlirAttribute attr)
MlirAttribute mlirDenseElementsAttrUInt32SplatGet(MlirType shapedType, uint32_t element)
MLIR_CAPI_EXPORTED float mlirDenseFloatResourceElementsAttrGetValue(MlirAttribute attr, intptr_t pos)
bool mlirAttributeIsAUnit(MlirAttribute attr)
Checks whether the given attribute is a unit attribute.
MlirAttribute mlirDenseElementsAttrUInt64SplatGet(MlirType shapedType, uint64_t element)
MlirAttribute mlirDenseElementsAttrBoolSplatGet(MlirType shapedType, bool element)
int8_t mlirDenseElementsAttrGetInt8Value(MlirAttribute attr, intptr_t pos)
MlirAttribute mlirDenseI8ArrayGet(MlirContext ctx, intptr_t size, int8_t const *values)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt64ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const int64_t *elements)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseDoubleResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const double *elements)
MlirAttribute mlirDenseElementsAttrInt32SplatGet(MlirType shapedType, int32_t element)
bool mlirAttributeIsAInteger(MlirAttribute attr)
Checks whether the given attribute is an integer attribute.
MlirAttribute mlirDenseElementsAttrInt64Get(MlirType shapedType, intptr_t numElements, const int64_t *elements)
static T getDenseResourceVal(MlirAttribute attr, intptr_t pos)
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt32ResourceElementsAttrGet(MlirType shapedType, MlirStringRef name, intptr_t numElements, const uint32_t *elements)
bool mlirAttributeIsASymbolRef(MlirAttribute attr)
Checks whether the given attribute is a symbol reference attribute.
int64_t mlirStridedLayoutAttrGetOffset(MlirAttribute attr)
MlirStringRef mlirOpaqueAttrGetData(MlirAttribute attr)
Returns the raw data as a string reference.
MlirAttribute mlirTypeAttrGet(MlirType type)
Creates a type attribute wrapping the given type in the same context as the type.
MlirAttribute mlirAttributeGetNull()
Returns an empty attribute.
Operation::operand_range getIndices(Operation *op)
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
Attributes are known-constant values of operations.
static BoolAttr get(MLIRContext *context, bool value)
static DenseElementsAttr getFromRawBuffer(ShapedType type, ArrayRef< char > rawBuffer)
Construct a dense elements attribute from a raw buffer representing the data for this attribute.
static DenseElementsAttr get(ShapedType type, ArrayRef< Attribute > values)
Constructs a dense elements attribute from an array of element values.
static bool isValidRawBuffer(ShapedType type, ArrayRef< char > rawBuffer, bool &detectedSplat)
Returns true if the given buffer is a valid raw buffer for the given type.
static FlatSymbolRefAttr get(StringAttr value)
Construct a symbol reference for the given value name.
NamedAttribute represents a combination of a name and an Attribute value.
StringAttr getName() const
Return the name of the attribute.
Attribute getValue() const
Return the value of the attribute.
static AsmResourceBlob allocateInferAlign(ArrayRef< T > data, AsmResourceBlob::DeleterFn deleter={}, bool dataIsMutable=false)
static DenseArrayAttrImpl get(MLIRContext *context, ArrayRef< T > content)
Builder from ArrayRef<T>.
#define MLIR_CAPI_EXPORTED
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
This header declares functions that assit transformations in the MemRef dialect.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
A pointer to a sized fragment of a string, not necessarily null-terminated.