[Mlir-commits] [mlir] [mlir][spirv] Add vector.interleave to spirv.VectorShuffle conversion (PR #93240)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu May 23 14:22:11 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 10be6c96b831a3511d2b381d5e1130d6b7e3e2ff 98b4b90759a60b0d2b4a54f7f012ab4e5ef04cde -- mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
index b86ebe1a4b..7dc56aae74 100644
--- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
+++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
@@ -585,12 +585,12 @@ struct VectorInterleaveOpConvert final
   LogicalResult
   matchAndRewrite(vector::InterleaveOp interleaveOp, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
-     // Check the source vector type
+    // Check the source vector type
     auto sourceType = interleaveOp.getSourceVectorType();
     if (sourceType.getRank() != 1 || sourceType.isScalable()) {
       return rewriter.notifyMatchFailure(interleaveOp,
                                          "unsupported source vector type");
-    }  
+    }
 
     // Check the result vector type
     auto oldResultType = interleaveOp.getResultVectorType();
@@ -602,8 +602,8 @@ struct VectorInterleaveOpConvert final
     // Interleave the indices
     int n = sourceType.getNumElements();
     auto seq = llvm::seq<int64_t>(2 * n);
-    auto indices = llvm::to_vector(llvm::map_range(
-        seq, [n](int i) { return (i % 2 ? n : 0) + i / 2; }));
+    auto indices = llvm::to_vector(
+        llvm::map_range(seq, [n](int i) { return (i % 2 ? n : 0) + i / 2; }));
 
     // Emit a SPIR-V shuffle.
     rewriter.replaceOpWithNewOp<spirv::VectorShuffleOp>(
@@ -611,7 +611,7 @@ struct VectorInterleaveOpConvert final
         rewriter.getI32ArrayAttr(indices));
 
     llvm::errs() << "vector.interleave to spirv.VectorShuffle succeeded\n";
-    
+
     return success();
   }
 };
@@ -859,10 +859,10 @@ void mlir::populateVectorToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
       VectorReductionPattern<CL_INT_MAX_MIN_OPS>,
       VectorReductionFloatMinMax<CL_FLOAT_MAX_MIN_OPS>,
       VectorReductionFloatMinMax<GL_FLOAT_MAX_MIN_OPS>, VectorShapeCast,
-      VectorInsertStridedSliceOpConvert, VectorShuffleOpConvert, 
-      VectorInterleaveOpConvert, VectorSplatPattern, 
-      VectorLoadOpConverter, VectorStoreOpConverter>(
-      typeConverter, patterns.getContext(), PatternBenefit(1));
+      VectorInsertStridedSliceOpConvert, VectorShuffleOpConvert,
+      VectorInterleaveOpConvert, VectorSplatPattern, VectorLoadOpConverter,
+      VectorStoreOpConverter>(typeConverter, patterns.getContext(),
+                              PatternBenefit(1));
 
   // Make sure that the more specialized dot product pattern has higher benefit
   // than the generic one that extracts all elements.

``````````

</details>


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


More information about the Mlir-commits mailing list