I haven’t fleshed out a concrete proposal yet, but wanted to prefetch opinions here.
Historically we had our “standard dialect” and the LLVM dialect entirely distinct: the LLVM dialect operated on specific LLVM types. Over time things have been evolving and the LLVM dialect now reuses the builtin MLIR types when possible. The arithmetic dialect was extracted from the “standard dialect” and got some new features like “fast math”.
The arithmetic dialect still diverges from the LLVM dialect in that it handles elements wise operations on tensors for example (but we considered this not desirable right now! It was considered for removal for a while), but also the index type. On the other hand it is a bit under-defined from a semantics point of view.
So I’m wondering: does it still pull its weight? Is there a possible unification between LLVM arithmetic operations and the arith
dialect? Some way forward:
- delete the arithmetic dialect, folks can use the llvm operations: they are well defined and provide everything we need, what’s the downside? Maybe one question is how to handle the
index
type (one way would be to allow it there but require a legalization before translation?). - prune the LLVM dialect from its arithmetic operations, and make the
arith
dialect the actual subset that can translate directly to LLVM IR. That would position it likenvvm
for example: a dialect that is part of the “LLVM API surface”, designed to mix with the llvm dialect and translate directly to LLVM IR. It would still be usable independently.
@KFAF also presented the idea of a “base2” dialect that could generalize all integer computation, but it seems complementary to what I’m describing I think?