[Mlir-commits] [mlir] [mlir] NamedAttribute utility generator (PR #75118)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Dec 15 05:44:18 PST 2023


sjw36 wrote:

> I checked locally and this matches my expectation: it defines a full-fledge new attribute.
> 
> I guess I still don't quite get why we would do that, when it seems like some very standard C++ can achieve the same thing. (I'll try to draft something later)

Sure, it is simple code, could easily be a template type (however, embedding the name is challenging). 
I like being about to define a specific Key and typed Value attribute that is specific to my dialect in the tablegen file with a single line.

```
def ROCDL_ReqdWorkGroupSizeAttr :
    ROCDL_NamedAttr<"ReqdWorkGroupSize", "reqd_work_group_size", "::mlir::DenseI32ArrayAttr">;
```

I did consider a new tablegen type instead of overloading AttrDef, but that seemed overly burdensome, and since the AttrDef could service the `key` aspects reasonably.

Certainly welcome a better solution. Thanks.

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


More information about the Mlir-commits mailing list