[Mlir-commits] [mlir] [mlir] NamedAttribute utility generator (PR #75118)
Mehdi Amini
llvmlistbot at llvm.org
Wed Dec 13 22:56:49 PST 2023
joker-eph wrote:
> Can you point me to an example. I see getConsumedAttrName() in the Transform dialect, but it is just using a StringLiteral under the hood and the usage seems cumbersome having to get loaded dialect first. Is there a better example that is storing these on the dialect?
I don't have anything at hand: I've written this myself multiple times though. Yes you need to have a dialect pointer to get these then by nature, which is an extra step but I can't really see how to avoid though.
> the ODS class can be used throughout the code instead of "arbitrary_name" strings
How is this class any different than an "arbitrary name" though? You built a string wrapper: isn't it just like a handle to a string?
> and the ODS class can be used to Get/Set the Typed Value on arbitrary Operations
I don't quite get this part? Is this just making the `setDiscardableAttr()` API typed?
Is the whole thing here trying to make it so that the string attribute name key can only be set with a specific attribute type?
I would need to build the branch to looks a bit more, but from my read you're actually defining more than a "convenient type-safe API" and instead it is a new storage for each of these "AttrDef", even though they will be initialized with a single entry ever?
https://github.com/llvm/llvm-project/pull/75118
More information about the Mlir-commits
mailing list