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

fix issue: no member named create_gpu_instance in namespace ncnn #5471

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions src/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4549,4 +4549,24 @@ int resolve_shader_info(const uint32_t* spv_data, size_t spv_data_size, ShaderIn

} // namespace ncnn

#else

namespace ncnn {

int create_gpu_instance(const char* driver_path)
{
return 0;
}
Comment on lines +4556 to +4559
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use NCNN_LOGE to warn users that ncnn has not been compiled with Vulkan support, and CPU computation will always be used.


void destroy_gpu_instance()
{
}

int get_gpu_count()
{
return 0;
}

} // namespace ncnn

#endif // NCNN_VULKAN
10 changes: 10 additions & 0 deletions src/gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ class NCNN_EXPORT ShaderInfo

NCNN_EXPORT int resolve_shader_info(const uint32_t* spv_data, size_t spv_data_size, ShaderInfo& shader_info);

} // namespace ncnn
#else
namespace ncnn {

NCNN_EXPORT int create_gpu_instance(const char* driver_path = 0);

NCNN_EXPORT void destroy_gpu_instance(void);

NCNN_EXPORT int get_gpu_count(void);

} // namespace ncnn

#endif // NCNN_VULKAN
Expand Down
7 changes: 7 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2517,6 +2517,13 @@ void Extractor::set_staging_vkallocator(VkAllocator* allocator)
{
d->opt.staging_vkallocator = allocator;
}

#else

void Extractor::set_vulkan_compute(bool enable)
{
}

#endif // NCNN_VULKAN

#if NCNN_STRING
Expand Down
2 changes: 2 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ class NCNN_EXPORT Extractor
void set_workspace_vkallocator(VkAllocator* allocator);

void set_staging_vkallocator(VkAllocator* allocator);
#else
void set_vulkan_compute(bool enable);
#endif // NCNN_VULKAN

#if NCNN_STRING
Expand Down
Loading