Skip to content

Commit

Permalink
[MLIR][XLA] Fix ops erase bug in DeadTempBufferRemoval
Browse files Browse the repository at this point in the history
  • Loading branch information
xinan-jiang committed Mar 18, 2020
1 parent f17712c commit 882c731
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tensorflow/compiler/xla/service/mlir_gpu/kernel_lowering.cc
Expand Up @@ -244,14 +244,20 @@ struct DeadTempBufferRemoval : mlir::FunctionPass<DeadTempBufferRemoval> {
}

void runOnFunction() override {
llvm::SmallVector<mlir::Operation *, 8> opsToErase;
getFunction().walk([&](mlir::AllocOp allocOp) {
if (!operationConsideredDead(allocOp)) {
return;
}

// TODO(herhut): There should be a generic helper for this.
recursiveErase(allocOp);
opsToErase.push_back(allocOp);
});

for (auto *op : opsToErase) {
// TODO(herhut): There should be a generic helper for this.
recursiveErase(op);
}
opsToErase.clear();
}
};

Expand Down

0 comments on commit 882c731

Please sign in to comment.