[RFC] Extend Linalg named operations for arbitrary element types

Yes, the definition of the enum was easy to find. I was just wondering where the #linalg part comes from and how the values are extracted from #linalg<"...">. Is all this auto-generated with the dialect?

Yes tablegen produces a parser and a printer for all the attributes of the dialect. It is possible to write a custom parser and printer but not recommended I would say.

@andidr and @nicolasvasilache

I have now a revision that introduces function attributes for binary and unary functions ⚙ D120110 [mlir][OpDSL] Add arithmetic function attributes.. It has two base revisions ⚙ D120108 [mlir][OpDSL] Refactor function handling. and ⚙ D120109 [mlir][OpDSL] Split arithmetic functions. that mainly touch OpDSL internals.

The best place to plugin an interface is probably by implementing a replacement of the RegionBuilderHelper methods buildUnaryFn, buildBinaryFn, and buildTypeFn.

The question is how we want to inject the logic there. Approach one was registering an external model for your custom types. I think after landing ⚙ D120110 [mlir][OpDSL] Add arithmetic function attributes. we should be in a better position to do that since there are enums for the different function categories.

Approach two is controlling the functions to use via attributes. The challenge there is to find a naming scheme that works. We may also go back to string enums but I believe having type safe enums is preferable.

Would it be an option to make the yaml generation tool more flexible or even have your own for your use case?

I came back to this after a while and submitted a new version at ⚙ D120027 [mlir][linalg] Support arbitrary element types in named operations via attributes.