File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/runner/ax_model_runner Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,7 @@ void ax_runner_ax650::deinit()
363363 if (m_handle && m_handle->handle )
364364 {
365365 std::vector<unsigned long long > free_phy_addr;
366+ std::vector<void *> free_vir_addr;
366367 for (int grpid = 0 ; grpid < group_count; grpid++)
367368 {
368369 for (auto &tensor : mgroup_output_tensors[grpid])
@@ -372,6 +373,11 @@ void ax_runner_ax650::deinit()
372373 axcl_Free ((void *)tensor.phyAddr , dev_id);
373374 free_phy_addr.push_back (tensor.phyAddr );
374375 }
376+ if (free_vir_addr.end () == std::find (free_vir_addr.begin (), free_vir_addr.end (), tensor.pVirAddr ))
377+ {
378+ free (tensor.pVirAddr );
379+ free_vir_addr.push_back (tensor.pVirAddr );
380+ }
375381 }
376382 for (auto &tensor : mgroup_input_tensors[grpid])
377383 {
@@ -380,6 +386,11 @@ void ax_runner_ax650::deinit()
380386 axcl_Free ((void *)tensor.phyAddr , dev_id);
381387 free_phy_addr.push_back (tensor.phyAddr );
382388 }
389+ if (free_vir_addr.end () == std::find (free_vir_addr.begin (), free_vir_addr.end (), tensor.pVirAddr ))
390+ {
391+ free (tensor.pVirAddr );
392+ free_vir_addr.push_back (tensor.pVirAddr );
393+ }
383394 }
384395 axcl_EngineDestroyIO (m_handle->ios [grpid], dev_id);
385396 }
You can’t perform that action at this time.
0 commit comments