[mlir] Add a new builtin DenseResourceElementsAttr
This attributes is intended cover the current set of use cases that abuse DenseElementsAttr, e.g. when the data is large. Using resources for large data is one of the major reasons why they were added; e.g. they can be deallocated mid-compilation, they support a wide variety of data origins (e.g, heap allocated, mmap'd, etc.), they can support mutation, etc. I considered at length not having a builtin variant of this, and instead having multiple versions of this attribute for dialects that are interested, but they all boiled down to the exact same attribute definition. Given the generality of this attribute, it feels more aligned to keep it next to DenseArrayAttr (given that DenseArrayAttr covers the "small" case, and DenseResourcesElementsAttr covers the "large" case). The underlying infra used to build this attribute is general, and having a builtin attribute doesn't preclude users from defining their own when it makes sense (they can even share a blob manager with the builtin dialect to avoid data duplication). Differential Revision: https://reviews.llvm.org/D130022
Loading
Please sign in to comment