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

[bug] Fix potential bug of lang::Program that could be double finalized #5550

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions taichi/program/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ uint64 Program::fetch_result_uint64(int i) {
}

void Program::finalize() {
if (finalized_) {
return;
}
synchronize();

TI_TRACE("Program finalizing...");
Expand Down Expand Up @@ -498,8 +501,7 @@ void Program::fill_ndarray_fast(Ndarray *ndarray, uint32_t val) {
}

Program::~Program() {
if (!finalized_)
finalize();
finalize();
}

std::unique_ptr<AotModuleBuilder> Program::make_aot_module_builder(Arch arch) {
Expand Down