[Mlir-commits] [mlir] [MLIR] Allowing unsupported conv2d op to fail gracefully from vectorization (PR #130181)

Han-Chung Wang llvmlistbot at llvm.org
Mon Mar 10 15:50:26 PDT 2025


================
@@ -1939,6 +1939,127 @@ vectorizeInsertSliceOpPrecondition(tensor::InsertSliceOp sliceOp,
   return success();
 }
 
+namespace {
+bool isCastOfBlockArgument(Operation *op) {
+  return isa<CastOpInterface>(op) && op->getNumOperands() == 1 &&
+         isa<BlockArgument>(op->getOperand(0));
+}
----------------
hanhanW wrote:

style nit: use `static` local keywords for the local methods. And we only wrap the `enum class` within the anonymous namespace. I know that it is already not consistent even in this file. But it's better to follow the guide when you touch the code. It is already not consistent, so it does not make it worse IMO.

> The problem with anonymous namespaces is that they naturally want to encourage indentation of their body, and they reduce locality of reference: if you see a random function definition in a C++ file, it is easy to see if it is marked static, but seeing if it is in an anonymous namespace requires scanning a big chunk of the file.
> 
> Because of this, we have a simple guideline: make anonymous namespaces as small as possible, and only use them for class declarations. For example:

style guide: https://llvm.org/docs/CodingStandards.html#restrict-visibility

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


More information about the Mlir-commits mailing list