Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MLIR][XLA] Fix ops erase bug in DeadTempBufferRemoval #37687

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions tensorflow/compiler/xla/service/mlir_gpu/kernel_lowering.cc
Expand Up @@ -244,14 +244,19 @@ 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);
}
}
};

Expand Down