[Mlir-commits] [mlir] [mlir][vector] Add support for linearizing Extract, ExtractStridedSlice, Shuffle VectorOps in VectorLinearize (PR #88204)

Diego Caballero llvmlistbot at llvm.org
Fri Apr 12 14:56:08 PDT 2024


================
@@ -139,9 +373,19 @@ void mlir::vector::populateVectorLinearizeTypeConversionsAndLegality(
                       ? typeConverter.isLegal(op)
                       : true);
         }
+        if (isa<vector::ShuffleOp>(op)) {
+          return (isLessThanTargetBitWidth(op, targetBitWidth)
+                      ? (typeConverter.isLegal(op) &&
+                         op->getResult(0)
+                                 .getType()
+                                 .cast<mlir::VectorType>()
+                                 .getRank() == 1)
+                      : true);
+        }
         return std::nullopt;
       });
 
-  patterns.add<LinearizeConstant, LinearizeVectorizable>(
+  patterns.add<LinearizeConstant, LinearizeVectorizable, LinearizeVectorShffle,
+               LinearizeVectorExtract, LinearizeVectorExtractStridedSlice>(
----------------
dcaballe wrote:

Could we move this to a different `populate` method? Flattening an elementwise op is potentially a no-op but generating shuffles for extract ops could have a noticeable impact in performance

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


More information about the Mlir-commits mailing list