Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 10 additions & 5 deletions ggml/src/ggml-tsavorite/ggml-tsavorite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,21 +718,26 @@ static void ggml_tsavorite_free(struct ggml_backend_tsavorite_context *ctx) {
// delay to allow any file operations to complete for runtime

GGML_TSAVORITE_LOG_INFO("Delaying tsi_finalize for 2 sec");
sleep(2);
tsi_finalize();
GGML_TSAVORITE_LOG_INFO("End %s\n", __func__);
tsirt::utils::TSIProfiler::finalize();
if (runtime_initialized == true) {
sleep(2);
runtime_initialized = false;
tsi_finalize();
tsirt::utils::TSIProfiler::finalize();
sleep(2);
}
std::cout << "\nOPU Profiling Results:" << std::endl;
std::cout << tsirt::utils::TSIProfiler::getFormattedResults(
/*truncateFuncNames*/ true)
<< std::endl;
sleep(2);
GGML_TSAVORITE_LOG_INFO("End %s\n", __func__);
return;
}

void
tsi_cleanup() {
if (runtime_initialized != true)
return;
runtime_initialized = false;
tsi_finalize();
GGML_TSAVORITE_LOG_INFO("Start %s\n", __func__);
tsirt::utils::TSIProfiler::finalize();
Expand Down
1 change: 1 addition & 0 deletions tools/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ int main(int argc, char ** argv) {
common_perf_print(ctx, smpl);

common_sampler_free(smpl);
ggml_backend_cleanup();

llama_backend_free();

Expand Down