[Mlir-commits] [mlir] [mlir][vector] Implement lowering for 1D vector.deinterleave operations (PR #93042)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 22 08:01:55 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 11b97da83141db857361ec9535dcd637ffcd0439 4449999a62ad09639f209f0764790e1ea9421565 -- mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 94a2954f9a..293d833696 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -1776,22 +1776,24 @@ struct VectorDeinterleaveOpLowering
     auto loc = deinterleaveOp.getLoc();
 
     if (resultType.getRank() != 1)
-        return rewriter.notifyMatchFailure(deinterleaveOp,
-                                           "deinterleaveOp not rank 1");
+      return rewriter.notifyMatchFailure(deinterleaveOp,
+                                         "deinterleaveOp not rank 1");
 
     if (resultType.isScalable()) {
-        auto llvmTypeConverter = this->getTypeConverter();
-        auto deinterleaveResults = deinterleaveOp.getResultTypes();
-        auto packedOpResults = llvmTypeConverter->packOperationResults(deinterleaveResults);
-        auto intrinsic = rewriter.create<LLVM::vector_deinterleave2>(loc, packedOpResults, adaptor.getSource());
-
-        auto resultOne = rewriter.create<LLVM::ExtractValueOp>(loc, intrinsic->getResult(0), 0);
-        auto resultTwo = rewriter.create<LLVM::ExtractValueOp>(loc, intrinsic->getResult(0), 1);
-
-        rewriter.replaceOp(
-          deinterleaveOp, ValueRange{resultOne, resultTwo}
-        );
-        return success();
+      auto llvmTypeConverter = this->getTypeConverter();
+      auto deinterleaveResults = deinterleaveOp.getResultTypes();
+      auto packedOpResults =
+          llvmTypeConverter->packOperationResults(deinterleaveResults);
+      auto intrinsic = rewriter.create<LLVM::vector_deinterleave2>(
+          loc, packedOpResults, adaptor.getSource());
+
+      auto resultOne = rewriter.create<LLVM::ExtractValueOp>(
+          loc, intrinsic->getResult(0), 0);
+      auto resultTwo = rewriter.create<LLVM::ExtractValueOp>(
+          loc, intrinsic->getResult(0), 1);
+
+      rewriter.replaceOp(deinterleaveOp, ValueRange{resultOne, resultTwo});
+      return success();
     }
 
     int64_t resultVectorSize = resultType.getNumElements();
@@ -1804,20 +1806,18 @@ struct VectorDeinterleaveOpLowering
 
     for (int i = 0; i < sourceType.getNumElements(); ++i) {
       if (i % 2 == 0)
-          shuffleMaskOne.push_back(i);
+        shuffleMaskOne.push_back(i);
       else
-          shuffleMaskTwo.push_back(i);
+        shuffleMaskTwo.push_back(i);
     }
 
     auto evenShuffle = rewriter.create<LLVM::ShuffleVectorOp>(
-      loc, adaptor.getSource(), poison, shuffleMaskOne);
+        loc, adaptor.getSource(), poison, shuffleMaskOne);
     auto oddShuffle = rewriter.create<LLVM::ShuffleVectorOp>(
-      loc, adaptor.getSource(), poison, shuffleMaskTwo);
+        loc, adaptor.getSource(), poison, shuffleMaskTwo);
 
-    rewriter.replaceOp(
-      deinterleaveOp, ValueRange{evenShuffle, oddShuffle}
-    );
-    return::success();
+    rewriter.replaceOp(deinterleaveOp, ValueRange{evenShuffle, oddShuffle});
+    return ::success();
   }
 };
 
@@ -1846,8 +1846,7 @@ void mlir::populateVectorToLLVMConversionPatterns(
                VectorSplatOpLowering, VectorSplatNdOpLowering,
                VectorScalableInsertOpLowering, VectorScalableExtractOpLowering,
                MaskedReductionOpConversion, VectorInterleaveOpLowering,
-               VectorDeinterleaveOpLowering>(
-      converter);
+               VectorDeinterleaveOpLowering>(converter);
   // Transfer ops with rank > 1 are handled by VectorToSCF.
   populateVectorTransferLoweringPatterns(patterns, /*maxTransferRank=*/1);
 }

``````````

</details>


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


More information about the Mlir-commits mailing list