[Mlir-commits] [mlir] [MLIR][Python] Forward the name of MLIR attrs to Python side (PR #174756)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jan 7 04:43:33 PST 2026
https://github.com/PragmaTwice updated https://github.com/llvm/llvm-project/pull/174756
>From 87b198995ed3655f4633e72069a08f5f6059c95c Mon Sep 17 00:00:00 2001
From: PragmaTwice <twice at apache.org>
Date: Wed, 7 Jan 2026 17:14:28 +0800
Subject: [PATCH 1/6] [MLIR][Python] Forward the name of MLIR attrs to Python
side
---
mlir/include/mlir-c/BuiltinAttributes.h | 67 +++++++++++++++
mlir/include/mlir-c/Dialect/EmitC.h | 4 +
mlir/include/mlir-c/Dialect/GPU.h | 2 +
mlir/include/mlir-c/Dialect/IRDL.h | 4 +
mlir/include/mlir-c/Dialect/LLVM.h | 42 ++++++++++
mlir/include/mlir-c/Dialect/SparseTensor.h | 2 +
mlir/lib/CAPI/Dialect/EmitC.cpp | 8 ++
mlir/lib/CAPI/Dialect/GPU.cpp | 4 +
mlir/lib/CAPI/Dialect/IRDL.cpp | 8 ++
mlir/lib/CAPI/Dialect/LLVM.cpp | 78 ++++++++++++++++++
mlir/lib/CAPI/Dialect/SparseTensor.cpp | 4 +
mlir/lib/CAPI/IR/BuiltinAttributes.cpp | 95 ++++++++++++++++++++++
12 files changed, 318 insertions(+)
diff --git a/mlir/include/mlir-c/BuiltinAttributes.h b/mlir/include/mlir-c/BuiltinAttributes.h
index 1d0edf9ea809d..9ca547816b84c 100644
--- a/mlir/include/mlir-c/BuiltinAttributes.h
+++ b/mlir/include/mlir-c/BuiltinAttributes.h
@@ -43,6 +43,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAAffineMap(MlirAttribute attr);
/// belongs to the same context as the affine map.
MLIR_CAPI_EXPORTED MlirAttribute mlirAffineMapAttrGet(MlirAffineMap map);
+MLIR_CAPI_EXPORTED MlirStringRef mlirAffineMapAttrGetName(void);
+
/// Returns the affine map wrapped in the given affine map attribute.
MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr);
@@ -61,6 +63,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAArray(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirAttribute mlirArrayAttrGet(
MlirContext ctx, intptr_t numElements, MlirAttribute const *elements);
+MLIR_CAPI_EXPORTED MlirStringRef mlirArrayAttrGetName(void);
+
/// Returns the number of elements stored in the given array attribute.
MLIR_CAPI_EXPORTED intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr);
@@ -83,6 +87,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsADictionary(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirAttribute mlirDictionaryAttrGet(
MlirContext ctx, intptr_t numElements, MlirNamedAttribute const *elements);
+MLIR_CAPI_EXPORTED MlirStringRef mlirDictionaryAttrGetName(void);
+
/// Returns the number of attributes contained in a dictionary attribute.
MLIR_CAPI_EXPORTED intptr_t
mlirDictionaryAttrGetNumElements(MlirAttribute attr);
@@ -143,6 +149,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAInteger(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerAttrGet(MlirType type,
int64_t value);
+MLIR_CAPI_EXPORTED MlirStringRef mlirIntegerAttrGetName(void);
+
/// Returns the value stored in the given integer attribute, assuming the value
/// is of signless type and fits into a signed 64-bit integer.
MLIR_CAPI_EXPORTED int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr);
@@ -182,6 +190,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAIntegerSet(MlirAttribute attr);
/// belongs to the same context as the integer set.
MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerSetAttrGet(MlirIntegerSet set);
+MLIR_CAPI_EXPORTED MlirStringRef mlirIntegerSetAttrGetName(void);
+
/// Returns the integer set wrapped in the given integer set attribute.
MLIR_CAPI_EXPORTED MlirIntegerSet
mlirIntegerSetAttrGetValue(MlirAttribute attr);
@@ -203,6 +213,8 @@ MLIR_CAPI_EXPORTED MlirAttribute
mlirOpaqueAttrGet(MlirContext ctx, MlirStringRef dialectNamespace,
intptr_t dataLength, const char *data, MlirType type);
+MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueAttrGetName(void);
+
/// Returns the namespace of the dialect with which the given opaque attribute
/// is associated. The namespace string is owned by the context.
MLIR_CAPI_EXPORTED MlirStringRef
@@ -227,6 +239,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAString(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrGet(MlirContext ctx,
MlirStringRef str);
+MLIR_CAPI_EXPORTED MlirStringRef mlirStringAttrGetName(void);
+
/// Creates a string attribute in the given context containing the given string.
/// Additionally, the attribute has the given type.
MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrTypedGet(MlirType type,
@@ -253,6 +267,8 @@ MLIR_CAPI_EXPORTED MlirAttribute
mlirSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol,
intptr_t numReferences, MlirAttribute const *references);
+MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolRefAttrGetName(void);
+
/// Returns the string reference to the root referenced symbol. The data remains
/// live as long as the context in which the attribute lives.
MLIR_CAPI_EXPORTED MlirStringRef
@@ -291,6 +307,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAFlatSymbolRef(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx,
MlirStringRef symbol);
+MLIR_CAPI_EXPORTED MlirStringRef mlirFlatSymbolRefAttrGetName(void);
+
/// Returns the referenced symbol as a string reference. The data remains live
/// as long as the context in which the attribute lives.
MLIR_CAPI_EXPORTED MlirStringRef
@@ -307,6 +325,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAType(MlirAttribute attr);
/// type.
MLIR_CAPI_EXPORTED MlirAttribute mlirTypeAttrGet(MlirType type);
+MLIR_CAPI_EXPORTED MlirStringRef mlirTypeAttrGetName(void);
+
/// Returns the type stored in the given type attribute.
MLIR_CAPI_EXPORTED MlirType mlirTypeAttrGetValue(MlirAttribute attr);
@@ -323,6 +343,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAUnit(MlirAttribute attr);
/// Creates a unit attribute in the given context.
MLIR_CAPI_EXPORTED MlirAttribute mlirUnitAttrGet(MlirContext ctx);
+MLIR_CAPI_EXPORTED MlirStringRef mlirUnitAttrGetName(void);
+
/// Returns the typeID of a Unit attribute.
MLIR_CAPI_EXPORTED MlirTypeID mlirUnitAttrGetTypeID(void);
@@ -590,48 +612,91 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseResourceElementsAttrGet(
size_t align),
void *userData);
+MLIR_CAPI_EXPORTED MlirStringRef mlirDenseResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseBoolResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef mlirDenseBoolResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint8_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseUInt8ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int8_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef mlirDenseInt8ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseUInt16ResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const uint16_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseUInt16ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt16ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int16_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseInt16ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseUInt32ResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const uint32_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseUInt32ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt32ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int32_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseInt32ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseUInt64ResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const uint64_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseUInt64ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt64ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int64_t *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseInt64ResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseFloatResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const float *elements);
+
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseFloatResourceElementsAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseDoubleResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const double *elements);
+MLIR_CAPI_EXPORTED MlirStringRef
+mlirDenseDoubleResourceElementsAttrGetName(void);
+
/// Returns the pos-th value (flat contiguous indexing) of a specific type
/// contained by the given dense resource elements attribute.
MLIR_CAPI_EXPORTED bool
@@ -697,6 +762,8 @@ MLIR_CAPI_EXPORTED MlirAttribute
mlirStridedLayoutAttrGet(MlirContext ctx, int64_t offset, intptr_t numStrides,
const int64_t *strides);
+MLIR_CAPI_EXPORTED MlirStringRef mlirStridedLayoutAttrGetName(void);
+
// Returns the offset in the given strided layout layout attribute.
MLIR_CAPI_EXPORTED int64_t mlirStridedLayoutAttrGetOffset(MlirAttribute attr);
diff --git a/mlir/include/mlir-c/Dialect/EmitC.h b/mlir/include/mlir-c/Dialect/EmitC.h
index 78e09ffe53ff8..3bd4c5e016f79 100644
--- a/mlir/include/mlir-c/Dialect/EmitC.h
+++ b/mlir/include/mlir-c/Dialect/EmitC.h
@@ -125,6 +125,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAEmitCCmpPredicate(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirAttribute
mlirEmitCCmpPredicateAttrGet(MlirContext ctx, enum MlirEmitCCmpPredicate val);
+MLIR_CAPI_EXPORTED MlirStringRef mlirEmitCCmpPredicateAttrGetName(void);
+
MLIR_CAPI_EXPORTED enum MlirEmitCCmpPredicate
mlirEmitCCmpPredicateAttrGetValue(MlirAttribute attr);
@@ -139,6 +141,8 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAEmitCOpaque(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirAttribute mlirEmitCOpaqueAttrGet(MlirContext ctx,
MlirStringRef value);
+MLIR_CAPI_EXPORTED MlirStringRef mlirEmitCOpaqueAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirStringRef
mlirEmitCOpaqueAttrGetValue(MlirAttribute attr);
diff --git a/mlir/include/mlir-c/Dialect/GPU.h b/mlir/include/mlir-c/Dialect/GPU.h
index 4e7448d427cda..f87ac9924d355 100644
--- a/mlir/include/mlir-c/Dialect/GPU.h
+++ b/mlir/include/mlir-c/Dialect/GPU.h
@@ -39,6 +39,8 @@ MLIR_CAPI_EXPORTED MlirAttribute
mlirGPUObjectAttrGet(MlirContext mlirCtx, MlirAttribute target, uint32_t format,
MlirStringRef objectStrRef, MlirAttribute mlirObjectProps);
+MLIR_CAPI_EXPORTED MlirStringRef mlirGPUObjectAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirGPUObjectAttrGetWithKernels(
MlirContext mlirCtx, MlirAttribute target, uint32_t format,
MlirStringRef objectStrRef, MlirAttribute mlirObjectProps,
diff --git a/mlir/include/mlir-c/Dialect/IRDL.h b/mlir/include/mlir-c/Dialect/IRDL.h
index d87ab864fb33f..16d1bc5482262 100644
--- a/mlir/include/mlir-c/Dialect/IRDL.h
+++ b/mlir/include/mlir-c/Dialect/IRDL.h
@@ -29,6 +29,8 @@ MLIR_CAPI_EXPORTED MlirLogicalResult mlirLoadIRDLDialects(MlirModule module);
MLIR_CAPI_EXPORTED MlirAttribute
mlirIRDLVariadicityAttrGet(MlirContext ctx, MlirStringRef value);
+MLIR_CAPI_EXPORTED MlirStringRef mlirIRDLVariadicityAttrGetName(void);
+
//===----------------------------------------------------------------------===//
// VariadicityArrayAttr
//===----------------------------------------------------------------------===//
@@ -36,6 +38,8 @@ mlirIRDLVariadicityAttrGet(MlirContext ctx, MlirStringRef value);
MLIR_CAPI_EXPORTED MlirAttribute mlirIRDLVariadicityArrayAttrGet(
MlirContext ctx, intptr_t nValues, MlirAttribute const *values);
+MLIR_CAPI_EXPORTED MlirStringRef mlirIRDLVariadicityArrayAttrGetName(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/mlir/include/mlir-c/Dialect/LLVM.h b/mlir/include/mlir-c/Dialect/LLVM.h
index 35f3717ad2372..8c512530d163d 100644
--- a/mlir/include/mlir-c/Dialect/LLVM.h
+++ b/mlir/include/mlir-c/Dialect/LLVM.h
@@ -188,6 +188,8 @@ typedef enum MlirLLVMCConv MlirLLVMCConv;
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx,
MlirLLVMCConv cconv);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMCConvAttrGetName(void);
+
enum MlirLLVMComdat {
MlirLLVMComdatAny = 0,
MlirLLVMComdatExactMatch = 1,
@@ -201,6 +203,8 @@ typedef enum MlirLLVMComdat MlirLLVMComdat;
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx,
MlirLLVMComdat comdat);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMComdatAttrGetName(void);
+
enum MlirLLVMLinkage {
MlirLLVMLinkageExternal = 0,
MlirLLVMLinkageAvailableExternally = 1,
@@ -220,18 +224,26 @@ typedef enum MlirLLVMLinkage MlirLLVMLinkage;
MLIR_CAPI_EXPORTED MlirAttribute
mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMLinkageAttrGetName(void);
+
/// Creates a LLVM DINullType attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDINullTypeAttrGetName(void);
+
/// Creates a LLVM DIExpressionElem attribute.
MLIR_CAPI_EXPORTED MlirAttribute
mlirLLVMDIExpressionElemAttrGet(MlirContext ctx, unsigned int opcode,
intptr_t nArguments, uint64_t const *arguments);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIExpressionElemAttrGetName(void);
+
/// Creates a LLVM DIExpression attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIExpressionAttrGet(
MlirContext ctx, intptr_t nOperations, MlirAttribute const *operations);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIExpressionAttrGetName(void);
+
enum MlirLLVMTypeEncoding {
MlirLLVMTypeEncodingAddress = 0x1,
MlirLLVMTypeEncodingBoolean = 0x2,
@@ -261,6 +273,8 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIBasicTypeAttrGet(
MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
MlirLLVMTypeEncoding encoding);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIBasicTypeAttrGetName(void);
+
/// Creates a self-referencing LLVM DICompositeType attribute.
MLIR_CAPI_EXPORTED MlirAttribute
mlirLLVMDICompositeTypeAttrGetRecSelf(MlirAttribute recId);
@@ -274,6 +288,8 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDICompositeTypeAttrGet(
MlirAttribute dataLocation, MlirAttribute rank, MlirAttribute allocated,
MlirAttribute associated);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDICompositeTypeAttrGetName(void);
+
/// Creates a LLVM DIDerivedType attribute. Note that `dwarfAddressSpace` is an
/// optional field, where `MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL` indicates null
/// and non-negative values indicate a value present.
@@ -282,12 +298,16 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIDerivedTypeAttrGet(
MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits,
uint64_t offsetInBits, int64_t dwarfAddressSpace, MlirAttribute extraData);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIDerivedTypeAttrGetName(void);
+
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIStringTypeAttrGet(
MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
uint32_t alignInBits, MlirAttribute stringLength,
MlirAttribute stringLengthExp, MlirAttribute stringLocationExp,
MlirLLVMTypeEncoding encoding);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIStringTypeAttrGetName(void);
+
/// Constant to represent std::nullopt for dwarfAddressSpace to omit the field.
#define MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL -1
@@ -300,6 +320,8 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx,
MlirAttribute name,
MlirAttribute directory);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIFileAttrGetName(void);
+
enum MlirLLVMDIEmissionKind {
MlirLLVMDIEmissionKindNone = 0,
MlirLLVMDIEmissionKindFull = 1,
@@ -323,26 +345,36 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDICompileUnitAttrGet(
MlirLLVMDIEmissionKind emissionKind, MlirLLVMDINameTableKind nameTableKind,
MlirAttribute splitDebugFilename);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDICompileUnitAttrGetName(void);
+
/// Creates a LLVM DIFlags attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx,
uint64_t value);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIFlagsAttrGetName(void);
+
/// Creates a LLVM DILexicalBlock attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDILexicalBlockAttrGet(
MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line,
unsigned int column);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDILexicalBlockAttrGetName(void);
+
/// Creates a LLVM DILexicalBlockFile attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(
MlirContext ctx, MlirAttribute scope, MlirAttribute file,
unsigned int discriminator);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDILexicalBlockFileAttrGetName(void);
+
/// Creates a LLVM DILocalVariableAttr attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDILocalVariableAttrGet(
MlirContext ctx, MlirAttribute scope, MlirAttribute name,
MlirAttribute diFile, unsigned int line, unsigned int arg,
unsigned int alignInBits, MlirAttribute diType, int64_t flags);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDILocalVariableAttrGetName(void);
+
/// Creates a self-referencing LLVM DISubprogramAttr attribute.
MLIR_CAPI_EXPORTED MlirAttribute
mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId);
@@ -356,10 +388,14 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDISubprogramAttrGet(
intptr_t nRetainedNodes, MlirAttribute const *retainedNodes,
intptr_t nAnnotations, MlirAttribute const *annotations);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDISubprogramAttrGetName(void);
+
/// Creates a LLVM DIAnnotation attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIAnnotationAttrGet(
MlirContext ctx, MlirAttribute name, MlirAttribute value);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIAnnotationAttrGetName(void);
+
/// Gets the scope from this DISubprogramAttr.
MLIR_CAPI_EXPORTED MlirAttribute
mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram);
@@ -389,18 +425,24 @@ MLIR_CAPI_EXPORTED MlirAttribute
mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx, unsigned int callingConvention,
intptr_t nTypes, MlirAttribute const *types);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDISubroutineTypeAttrGetName(void);
+
/// Creates a LLVM DIModuleAttr attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIModuleAttrGet(
MlirContext ctx, MlirAttribute file, MlirAttribute scope,
MlirAttribute name, MlirAttribute configMacros, MlirAttribute includePath,
MlirAttribute apinotes, unsigned int line, bool isDecl);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIModuleAttrGetName(void);
+
/// Creates a LLVM DIImportedEntityAttr attribute.
MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMDIImportedEntityAttrGet(
MlirContext ctx, unsigned int tag, MlirAttribute scope,
MlirAttribute entity, MlirAttribute file, unsigned int line,
MlirAttribute name, intptr_t nElements, MlirAttribute const *elements);
+MLIR_CAPI_EXPORTED MlirStringRef mlirLLVMDIImportedEntityAttrGetName(void);
+
/// Gets the scope of this DIModuleAttr.
MLIR_CAPI_EXPORTED MlirAttribute
mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule);
diff --git a/mlir/include/mlir-c/Dialect/SparseTensor.h b/mlir/include/mlir-c/Dialect/SparseTensor.h
index c816c1b58690e..60ae49f37d653 100644
--- a/mlir/include/mlir-c/Dialect/SparseTensor.h
+++ b/mlir/include/mlir-c/Dialect/SparseTensor.h
@@ -57,6 +57,8 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirSparseTensorEncodingAttrGet(
MlirAffineMap lvlTodim, int posWidth, int crdWidth,
MlirAttribute explicitVal, MlirAttribute implicitVal);
+MLIR_CAPI_EXPORTED MlirStringRef mlirSparseTensorEncodingAttrGetName(void);
+
/// Returns the level-rank of the `sparse_tensor.encoding` attribute.
MLIR_CAPI_EXPORTED intptr_t
mlirSparseTensorEncodingGetLvlRank(MlirAttribute attr);
diff --git a/mlir/lib/CAPI/Dialect/EmitC.cpp b/mlir/lib/CAPI/Dialect/EmitC.cpp
index 285d995d6653f..941a9d07c60b1 100644
--- a/mlir/lib/CAPI/Dialect/EmitC.cpp
+++ b/mlir/lib/CAPI/Dialect/EmitC.cpp
@@ -187,6 +187,10 @@ MlirAttribute mlirEmitCCmpPredicateAttrGet(MlirContext ctx,
unwrap(ctx), static_cast<emitc::CmpPredicate>(val)));
}
+MlirStringRef mlirEmitCCmpPredicateAttrGetName(void) {
+ return wrap(emitc::CmpPredicateAttr::name);
+}
+
MlirEmitCCmpPredicate mlirEmitCCmpPredicateAttrGetValue(MlirAttribute attr) {
return static_cast<MlirEmitCCmpPredicate>(
llvm::cast<emitc::CmpPredicateAttr>(unwrap(attr)).getValue());
@@ -208,6 +212,10 @@ MlirAttribute mlirEmitCOpaqueAttrGet(MlirContext ctx, MlirStringRef value) {
return wrap((Attribute)emitc::OpaqueAttr::get(unwrap(ctx), unwrap(value)));
}
+MlirStringRef mlirEmitCOpaqueAttrGetName(void) {
+ return wrap(emitc::OpaqueAttr::name);
+}
+
MlirStringRef mlirEmitCOpaqueAttrGetValue(MlirAttribute attr) {
return wrap(llvm::cast<emitc::OpaqueAttr>(unwrap(attr)).getValue());
}
diff --git a/mlir/lib/CAPI/Dialect/GPU.cpp b/mlir/lib/CAPI/Dialect/GPU.cpp
index 943ca17a57ee2..df41f3462942d 100644
--- a/mlir/lib/CAPI/Dialect/GPU.cpp
+++ b/mlir/lib/CAPI/Dialect/GPU.cpp
@@ -52,6 +52,10 @@ MlirAttribute mlirGPUObjectAttrGet(MlirContext mlirCtx, MlirAttribute target,
StringAttr::get(ctx, object), objectProps, nullptr));
}
+MlirStringRef mlirGPUObjectAttrGetName(void) {
+ return wrap(gpu::ObjectAttr::name);
+}
+
MlirAttribute mlirGPUObjectAttrGetWithKernels(MlirContext mlirCtx,
MlirAttribute target,
uint32_t format,
diff --git a/mlir/lib/CAPI/Dialect/IRDL.cpp b/mlir/lib/CAPI/Dialect/IRDL.cpp
index 43f420bf6db05..0cd65abd2c505 100644
--- a/mlir/lib/CAPI/Dialect/IRDL.cpp
+++ b/mlir/lib/CAPI/Dialect/IRDL.cpp
@@ -26,6 +26,10 @@ MlirAttribute mlirIRDLVariadicityAttrGet(MlirContext ctx, MlirStringRef value) {
unwrap(ctx), mlir::irdl::symbolizeVariadicity(unwrap(value)).value()));
}
+MlirStringRef mlirIRDLVariadicityAttrGetName(void) {
+ return wrap(mlir::irdl::VariadicityAttr::name);
+}
+
//===----------------------------------------------------------------------===//
// VariadicityArrayAttr
//===----------------------------------------------------------------------===//
@@ -43,3 +47,7 @@ MlirAttribute mlirIRDLVariadicityArrayAttrGet(MlirContext ctx, intptr_t nValues,
return wrap(
mlir::irdl::VariadicityArrayAttr::get(unwrap(ctx), variadicities));
}
+
+MlirStringRef mlirIRDLVariadicityArrayAttrGetName(void) {
+ return wrap(mlir::irdl::VariadicityArrayAttr::name);
+}
diff --git a/mlir/lib/CAPI/Dialect/LLVM.cpp b/mlir/lib/CAPI/Dialect/LLVM.cpp
index 49eff0508f80d..31084f1609e90 100644
--- a/mlir/lib/CAPI/Dialect/LLVM.cpp
+++ b/mlir/lib/CAPI/Dialect/LLVM.cpp
@@ -178,6 +178,10 @@ MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx,
return wrap(DIExpressionElemAttr::get(unwrap(ctx), opcode, list));
}
+MlirStringRef mlirLLVMDIExpressionElemAttrGetName(void) {
+ return wrap(DIExpressionElemAttr::name);
+}
+
MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations,
MlirAttribute const *operations) {
SmallVector<Attribute> attrStorage;
@@ -189,10 +193,18 @@ MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations,
llvm::CastTo<DIExpressionElemAttr>)));
}
+MlirStringRef mlirLLVMDIExpressionAttrGetName(void) {
+ return wrap(DIExpressionAttr::name);
+}
+
MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx) {
return wrap(DINullTypeAttr::get(unwrap(ctx)));
}
+MlirStringRef mlirLLVMDINullTypeAttrGetName(void) {
+ return wrap(DINullTypeAttr::name);
+}
+
MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag,
MlirAttribute name,
uint64_t sizeInBits,
@@ -202,6 +214,10 @@ MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag,
unwrap(ctx), tag, cast<StringAttr>(unwrap(name)), sizeInBits, encoding));
}
+MlirStringRef mlirLLVMDIBasicTypeAttrGetName(void) {
+ return wrap(DIBasicTypeAttr::name);
+}
+
MlirAttribute mlirLLVMDICompositeTypeAttrGetRecSelf(MlirAttribute recId) {
return wrap(
DICompositeTypeAttr::getRecSelf(cast<DistinctAttr>(unwrap(recId))));
@@ -230,6 +246,10 @@ MlirAttribute mlirLLVMDICompositeTypeAttrGet(
llvm::CastTo<DINodeAttr>)));
}
+MlirStringRef mlirLLVMDICompositeTypeAttrGetName(void) {
+ return wrap(DICompositeTypeAttr::name);
+}
+
MlirAttribute mlirLLVMDIDerivedTypeAttrGet(
MlirContext ctx, unsigned int tag, MlirAttribute name,
MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits,
@@ -243,6 +263,10 @@ MlirAttribute mlirLLVMDIDerivedTypeAttrGet(
addressSpace, cast<DINodeAttr>(unwrap(extraData))));
}
+MlirStringRef mlirLLVMDIDerivedTypeAttrGetName(void) {
+ return wrap(DIDerivedTypeAttr::name);
+}
+
MlirAttribute mlirLLVMDIStringTypeAttrGet(
MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
uint32_t alignInBits, MlirAttribute stringLength,
@@ -255,6 +279,10 @@ MlirAttribute mlirLLVMDIStringTypeAttrGet(
cast<DIExpressionAttr>(unwrap(stringLocationExp)), encoding));
}
+MlirStringRef mlirLLVMDIStringTypeAttrGetName(void) {
+ return wrap(DIStringTypeAttr::name);
+}
+
MlirAttribute
mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType) {
return wrap(cast<DIDerivedTypeAttr>(unwrap(diDerivedType)).getBaseType());
@@ -264,20 +292,30 @@ MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv) {
return wrap(CConvAttr::get(unwrap(ctx), CConv(cconv)));
}
+MlirStringRef mlirLLVMCConvAttrGetName(void) { return wrap(CConvAttr::name); }
+
MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat) {
return wrap(ComdatAttr::get(unwrap(ctx), comdat::Comdat(comdat)));
}
+MlirStringRef mlirLLVMComdatAttrGetName(void) { return wrap(ComdatAttr::name); }
+
MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage) {
return wrap(LinkageAttr::get(unwrap(ctx), linkage::Linkage(linkage)));
}
+MlirStringRef mlirLLVMLinkageAttrGetName(void) {
+ return wrap(LinkageAttr::name);
+}
+
MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name,
MlirAttribute directory) {
return wrap(DIFileAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
cast<StringAttr>(unwrap(directory))));
}
+MlirStringRef mlirLLVMDIFileAttrGetName(void) { return wrap(DIFileAttr::name); }
+
MlirAttribute mlirLLVMDICompileUnitAttrGet(
MlirContext ctx, MlirAttribute id, unsigned int sourceLanguage,
MlirAttribute file, MlirAttribute producer, bool isOptimized,
@@ -290,10 +328,18 @@ MlirAttribute mlirLLVMDICompileUnitAttrGet(
cast<StringAttr>(unwrap(splitDebugFilename))));
}
+MlirStringRef mlirLLVMDICompileUnitAttrGetName(void) {
+ return wrap(DICompileUnitAttr::name);
+}
+
MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value) {
return wrap(DIFlagsAttr::get(unwrap(ctx), DIFlags(value)));
}
+MlirStringRef mlirLLVMDIFlagsAttrGetName(void) {
+ return wrap(DIFlagsAttr::name);
+}
+
MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx,
MlirAttribute scope,
MlirAttribute file,
@@ -304,6 +350,10 @@ MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx,
cast<DIFileAttr>(unwrap(file)), line, column));
}
+MlirStringRef mlirLLVMDILexicalBlockAttrGetName(void) {
+ return wrap(DILexicalBlockAttr::name);
+}
+
MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx,
MlirAttribute scope,
MlirAttribute file,
@@ -313,6 +363,10 @@ MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx,
cast<DIFileAttr>(unwrap(file)), discriminator));
}
+MlirStringRef mlirLLVMDILexicalBlockFileAttrGetName(void) {
+ return wrap(DILexicalBlockFileAttr::name);
+}
+
MlirAttribute mlirLLVMDILocalVariableAttrGet(
MlirContext ctx, MlirAttribute scope, MlirAttribute name,
MlirAttribute diFile, unsigned int line, unsigned int arg,
@@ -323,6 +377,10 @@ MlirAttribute mlirLLVMDILocalVariableAttrGet(
arg, alignInBits, cast<DITypeAttr>(unwrap(diType)), DIFlags(flags)));
}
+MlirStringRef mlirLLVMDILocalVariableAttrGetName(void) {
+ return wrap(DILocalVariableAttr::name);
+}
+
MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
unsigned int callingConvention,
intptr_t nTypes,
@@ -336,6 +394,10 @@ MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
llvm::CastTo<DITypeAttr>)));
}
+MlirStringRef mlirLLVMDISubroutineTypeAttrGetName(void) {
+ return wrap(DISubroutineTypeAttr::name);
+}
+
MlirAttribute mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId) {
return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(unwrap(recId))));
}
@@ -369,6 +431,10 @@ MlirAttribute mlirLLVMDISubprogramAttrGet(
llvm::CastTo<DINodeAttr>)));
}
+MlirStringRef mlirLLVMDISubprogramAttrGetName(void) {
+ return wrap(DISubprogramAttr::name);
+}
+
MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram) {
return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getScope());
}
@@ -408,6 +474,10 @@ MlirAttribute mlirLLVMDIModuleAttrGet(MlirContext ctx, MlirAttribute file,
line, isDecl));
}
+MlirStringRef mlirLLVMDIModuleAttrGetName(void) {
+ return wrap(DIModuleAttr::name);
+}
+
MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule) {
return wrap(cast<DIModuleAttr>(unwrap(diModule)).getScope());
}
@@ -426,8 +496,16 @@ MlirAttribute mlirLLVMDIImportedEntityAttrGet(
llvm::CastTo<DINodeAttr>)));
}
+MlirStringRef mlirLLVMDIImportedEntityAttrGetName(void) {
+ return wrap(DIImportedEntityAttr::name);
+}
+
MlirAttribute mlirLLVMDIAnnotationAttrGet(MlirContext ctx, MlirAttribute name,
MlirAttribute value) {
return wrap(DIAnnotationAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
cast<StringAttr>(unwrap(value))));
}
+
+MlirStringRef mlirLLVMDIAnnotationAttrGetName(void) {
+ return wrap(DIAnnotationAttr::name);
+}
diff --git a/mlir/lib/CAPI/Dialect/SparseTensor.cpp b/mlir/lib/CAPI/Dialect/SparseTensor.cpp
index cf25b5263678f..aab3b640bd9cc 100644
--- a/mlir/lib/CAPI/Dialect/SparseTensor.cpp
+++ b/mlir/lib/CAPI/Dialect/SparseTensor.cpp
@@ -62,6 +62,10 @@ MlirAttribute mlirSparseTensorEncodingAttrGet(
crdWidth, unwrap(explicitVal), unwrap(implicitVal)));
}
+MlirStringRef mlirSparseTensorEncodingAttrGetName(void) {
+ return wrap(SparseTensorEncodingAttr::name);
+}
+
MlirAffineMap mlirSparseTensorEncodingAttrGetDimToLvl(MlirAttribute attr) {
return wrap(cast<SparseTensorEncodingAttr>(unwrap(attr)).getDimToLvl());
}
diff --git a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp
index 8d57ab6b59e79..0e447c9104010 100644
--- a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp
+++ b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp
@@ -41,6 +41,10 @@ MlirAttribute mlirAffineMapAttrGet(MlirAffineMap map) {
return wrap(AffineMapAttr::get(unwrap(map)));
}
+MlirStringRef mlirAffineMapAttrGetName(void) {
+ return wrap(AffineMapAttr::name);
+}
+
MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr) {
return wrap(llvm::cast<AffineMapAttr>(unwrap(attr)).getValue());
}
@@ -65,6 +69,8 @@ MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements,
elements, attrs)));
}
+MlirStringRef mlirArrayAttrGetName(void) { return wrap(ArrayAttr::name); }
+
intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr) {
return static_cast<intptr_t>(llvm::cast<ArrayAttr>(unwrap(attr)).size());
}
@@ -93,6 +99,10 @@ MlirAttribute mlirDictionaryAttrGet(MlirContext ctx, intptr_t numElements,
return wrap(DictionaryAttr::get(unwrap(ctx), attributes));
}
+MlirStringRef mlirDictionaryAttrGetName(void) {
+ return wrap(DictionaryAttr::name);
+}
+
intptr_t mlirDictionaryAttrGetNumElements(MlirAttribute attr) {
return static_cast<intptr_t>(llvm::cast<DictionaryAttr>(unwrap(attr)).size());
}
@@ -149,6 +159,8 @@ MlirAttribute mlirIntegerAttrGet(MlirType type, int64_t value) {
return wrap(IntegerAttr::get(unwrap(type), value));
}
+MlirStringRef mlirIntegerAttrGetName(void) { return wrap(IntegerAttr::name); }
+
int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr) {
return llvm::cast<IntegerAttr>(unwrap(attr)).getInt();
}
@@ -197,6 +209,10 @@ MlirAttribute mlirIntegerSetAttrGet(MlirIntegerSet set) {
return wrap(IntegerSetAttr::get(unwrap(set)));
}
+MlirStringRef mlirIntegerSetAttrGetName(void) {
+ return wrap(IntegerSetAttr::name);
+}
+
MlirIntegerSet mlirIntegerSetAttrGetValue(MlirAttribute attr) {
return wrap(llvm::cast<IntegerSetAttr>(unwrap(attr)).getValue());
}
@@ -217,6 +233,8 @@ MlirAttribute mlirOpaqueAttrGet(MlirContext ctx, MlirStringRef dialectNamespace,
StringRef(data, dataLength), unwrap(type)));
}
+MlirStringRef mlirOpaqueAttrGetName(void) { return wrap(OpaqueAttr::name); }
+
MlirStringRef mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr) {
return wrap(
llvm::cast<OpaqueAttr>(unwrap(attr)).getDialectNamespace().strref());
@@ -242,6 +260,8 @@ MlirAttribute mlirStringAttrGet(MlirContext ctx, MlirStringRef str) {
return wrap((Attribute)StringAttr::get(unwrap(ctx), unwrap(str)));
}
+MlirStringRef mlirStringAttrGetName(void) { return wrap(StringAttr::name); }
+
MlirAttribute mlirStringAttrTypedGet(MlirType type, MlirStringRef str) {
return wrap((Attribute)StringAttr::get(unwrap(str), unwrap(type)));
}
@@ -273,6 +293,10 @@ MlirAttribute mlirSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol,
return wrap(SymbolRefAttr::get(symbolAttr, refs));
}
+MlirStringRef mlirSymbolRefAttrGetName(void) {
+ return wrap(SymbolRefAttr::name);
+}
+
MlirStringRef mlirSymbolRefAttrGetRootReference(MlirAttribute attr) {
return wrap(
llvm::cast<SymbolRefAttr>(unwrap(attr)).getRootReference().getValue());
@@ -314,6 +338,10 @@ MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol) {
return wrap(FlatSymbolRefAttr::get(unwrap(ctx), unwrap(symbol)));
}
+MlirStringRef mlirFlatSymbolRefAttrGetName(void) {
+ return wrap(FlatSymbolRefAttr::name);
+}
+
MlirStringRef mlirFlatSymbolRefAttrGetValue(MlirAttribute attr) {
return wrap(llvm::cast<FlatSymbolRefAttr>(unwrap(attr)).getValue());
}
@@ -330,6 +358,8 @@ MlirAttribute mlirTypeAttrGet(MlirType type) {
return wrap(TypeAttr::get(unwrap(type)));
}
+MlirStringRef mlirTypeAttrGetName(void) { return wrap(TypeAttr::name); }
+
MlirType mlirTypeAttrGetValue(MlirAttribute attr) {
return wrap(llvm::cast<TypeAttr>(unwrap(attr)).getValue());
}
@@ -348,6 +378,8 @@ MlirAttribute mlirUnitAttrGet(MlirContext ctx) {
return wrap(UnitAttr::get(unwrap(ctx)));
}
+MlirStringRef mlirUnitAttrGetName(void) { return wrap(UnitAttr::name); }
+
MlirTypeID mlirUnitAttrGetTypeID(void) { return wrap(UnitAttr::getTypeID()); }
//===----------------------------------------------------------------------===//
@@ -810,6 +842,10 @@ MlirAttribute mlirUnmanagedDenseResourceElementsAttrGet(
unwrap(name), std::move(blob)));
}
+MlirStringRef mlirDenseResourceElementsAttrGetName(void) {
+ return wrap(DenseResourceElementsAttr::name);
+}
+
template <typename U, typename T>
static MlirAttribute getDenseResource(MlirType shapedType, MlirStringRef name,
intptr_t numElements, const T *elements) {
@@ -824,66 +860,121 @@ MlirAttribute mlirUnmanagedDenseBoolResourceElementsAttrGet(
return getDenseResource<DenseBoolResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseBoolResourceElementsAttrGetName(void) {
+ return wrap(DenseBoolResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseUInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint8_t *elements) {
return getDenseResource<DenseUI8ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseUInt8ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI8ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseUInt16ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint16_t *elements) {
return getDenseResource<DenseUI16ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseUInt16ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI16ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseUInt32ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint32_t *elements) {
return getDenseResource<DenseUI32ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseUInt32ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI32ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseUInt64ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint64_t *elements) {
return getDenseResource<DenseUI64ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseUInt64ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI64ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int8_t *elements) {
return getDenseResource<DenseUI8ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseInt8ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI8ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseInt16ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int16_t *elements) {
return getDenseResource<DenseUI16ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseInt16ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI16ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseInt32ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int32_t *elements) {
return getDenseResource<DenseUI32ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseInt32ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI32ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseInt64ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int64_t *elements) {
return getDenseResource<DenseUI64ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseInt64ResourceElementsAttrGetName(void) {
+ return wrap(DenseUI64ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseFloatResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const float *elements) {
return getDenseResource<DenseF32ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseFloatResourceElementsAttrGetName(void) {
+ return wrap(DenseF32ResourceElementsAttr::name);
+}
+
MlirAttribute mlirUnmanagedDenseDoubleResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const double *elements) {
return getDenseResource<DenseF64ResourceElementsAttr>(shapedType, name,
numElements, elements);
}
+
+MlirStringRef mlirDenseDoubleResourceElementsAttrGetName(void) {
+ return wrap(DenseF64ResourceElementsAttr::name);
+}
+
template <typename U, typename T>
static T getDenseResourceVal(MlirAttribute attr, intptr_t pos) {
return (*llvm::cast<U>(unwrap(attr)).tryGetAsArrayRef())[pos];
@@ -981,6 +1072,10 @@ MlirAttribute mlirStridedLayoutAttrGet(MlirContext ctx, int64_t offset,
ArrayRef<int64_t>(strides, numStrides)));
}
+MlirStringRef mlirStridedLayoutAttrGetName(void) {
+ return wrap(StridedLayoutAttr::name);
+}
+
int64_t mlirStridedLayoutAttrGetOffset(MlirAttribute attr) {
return llvm::cast<StridedLayoutAttr>(unwrap(attr)).getOffset();
}
>From f18db46c28d122840b43d4c9beec1a1e85c699f2 Mon Sep 17 00:00:00 2001
From: PragmaTwice <twice at apache.org>
Date: Wed, 7 Jan 2026 17:23:49 +0800
Subject: [PATCH 2/6] add PyConcreteAttribute::name
---
mlir/include/mlir/Bindings/Python/IRAttributes.h | 1 +
mlir/include/mlir/Bindings/Python/IRCore.h | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/mlir/include/mlir/Bindings/Python/IRAttributes.h b/mlir/include/mlir/Bindings/Python/IRAttributes.h
index d64e32037664c..cfc1ddf77ec2a 100644
--- a/mlir/include/mlir/Bindings/Python/IRAttributes.h
+++ b/mlir/include/mlir/Bindings/Python/IRAttributes.h
@@ -77,6 +77,7 @@ class MLIR_PYTHON_API_EXPORTED PyAffineMapAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirAffineMapAttrGetTypeID;
+ static inline const MlirStringRef name = mlirAffineMapAttrGetName();
static void bindDerived(ClassTy &c);
};
diff --git a/mlir/include/mlir/Bindings/Python/IRCore.h b/mlir/include/mlir/Bindings/Python/IRCore.h
index 729cbb6df3267..fdb30e88750b4 100644
--- a/mlir/include/mlir/Bindings/Python/IRCore.h
+++ b/mlir/include/mlir/Bindings/Python/IRCore.h
@@ -1066,6 +1066,7 @@ class MLIR_PYTHON_API_EXPORTED PyConcreteAttribute : public BaseTy {
using IsAFunctionTy = bool (*)(MlirAttribute);
using GetTypeIDFunctionTy = MlirTypeID (*)();
static constexpr GetTypeIDFunctionTy getTypeIdFunction = nullptr;
+ static inline const MlirStringRef name{};
using Base = PyConcreteAttribute;
PyConcreteAttribute() = default;
@@ -1136,6 +1137,12 @@ class MLIR_PYTHON_API_EXPORTED PyConcreteAttribute : public BaseTy {
/*replace*/ true);
}
+ if (DerivedTy::name.length != 0) {
+ cls.def_prop_ro_static("attr_name", [](nanobind::object & /*self*/) {
+ return nanobind::str(DerivedTy::name.data, DerivedTy::name.length);
+ });
+ }
+
DerivedTy::bindDerived(cls);
}
>From c91ffa4f9bad71fa9a31a0baf87eaf3200a9ba29 Mon Sep 17 00:00:00 2001
From: PragmaTwice <twice at apache.org>
Date: Wed, 7 Jan 2026 18:26:17 +0800
Subject: [PATCH 3/6] add more Py..Attr::name
---
mlir/include/mlir/Bindings/Python/IRAttributes.h | 12 ++++++++++++
mlir/include/mlir/Bindings/Python/IRCore.h | 1 +
mlir/lib/Bindings/Python/DialectGPU.cpp | 1 +
mlir/lib/Bindings/Python/DialectSparseTensor.cpp | 2 ++
4 files changed, 16 insertions(+)
diff --git a/mlir/include/mlir/Bindings/Python/IRAttributes.h b/mlir/include/mlir/Bindings/Python/IRAttributes.h
index cfc1ddf77ec2a..05d64b0d91b1b 100644
--- a/mlir/include/mlir/Bindings/Python/IRAttributes.h
+++ b/mlir/include/mlir/Bindings/Python/IRAttributes.h
@@ -90,6 +90,7 @@ class MLIR_PYTHON_API_EXPORTED PyIntegerSetAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirIntegerSetAttrGetTypeID;
+ static inline const MlirStringRef name = mlirIntegerSetAttrGetName();
static void bindDerived(ClassTy &c);
};
@@ -292,6 +293,7 @@ class MLIR_PYTHON_API_EXPORTED PyArrayAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirArrayAttrGetTypeID;
+ static inline const MlirStringRef name = mlirArrayAttrGetName();
class PyArrayAttributeIterator {
public:
@@ -333,6 +335,7 @@ class MLIR_PYTHON_API_EXPORTED PyIntegerAttribute
static constexpr IsAFunctionTy isaFunction = mlirAttributeIsAInteger;
static constexpr const char *pyClassName = "IntegerAttr";
using PyConcreteAttribute::PyConcreteAttribute;
+ static inline const MlirStringRef name = mlirIntegerAttrGetName();
static void bindDerived(ClassTy &c);
@@ -357,6 +360,7 @@ class MLIR_PYTHON_API_EXPORTED PySymbolRefAttribute
static constexpr IsAFunctionTy isaFunction = mlirAttributeIsASymbolRef;
static constexpr const char *pyClassName = "SymbolRefAttr";
using PyConcreteAttribute::PyConcreteAttribute;
+ static inline const MlirStringRef name = mlirSymbolRefAttrGetName();
static PySymbolRefAttribute fromList(const std::vector<std::string> &symbols,
PyMlirContext &context);
@@ -370,6 +374,7 @@ class MLIR_PYTHON_API_EXPORTED PyFlatSymbolRefAttribute
static constexpr IsAFunctionTy isaFunction = mlirAttributeIsAFlatSymbolRef;
static constexpr const char *pyClassName = "FlatSymbolRefAttr";
using PyConcreteAttribute::PyConcreteAttribute;
+ static inline const MlirStringRef name = mlirFlatSymbolRefAttrGetName();
static void bindDerived(ClassTy &c);
};
@@ -382,6 +387,7 @@ class MLIR_PYTHON_API_EXPORTED PyOpaqueAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirOpaqueAttrGetTypeID;
+ static inline const MlirStringRef name = mlirOpaqueAttrGetName();
static void bindDerived(ClassTy &c);
};
@@ -508,6 +514,8 @@ class MLIR_PYTHON_API_EXPORTED PyDenseResourceElementsAttribute
mlirAttributeIsADenseResourceElements;
static constexpr const char *pyClassName = "DenseResourceElementsAttr";
using PyConcreteAttribute::PyConcreteAttribute;
+ static inline const MlirStringRef name =
+ mlirDenseResourceElementsAttrGetName();
static PyDenseResourceElementsAttribute
getFromBuffer(const nb_buffer &buffer, const std::string &name,
@@ -525,6 +533,7 @@ class MLIR_PYTHON_API_EXPORTED PyDictAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirDictionaryAttrGetTypeID;
+ static inline const MlirStringRef name = mlirDictionaryAttrGetName();
intptr_t dunderLen() const;
@@ -556,6 +565,7 @@ class MLIR_PYTHON_API_EXPORTED PyTypeAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirTypeAttrGetTypeID;
+ static inline const MlirStringRef name = mlirTypeAttrGetName();
static void bindDerived(ClassTy &c);
};
@@ -569,6 +579,7 @@ class MLIR_PYTHON_API_EXPORTED PyUnitAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirUnitAttrGetTypeID;
+ static inline const MlirStringRef name = mlirUnitAttrGetName();
static void bindDerived(ClassTy &c);
};
@@ -582,6 +593,7 @@ class MLIR_PYTHON_API_EXPORTED PyStridedLayoutAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirStridedLayoutAttrGetTypeID;
+ static inline const MlirStringRef name = mlirStridedLayoutAttrGetName();
static void bindDerived(ClassTy &c);
};
diff --git a/mlir/include/mlir/Bindings/Python/IRCore.h b/mlir/include/mlir/Bindings/Python/IRCore.h
index fdb30e88750b4..4af8420851bc1 100644
--- a/mlir/include/mlir/Bindings/Python/IRCore.h
+++ b/mlir/include/mlir/Bindings/Python/IRCore.h
@@ -1158,6 +1158,7 @@ class MLIR_PYTHON_API_EXPORTED PyStringAttribute
using PyConcreteAttribute::PyConcreteAttribute;
static constexpr GetTypeIDFunctionTy getTypeIdFunction =
mlirStringAttrGetTypeID;
+ static inline const MlirStringRef name = mlirStringAttrGetName();
static void bindDerived(ClassTy &c);
};
diff --git a/mlir/lib/Bindings/Python/DialectGPU.cpp b/mlir/lib/Bindings/Python/DialectGPU.cpp
index a3af9eed48e7a..067abda53d0a8 100644
--- a/mlir/lib/Bindings/Python/DialectGPU.cpp
+++ b/mlir/lib/Bindings/Python/DialectGPU.cpp
@@ -51,6 +51,7 @@ struct AsyncTokenType : PyConcreteType<AsyncTokenType> {
struct ObjectAttr : PyConcreteAttribute<ObjectAttr> {
static constexpr IsAFunctionTy isaFunction = mlirAttributeIsAGPUObjectAttr;
static constexpr const char *pyClassName = "ObjectAttr";
+ static inline const MlirStringRef name = mlirGPUObjectAttrGetName();
using Base::Base;
static void bindDerived(ClassTy &c) {
diff --git a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp
index ad0c81ec31bb0..b8c8b58c88d0b 100644
--- a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp
+++ b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp
@@ -46,6 +46,8 @@ struct EncodingAttr : PyConcreteAttribute<EncodingAttr> {
static constexpr IsAFunctionTy isaFunction =
mlirAttributeIsASparseTensorEncodingAttr;
static constexpr const char *pyClassName = "EncodingAttr";
+ static inline const MlirStringRef name =
+ mlirSparseTensorEncodingAttrGetName();
using Base::Base;
static void bindDerived(ClassTy &c) {
>From fc3b8202c4a37e490652a6d8e74c2b336266c21a Mon Sep 17 00:00:00 2001
From: PragmaTwice <twice at apache.org>
Date: Wed, 7 Jan 2026 20:29:52 +0800
Subject: [PATCH 4/6] add test case
---
mlir/test/python/ir/attributes.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/mlir/test/python/ir/attributes.py b/mlir/test/python/ir/attributes.py
index 5ab671bd4d298..96f873e4914e7 100644
--- a/mlir/test/python/ir/attributes.py
+++ b/mlir/test/python/ir/attributes.py
@@ -717,3 +717,31 @@ def testConcreteAttributesRoundTrip():
print(repr(Attribute.parse("42.0 : f32")))
assert IntegerAttr.static_typeid is not None
+
+
+# CHECK-LABEL: TEST: testAttrNames
+ at run
+def testAttrNames():
+ with Context():
+ # CHECK: builtin.affine_map
+ print(AffineMapAttr.attr_name)
+ # CHECK: builtin.integer_set
+ print(IntegerSetAttr.attr_name)
+ # CHECK: builtin.array
+ print(ArrayAttr.attr_name)
+ # CHECK: builtin.integer
+ print(IntegerAttr.attr_name)
+ # CHECK: builtin.symbol_ref
+ print(SymbolRefAttr.attr_name)
+ # CHECK: builtin.opaque
+ print(OpaqueAttr.attr_name)
+ # CHECK: builtin.dictionary
+ print(DictAttr.attr_name)
+ # CHECK: builtin.type
+ print(TypeAttr.attr_name)
+ # CHECK: builtin.unit
+ print(UnitAttr.attr_name)
+ # CHECK: builtin.strided_layout
+ print(StridedLayoutAttr.attr_name)
+ # CHECK: builtin.dense_resource_elements
+ print(DenseResourceElementsAttr.attr_name)
>From 2004aebe52b4ab8dd6fb92f4a63886180e0d92a2 Mon Sep 17 00:00:00 2001
From: PragmaTwice <twice at apache.org>
Date: Wed, 7 Jan 2026 20:31:45 +0800
Subject: [PATCH 5/6] add string attr case
---
mlir/test/python/ir/attributes.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mlir/test/python/ir/attributes.py b/mlir/test/python/ir/attributes.py
index 96f873e4914e7..15a5b5ed3a81c 100644
--- a/mlir/test/python/ir/attributes.py
+++ b/mlir/test/python/ir/attributes.py
@@ -745,3 +745,5 @@ def testAttrNames():
print(StridedLayoutAttr.attr_name)
# CHECK: builtin.dense_resource_elements
print(DenseResourceElementsAttr.attr_name)
+ # CHECK: builtin.string
+ print(StringAttr.attr_name)
>From 8d1e0b1bc0a3b7c645bc92898d372d5cd4ae1a1c Mon Sep 17 00:00:00 2001
From: PragmaTwice <twice at apache.org>
Date: Wed, 7 Jan 2026 20:43:19 +0800
Subject: [PATCH 6/6] remove useless func
---
mlir/include/mlir-c/BuiltinAttributes.h | 31 -----------------
mlir/lib/CAPI/IR/BuiltinAttributes.cpp | 44 -------------------------
2 files changed, 75 deletions(-)
diff --git a/mlir/include/mlir-c/BuiltinAttributes.h b/mlir/include/mlir-c/BuiltinAttributes.h
index 9ca547816b84c..ee6ff1bc869c9 100644
--- a/mlir/include/mlir-c/BuiltinAttributes.h
+++ b/mlir/include/mlir-c/BuiltinAttributes.h
@@ -618,85 +618,54 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseBoolResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int *elements);
-MLIR_CAPI_EXPORTED MlirStringRef mlirDenseBoolResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseUInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint8_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseUInt8ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int8_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef mlirDenseInt8ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseUInt16ResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const uint16_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseUInt16ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt16ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int16_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseInt16ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseUInt32ResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const uint32_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseUInt32ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt32ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int32_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseInt32ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseUInt64ResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const uint64_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseUInt64ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseInt64ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int64_t *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseInt64ResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute mlirUnmanagedDenseFloatResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const float *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseFloatResourceElementsAttrGetName(void);
-
MLIR_CAPI_EXPORTED MlirAttribute
mlirUnmanagedDenseDoubleResourceElementsAttrGet(MlirType shapedType,
MlirStringRef name,
intptr_t numElements,
const double *elements);
-MLIR_CAPI_EXPORTED MlirStringRef
-mlirDenseDoubleResourceElementsAttrGetName(void);
-
/// Returns the pos-th value (flat contiguous indexing) of a specific type
/// contained by the given dense resource elements attribute.
MLIR_CAPI_EXPORTED bool
diff --git a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp
index 0e447c9104010..dd5b81f1b4cbb 100644
--- a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp
+++ b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp
@@ -861,10 +861,6 @@ MlirAttribute mlirUnmanagedDenseBoolResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseBoolResourceElementsAttrGetName(void) {
- return wrap(DenseBoolResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseUInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint8_t *elements) {
@@ -872,10 +868,6 @@ MlirAttribute mlirUnmanagedDenseUInt8ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseUInt8ResourceElementsAttrGetName(void) {
- return wrap(DenseUI8ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseUInt16ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint16_t *elements) {
@@ -883,10 +875,6 @@ MlirAttribute mlirUnmanagedDenseUInt16ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseUInt16ResourceElementsAttrGetName(void) {
- return wrap(DenseUI16ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseUInt32ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint32_t *elements) {
@@ -894,10 +882,6 @@ MlirAttribute mlirUnmanagedDenseUInt32ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseUInt32ResourceElementsAttrGetName(void) {
- return wrap(DenseUI32ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseUInt64ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const uint64_t *elements) {
@@ -905,10 +889,6 @@ MlirAttribute mlirUnmanagedDenseUInt64ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseUInt64ResourceElementsAttrGetName(void) {
- return wrap(DenseUI64ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseInt8ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int8_t *elements) {
@@ -916,10 +896,6 @@ MlirAttribute mlirUnmanagedDenseInt8ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseInt8ResourceElementsAttrGetName(void) {
- return wrap(DenseUI8ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseInt16ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int16_t *elements) {
@@ -927,10 +903,6 @@ MlirAttribute mlirUnmanagedDenseInt16ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseInt16ResourceElementsAttrGetName(void) {
- return wrap(DenseUI16ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseInt32ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int32_t *elements) {
@@ -938,10 +910,6 @@ MlirAttribute mlirUnmanagedDenseInt32ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseInt32ResourceElementsAttrGetName(void) {
- return wrap(DenseUI32ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseInt64ResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const int64_t *elements) {
@@ -949,10 +917,6 @@ MlirAttribute mlirUnmanagedDenseInt64ResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseInt64ResourceElementsAttrGetName(void) {
- return wrap(DenseUI64ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseFloatResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const float *elements) {
@@ -960,10 +924,6 @@ MlirAttribute mlirUnmanagedDenseFloatResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseFloatResourceElementsAttrGetName(void) {
- return wrap(DenseF32ResourceElementsAttr::name);
-}
-
MlirAttribute mlirUnmanagedDenseDoubleResourceElementsAttrGet(
MlirType shapedType, MlirStringRef name, intptr_t numElements,
const double *elements) {
@@ -971,10 +931,6 @@ MlirAttribute mlirUnmanagedDenseDoubleResourceElementsAttrGet(
numElements, elements);
}
-MlirStringRef mlirDenseDoubleResourceElementsAttrGetName(void) {
- return wrap(DenseF64ResourceElementsAttr::name);
-}
-
template <typename U, typename T>
static T getDenseResourceVal(MlirAttribute attr, intptr_t pos) {
return (*llvm::cast<U>(unwrap(attr)).tryGetAsArrayRef())[pos];
More information about the Mlir-commits
mailing list