[Mlir-commits] [mlir] [mlir][x86] Add extra patterns for AMX nano-kernel lowering (acc with zero constant) (PR #222513)

Julian Oppermann llvmlistbot at llvm.org
Thu Sep 10 05:21:43 PDT 2026


================
@@ -27,6 +27,34 @@ using namespace mlir::x86;
 
 namespace {
 
+// Return true if the operation is a constant dense element
+// attribute.
+static bool isZeroVectorConstant(Operation *op) {
+  auto constantOp = llvm::dyn_cast<arith::ConstantOp>(op);
+  if (!constantOp)
+    return false;
+
+  auto vectorType = llvm::dyn_cast<VectorType>(constantOp.getType());
+  if (!vectorType)
+    return false;
+
+  auto denseAttr = llvm::dyn_cast<DenseElementsAttr>(constantOp.getValue());
+  if (!denseAttr || !denseAttr.isSplat())
+    return false;
+
+  mlir::Type elementType = vectorType.getElementType();
+
+  if (llvm::isa<FloatType>(elementType)) {
----------------
jopperm wrote:

Nits (throughout this method): Drop braces and `mlir::`/`llvm::` namespaces if possible.

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


More information about the Mlir-commits mailing list