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

Arun Thangamani llvmlistbot at llvm.org
Fri Sep 11 00:03:33 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();
----------------
arun-thmn wrote:

Nice, idea. Updated the method to use `isZeroIntegerOrFloat `

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


More information about the Mlir-commits mailing list