[Mlir-commits] [mlir] [mlir] Add Python bindings for DenseResourceElementsAttr. (PR #66319)

Stella Laurenzo llvmlistbot at llvm.org
Thu Sep 14 13:58:07 PDT 2023


================
@@ -770,6 +770,34 @@ const void *mlirDenseElementsAttrGetRawData(MlirAttribute attr) {
 // Resource blob attributes.
 //===----------------------------------------------------------------------===//
 
+bool mlirAttributeIsADenseResourceElements(MlirAttribute attr) {
+  return llvm::isa<DenseResourceElementsAttr>(unwrap(attr));
+}
+
+MlirAttribute mlirUnmanagedDenseResourceElementsAttrGet(
+    MlirType shapedType, MlirStringRef name, const void *data,
+    size_t dataLength,
----------------
stellaraccident wrote:

Oh, good call. That flushed out a bug: the alignment was being inferred as 1. I've made this explicit and in the Python bindings, where we have strides, used that to infer the alignment of the data if not specified.

https://github.com/llvm/llvm-project/pull/66319


More information about the Mlir-commits mailing list