[Mlir-commits] [mlir] [mlir] Decouple DenseResourceElementsAttr from BuiltinDialect (PR #191486)

Jacques Pienaar llvmlistbot at llvm.org
Sat Apr 11 13:27:58 PDT 2026


jpienaar wrote:

> This prevented custom dialects from owning resource blobs referenced by this attribute.

Adding a new resource handle is relatively simple though [1].

This change would result in having two different ways of referring to a dialect's blobmanager `dense_resource<"test::custom_blob">` and `test.dense_resource<"custom_blob">`. 

[1] ODS (we could add a helper to make this even single line class)

```tblgen
def MyDialect_DenseResourceAttr : MyDialect_Attr<"MyDenseResource", [
    ElementsAttrInterface, BlobAttrInterface
  ]> {
  let parameters = (ins
    AttributeSelfTypeParameter<"", "ShapedType">:$type,
    ResourceHandleParameter<"MyDialectResourceBlobHandle">:$rawHandle
  );
  // ... extraClassDeclaration for interface implementations ...
}
```

and

```c++
using MyDialectResourceBlobHandle = DialectResourceBlobHandle<MyDialect>;
```

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


More information about the Mlir-commits mailing list