[Mlir-commits] [mlir] add extra check on distribute types to avoid crashes (PR #102952)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Aug 12 12:01:11 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-vector

Author: Bangtian Liu (bangtianliu)

<details>
<summary>Changes</summary>

This PR addresses the issue detailed in https://github.com/iree-org/iree/issues/17948. 

The problem occurs when distributed types are set to NULL, leading to compilation crashes.









---
Full diff: https://github.com/llvm/llvm-project/pull/102952.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp (+3) 


``````````diff
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
index 7285ad65fb549e..29899f44eb2e22 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
@@ -1689,6 +1689,9 @@ struct WarpOpScfForOp : public OpRewritePattern<WarpExecuteOnLane0Op> {
           }
         });
 
+    if(llvm::any_of(distTypes, [](Type type){return !type;}))
+      return failure();
+
     SmallVector<size_t> newRetIndices;
     WarpExecuteOnLane0Op newWarpOp = moveRegionToNewWarpOpAndAppendReturns(
         rewriter, warpOp, escapingValues.getArrayRef(), distTypes,

``````````

</details>


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


More information about the Mlir-commits mailing list