[Mlir-commits] [mlir] [mlir][tosa][tosa-to-linalg] Add NaN Mode Lowering (PR #125668)

Jack Frankland llvmlistbot at llvm.org
Wed Feb 19 05:22:54 PST 2025


================
@@ -267,6 +267,26 @@ extractConvZpPair(TosaConvOp op, PatternRewriter &rewriter) {
 
   return std::make_optional<ConvZpPair>(*maybeInputZp, *maybeWeightZp);
 }
+
+// Helper function to extract the NaN propagation mode from an operation.
+// Note that the for operations which support NaN mode propagation the attribute
+// is optional and its default value is "PROPAGATE".
+//
+// If the function is called with an operator that doesn't support the NaN mode
+// attribute it will return a std::nullopt.
+inline std::optional<std::string> getNanMode(Operation *op,
----------------
FranklandJack wrote:

Do you have a suggestion for how to make this more generic? The attribute is optional so we can't just test for its existence, we do need to maintain a list of ops for which it is valid somewhere.

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


More information about the Mlir-commits mailing list