[Mlir-commits] [mlir] [MLIR][ROCDL] Convert `math::fpowi` to ROCDL call (PR #122640)

Jakub Kuderski llvmlistbot at llvm.org
Mon Jan 13 09:06:29 PST 2025


================
@@ -57,9 +58,9 @@ struct OpToFuncCallLowering : public ConvertOpToLLVMPattern<SourceOp> {
         std::is_base_of<OpTrait::OneResult<SourceOp>, SourceOp>::value,
         "expected single result op");
 
-    static_assert(std::is_base_of<OpTrait::SameOperandsAndResultType<SourceOp>,
-                                  SourceOp>::value,
-                  "expected op with same operand and result types");
+    if (op->getResultTypes().front() != op->getOperand(0).getType())
+      return rewriter.notifyMatchFailure(
+          op, "expected op with same operand and result types");
----------------
kuhar wrote:

We can do `if constexpr` such that for `SameOperandsAndResultType` we don't add any overhead, and for the new case like yours we do a runtime `assert`. The reason for an assertion over a match failure is that this would be a programmer error (incompatible op / intrinsic type) instead of IR that just doesn't match.

https://github.com/llvm/llvm-project/pull/122640


More information about the Mlir-commits mailing list