Skip to content

Commit 740af37

Browse files
committed
[GPU] ASAN failure due to use of erased operation
If the target op is an scf.forall op which is erased by `rewriteOneForallCommonImpl` method it leads to asan failure since it's used later by `replaceUnitMappingIdsHelper` fn. Follows the same philosophy as done here: https://github.com/llvm/llvm-project/blob/aff98e4be05a1060e489ce62a88ee0ff365e571a/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp#L599 and later passed to the same method here: https://github.com/llvm/llvm-project/blob/aff98e4be05a1060e489ce62a88ee0ff365e571a/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp#L629
1 parent aff98e4 commit 740af37

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,8 @@ DiagnosedSilenceableFailure mlir::transform::gpu::mapNestedForallToThreadsImpl(
853853
"requires size-3 thread mapping");
854854
}
855855

856+
Block *parentBlock = target->getBlock();
857+
856858
// Create an early zero index value for replacements.
857859
Location loc = target->getLoc();
858860
Value zero = rewriter.create<arith::ConstantIndexOp>(loc, 0);
@@ -872,7 +874,7 @@ DiagnosedSilenceableFailure mlir::transform::gpu::mapNestedForallToThreadsImpl(
872874

873875
// Replace ids of dimensions known to be 1 by 0 to simplify the IR.
874876
// Here, the result of mapping determines the available mapping sizes.
875-
replaceUnitMappingIdsHelper<ThreadIdOp>(rewriter, loc, target, zero,
877+
replaceUnitMappingIdsHelper<ThreadIdOp>(rewriter, loc, parentBlock, zero,
876878
blockDims);
877879

878880
return DiagnosedSilenceableFailure::success();

0 commit comments

Comments
 (0)