[Mlir-commits] [mlir] [mlir][gpu] Eliminate redundant gpu.barrier ops (PR #71575)
Mehdi Amini
llvmlistbot at llvm.org
Thu Nov 9 01:53:21 PST 2023
================
@@ -1139,6 +1139,34 @@ void ShuffleOp::build(OpBuilder &builder, OperationState &result, Value value,
mode);
}
+//===----------------------------------------------------------------------===//
+// BarrierOp
+//===----------------------------------------------------------------------===//
+
+namespace {
+
+/// Remove gpu.barrier after gpu.barrier, the threads are already synchronized!
+struct EraseRedundantGpuBarrierOpPairs : public OpRewritePattern<BarrierOp> {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ LogicalResult matchAndRewrite(BarrierOp op,
+ PatternRewriter &rewriter) const final {
+ if (isa<BarrierOp>(op->getNextNode())) {
----------------
joker-eph wrote:
Why? That can't be null on valid IR right?
https://github.com/llvm/llvm-project/pull/71575
More information about the Mlir-commits
mailing list