Linalg operations can include complex types in the src/target types.
This should include conversion between arith and complex types when
constructing linalg operations.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Arith/Utils/Utils.cpp | ||
---|---|---|
178 | nit: this function seems to be getting long, I wonder if a type switch and dispatching to helper functions would help here | |
201 | nit: use free cast functions: https://mlir.llvm.org/deprecation/ also below |
mlir/lib/Dialect/Arith/Utils/Utils.cpp | ||
---|---|---|
127 | Should operand be returned if width is equal or is it expected that canonicalized or fold would have handled that? |
mlir/lib/Dialect/Arith/Utils/Utils.cpp | ||
---|---|---|
127 | Added the return operand;. It was technically unnecessary due to the parent function checking quality, but best to handle defense in depth. |
mlir/lib/Dialect/Arith/Utils/CMakeLists.txt | ||
---|---|---|
9 | This feels off. |
mlir/lib/Dialect/Arith/Utils/CMakeLists.txt | ||
---|---|---|
9 | I agree. The question is where would be the right place to move the conversion? |
Happy to add some. I am less familiar with this area in the codebase so thoughts on how / where to test is appreciate.
mlir/lib/Dialect/Arith/Utils/Utils.cpp | ||
---|---|---|
89 | Nit: I think the static methods need some comments to say what each one of these are for? Also maybe call this convertScalarToIntDtype and so on to make it clearer that these are implementations of parts of convertScalarToDtype? |
I checked and the code from this patch is not exercised by any lit test. The helper is used with the other types in these:
Dialect/Linalg/IR/LinalgOps.cpp Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp Dialect/Linalg/Transforms/ConvertConv2DToImg2Col.cpp Dialect/SparseTensor/Transforms/CodegenUtils.cpp
So I'd think we either add some linalg/sparse tensor tests, or a new test pass.
Added tests to the Img2Col case. This included fixing the pass to work for complex types and expanding support for mixed types.
This feels off.