[Mlir-commits] [mlir] [mlir][linalg][transform] Add some debug output to vectorization. (PR #66520)

Ingo Müller llvmlistbot at llvm.org
Fri Sep 15 08:23:56 PDT 2023


https://github.com/ingomueller-net created https://github.com/llvm/llvm-project/pull/66520

This helps to understand what the problem is when vectorization of structured ops failes due to mismatching vector sizes.

>From c59ab176007d673ff5db281c580c96d71bddf01a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20M=C3=BCller?= <ingomueller at google.com>
Date: Fri, 15 Sep 2023 15:22:02 +0000
Subject: [PATCH] [mlir][linalg][transform] Add some debug output to
 vectorization.

This helps to understand what the problem is when vectorization of
structured ops failes due to mismatching vector sizes.
---
 mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
index f873bd0e0b68e43..51a83c35e4cda09 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
@@ -924,7 +924,6 @@ getTensorExtractMemoryAccessPattern(tensor::ExtractOp extractOp,
       targetShape.back() == 1)
     return VectorMemoryAccessKind::Gather;
 
-
   // 2. Assume that it's a gather load when reading _from_ a tensor for which
   // the trailing dimension is 1, e.g. `tensor<1x4x1xi32>`.
   // TODO: Relax this condition.
@@ -1484,6 +1483,10 @@ static LogicalResult vectorizeDynamicLinalgOpPrecondition(linalg::LinalgOp op) {
 static LogicalResult
 isValidMaskedInputVector(ArrayRef<int64_t> shape,
                          ArrayRef<int64_t> inputVectorSizes) {
+  LDBG("Iteration space static sizes:");
+  LLVM_DEBUG(llvm::interleaveComma(shape, llvm::dbgs()));
+  LLVM_DEBUG(llvm::dbgs() << "\n");
+
   if (inputVectorSizes.size() != shape.size()) {
     LDBG("Input vector sizes don't match the number of loops");
     return failure();



More information about the Mlir-commits mailing list