[Mlir-commits] [mlir] [mlir][spirv] Lower `arith` overflow flags to corresponding SPIR-V op decorations (PR #77714)
Jakub Kuderski
llvmlistbot at llvm.org
Wed Jan 10 20:20:35 PST 2024
================
@@ -158,8 +158,61 @@ getTypeConversionFailure(ConversionPatternRewriter &rewriter, Operation *op) {
return getTypeConversionFailure(rewriter, op, op->getResultTypes().front());
}
+// TODO: Move to some common place?
+static std::string getDecorationString(spirv::Decoration decor) {
+ return llvm::convertToSnakeFromCamelCase(stringifyDecoration(decor));
+}
+
namespace {
+/// Converts elementwise unary, binary and ternary arith operations to SPIR-V
+/// operations. Op can potentially support overflow flags.
+template <typename Op, typename SPIRVOp>
+struct ElementwiseArithOpPattern : public OpConversionPattern<Op> {
----------------
kuhar wrote:
```suggestion
struct ElementwiseArithOpPattern final : OpConversionPattern<Op> {
```
https://github.com/llvm/llvm-project/pull/77714
More information about the Mlir-commits
mailing list