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

Add destroy_gpu_instance() function new parameter need_wait about it will wait for all devices to be idle before destroy #4763

Merged
merged 20 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7db5444
Add get_gpu_instance() function and Organized the instance class codes.
whyb Apr 17, 2023
e48623d
Move class __ncnn_vulkan_instance_holder declaration from gpu.h to g…
whyb Apr 17, 2023
1042565
Delete empty line changes
whyb Apr 17, 2023
a479422
Reimplement the sleep() and get_current_time() functions using modern…
whyb Apr 28, 2023
6eb3bb7
Fixed build error for __riscv not support c++ 11 thread
whyb Apr 28, 2023
ed932ba
Add NCNN_SIMPLESTL Macro
whyb May 5, 2023
00b9f28
Fix simple stl's compiler build error
whyb May 12, 2023
67ef283
Fix linux-gcc-cpp03-nostdio-nostring-simplestl build error
whyb May 12, 2023
d1e079c
Use u_int64_t type parameters in linux-gcc-cpp03-nostdio-nostring-sim…
whyb May 15, 2023
2ad85f0
change uint64_t&u_int64_t to unsigned long long int
whyb May 15, 2023
cec75bc
Remove include stdint.h and change function sleep() default paramete…
whyb May 16, 2023
85c15a0
apply code-format changes
whyb May 16, 2023
be921fd
Update benchmark.cpp
nihui May 16, 2023
b25ac10
Merge branch 'Tencent:master' into master
whyb May 30, 2023
c0e5f51
Add destroy_gpu_instance() function new parameter need_wait about it …
whyb May 30, 2023
7ba55f9
Fix build error
whyb May 30, 2023
6ffb1f8
Fix build error for pybind
whyb May 30, 2023
f21ec97
Merge branch 'master' into vkDeviceWaitIdle
nihui Apr 1, 2024
cf2f520
Merge branch 'Tencent:master' into vkDeviceWaitIdle
whyb Apr 7, 2024
70f1169
destroy_gpu_instance() will internally ensure that all vulkan devices…
whyb Apr 7, 2024
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
13 changes: 13 additions & 0 deletions src/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2091,6 +2091,19 @@ void destroy_gpu_instance()
if (g_instance.created == 0)
return;

for (int i = 0; i < NCNN_MAX_GPU_COUNT; i++)
{
VulkanDevice* vulkan_device = g_default_vkdev[i];
if (vulkan_device)
{
VkDevice vkdev = g_default_vkdev[i]->vkdevice();
if (vkdev)
{
vkDeviceWaitIdle(vkdev);
}
}
}

// NCNN_LOGE("destroy_gpu_instance");

if (g_instance.glslang_initialized)
Expand Down
1 change: 1 addition & 0 deletions src/gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ NCNN_EXPORT VkInstance get_gpu_instance();

// Destroy VkInstance object and free the memory of the associated object
// Usually called in the destructor of the main program exit
// The function will internally ensure that all vulkan devices are idle before proceeding with destruction.
NCNN_EXPORT void destroy_gpu_instance();

// vulkan core
Expand Down
Loading