Merge pull request #12703 from wzw-intel:vkcom
* dnn: Add a Vulkan based backend
This commit adds a new backend "DNN_BACKEND_VKCOM" and a
new target "DNN_TARGET_VULKAN". VKCOM means vulkan based
computation library.
This backend uses Vulkan API and SPIR-V shaders to do
the inference computation for layers. The layer types
that implemented in DNN_BACKEND_VKCOM include:
Conv, Concat, ReLU, LRN, PriorBox, Softmax, MaxPooling,
AvePooling, Permute
This is just a beginning work for Vulkan in OpenCV DNN,
more layer types will be supported and performance
tuning is on the way.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/vulkan: Add FindVulkan.cmake to detect Vulkan SDK
In order to build dnn with Vulkan support, need installing
Vulkan SDK and setting environment variable "VULKAN_SDK" and
add "-DWITH_VULKAN=ON" to cmake command.
You can download Vulkan SDK from:
https://vulkan.lunarg.com/sdk/home#linux
For how to install, see
https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html
respectively for linux, windows and mac.
To run the vulkan backend, also need installing mesa driver.
On Ubuntu, use this command 'sudo apt-get install mesa-vulkan-drivers'
To test, use command '$BUILD_DIR/bin/opencv_test_dnn --gtest_filter=*VkCom*'
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: dynamically load Vulkan runtime
No compile-time dependency on Vulkan library.
If Vulkan runtime is unavailable, fallback to CPU path.
Use environment "OPENCL_VULKAN_RUNTIME" to specify path to your
own vulkan runtime library.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: Add a python script to compile GLSL shaders to SPIR-V shaders
The SPIR-V shaders are in format of text-based 32-bit hexadecimal
numbers, and inserted into .cpp files as unsigned int32 array.
* dnn/Vulkan: Put Vulkan headers into 3rdparty directory and some other fixes
Vulkan header files are copied from
https://github.com/KhronosGroup/Vulkan-Docs/tree/master/include/vulkan
to 3rdparty/include
Fix the Copyright declaration issue.
Refine OpenCVDetectVulkan.cmake
* dnn/Vulkan: Add vulkan backend tests into existing ones.
Also fixed some test failures.
- Don't use bool variable as uniform for shader
- Fix dispathed group number beyond max issue
- Bypass "group > 1" convolution. This should be support in future.
* dnn/Vulkan: Fix multiple initialization in one thread.
2018-10-29 22:51:26 +08:00
|
|
|
#ifndef VULKAN_FUCHSIA_H_
|
|
|
|
#define VULKAN_FUCHSIA_H_ 1
|
|
|
|
|
|
|
|
/*
|
2023-05-19 01:02:27 +08:00
|
|
|
** Copyright 2015-2023 The Khronos Group Inc.
|
Merge pull request #12703 from wzw-intel:vkcom
* dnn: Add a Vulkan based backend
This commit adds a new backend "DNN_BACKEND_VKCOM" and a
new target "DNN_TARGET_VULKAN". VKCOM means vulkan based
computation library.
This backend uses Vulkan API and SPIR-V shaders to do
the inference computation for layers. The layer types
that implemented in DNN_BACKEND_VKCOM include:
Conv, Concat, ReLU, LRN, PriorBox, Softmax, MaxPooling,
AvePooling, Permute
This is just a beginning work for Vulkan in OpenCV DNN,
more layer types will be supported and performance
tuning is on the way.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/vulkan: Add FindVulkan.cmake to detect Vulkan SDK
In order to build dnn with Vulkan support, need installing
Vulkan SDK and setting environment variable "VULKAN_SDK" and
add "-DWITH_VULKAN=ON" to cmake command.
You can download Vulkan SDK from:
https://vulkan.lunarg.com/sdk/home#linux
For how to install, see
https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html
respectively for linux, windows and mac.
To run the vulkan backend, also need installing mesa driver.
On Ubuntu, use this command 'sudo apt-get install mesa-vulkan-drivers'
To test, use command '$BUILD_DIR/bin/opencv_test_dnn --gtest_filter=*VkCom*'
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: dynamically load Vulkan runtime
No compile-time dependency on Vulkan library.
If Vulkan runtime is unavailable, fallback to CPU path.
Use environment "OPENCL_VULKAN_RUNTIME" to specify path to your
own vulkan runtime library.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: Add a python script to compile GLSL shaders to SPIR-V shaders
The SPIR-V shaders are in format of text-based 32-bit hexadecimal
numbers, and inserted into .cpp files as unsigned int32 array.
* dnn/Vulkan: Put Vulkan headers into 3rdparty directory and some other fixes
Vulkan header files are copied from
https://github.com/KhronosGroup/Vulkan-Docs/tree/master/include/vulkan
to 3rdparty/include
Fix the Copyright declaration issue.
Refine OpenCVDetectVulkan.cmake
* dnn/Vulkan: Add vulkan backend tests into existing ones.
Also fixed some test failures.
- Don't use bool variable as uniform for shader
- Fix dispathed group number beyond max issue
- Bypass "group > 1" convolution. This should be support in future.
* dnn/Vulkan: Fix multiple initialization in one thread.
2018-10-29 22:51:26 +08:00
|
|
|
**
|
2023-05-19 01:02:27 +08:00
|
|
|
** SPDX-License-Identifier: Apache-2.0
|
Merge pull request #12703 from wzw-intel:vkcom
* dnn: Add a Vulkan based backend
This commit adds a new backend "DNN_BACKEND_VKCOM" and a
new target "DNN_TARGET_VULKAN". VKCOM means vulkan based
computation library.
This backend uses Vulkan API and SPIR-V shaders to do
the inference computation for layers. The layer types
that implemented in DNN_BACKEND_VKCOM include:
Conv, Concat, ReLU, LRN, PriorBox, Softmax, MaxPooling,
AvePooling, Permute
This is just a beginning work for Vulkan in OpenCV DNN,
more layer types will be supported and performance
tuning is on the way.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/vulkan: Add FindVulkan.cmake to detect Vulkan SDK
In order to build dnn with Vulkan support, need installing
Vulkan SDK and setting environment variable "VULKAN_SDK" and
add "-DWITH_VULKAN=ON" to cmake command.
You can download Vulkan SDK from:
https://vulkan.lunarg.com/sdk/home#linux
For how to install, see
https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html
respectively for linux, windows and mac.
To run the vulkan backend, also need installing mesa driver.
On Ubuntu, use this command 'sudo apt-get install mesa-vulkan-drivers'
To test, use command '$BUILD_DIR/bin/opencv_test_dnn --gtest_filter=*VkCom*'
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: dynamically load Vulkan runtime
No compile-time dependency on Vulkan library.
If Vulkan runtime is unavailable, fallback to CPU path.
Use environment "OPENCL_VULKAN_RUNTIME" to specify path to your
own vulkan runtime library.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: Add a python script to compile GLSL shaders to SPIR-V shaders
The SPIR-V shaders are in format of text-based 32-bit hexadecimal
numbers, and inserted into .cpp files as unsigned int32 array.
* dnn/Vulkan: Put Vulkan headers into 3rdparty directory and some other fixes
Vulkan header files are copied from
https://github.com/KhronosGroup/Vulkan-Docs/tree/master/include/vulkan
to 3rdparty/include
Fix the Copyright declaration issue.
Refine OpenCVDetectVulkan.cmake
* dnn/Vulkan: Add vulkan backend tests into existing ones.
Also fixed some test failures.
- Don't use bool variable as uniform for shader
- Fix dispathed group number beyond max issue
- Bypass "group > 1" convolution. This should be support in future.
* dnn/Vulkan: Fix multiple initialization in one thread.
2018-10-29 22:51:26 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2023-05-19 01:02:27 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
Merge pull request #12703 from wzw-intel:vkcom
* dnn: Add a Vulkan based backend
This commit adds a new backend "DNN_BACKEND_VKCOM" and a
new target "DNN_TARGET_VULKAN". VKCOM means vulkan based
computation library.
This backend uses Vulkan API and SPIR-V shaders to do
the inference computation for layers. The layer types
that implemented in DNN_BACKEND_VKCOM include:
Conv, Concat, ReLU, LRN, PriorBox, Softmax, MaxPooling,
AvePooling, Permute
This is just a beginning work for Vulkan in OpenCV DNN,
more layer types will be supported and performance
tuning is on the way.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/vulkan: Add FindVulkan.cmake to detect Vulkan SDK
In order to build dnn with Vulkan support, need installing
Vulkan SDK and setting environment variable "VULKAN_SDK" and
add "-DWITH_VULKAN=ON" to cmake command.
You can download Vulkan SDK from:
https://vulkan.lunarg.com/sdk/home#linux
For how to install, see
https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html
respectively for linux, windows and mac.
To run the vulkan backend, also need installing mesa driver.
On Ubuntu, use this command 'sudo apt-get install mesa-vulkan-drivers'
To test, use command '$BUILD_DIR/bin/opencv_test_dnn --gtest_filter=*VkCom*'
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: dynamically load Vulkan runtime
No compile-time dependency on Vulkan library.
If Vulkan runtime is unavailable, fallback to CPU path.
Use environment "OPENCL_VULKAN_RUNTIME" to specify path to your
own vulkan runtime library.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: Add a python script to compile GLSL shaders to SPIR-V shaders
The SPIR-V shaders are in format of text-based 32-bit hexadecimal
numbers, and inserted into .cpp files as unsigned int32 array.
* dnn/Vulkan: Put Vulkan headers into 3rdparty directory and some other fixes
Vulkan header files are copied from
https://github.com/KhronosGroup/Vulkan-Docs/tree/master/include/vulkan
to 3rdparty/include
Fix the Copyright declaration issue.
Refine OpenCVDetectVulkan.cmake
* dnn/Vulkan: Add vulkan backend tests into existing ones.
Also fixed some test failures.
- Don't use bool variable as uniform for shader
- Fix dispathed group number beyond max issue
- Bypass "group > 1" convolution. This should be support in future.
* dnn/Vulkan: Fix multiple initialization in one thread.
2018-10-29 22:51:26 +08:00
|
|
|
#define VK_FUCHSIA_imagepipe_surface 1
|
|
|
|
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1
|
|
|
|
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface"
|
|
|
|
typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA;
|
|
|
|
typedef struct VkImagePipeSurfaceCreateInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkImagePipeSurfaceCreateFlagsFUCHSIA flags;
|
|
|
|
zx_handle_t imagePipeHandle;
|
|
|
|
} VkImagePipeSurfaceCreateInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateImagePipeSurfaceFUCHSIA)(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
|
|
|
|
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(
|
|
|
|
VkInstance instance,
|
|
|
|
const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo,
|
|
|
|
const VkAllocationCallbacks* pAllocator,
|
|
|
|
VkSurfaceKHR* pSurface);
|
|
|
|
#endif
|
|
|
|
|
2023-05-19 01:02:27 +08:00
|
|
|
|
|
|
|
#define VK_FUCHSIA_external_memory 1
|
|
|
|
#define VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION 1
|
|
|
|
#define VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME "VK_FUCHSIA_external_memory"
|
|
|
|
typedef struct VkImportMemoryZirconHandleInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkExternalMemoryHandleTypeFlagBits handleType;
|
|
|
|
zx_handle_t handle;
|
|
|
|
} VkImportMemoryZirconHandleInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkMemoryZirconHandlePropertiesFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
uint32_t memoryTypeBits;
|
|
|
|
} VkMemoryZirconHandlePropertiesFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkMemoryGetZirconHandleInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkDeviceMemory memory;
|
|
|
|
VkExternalMemoryHandleTypeFlagBits handleType;
|
|
|
|
} VkMemoryGetZirconHandleInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryZirconHandleFUCHSIA)(VkDevice device, const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle);
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, zx_handle_t zirconHandle, VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties);
|
|
|
|
|
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandleFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo,
|
|
|
|
zx_handle_t* pZirconHandle);
|
|
|
|
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
VkExternalMemoryHandleTypeFlagBits handleType,
|
|
|
|
zx_handle_t zirconHandle,
|
|
|
|
VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define VK_FUCHSIA_external_semaphore 1
|
|
|
|
#define VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION 1
|
|
|
|
#define VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_FUCHSIA_external_semaphore"
|
|
|
|
typedef struct VkImportSemaphoreZirconHandleInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkSemaphore semaphore;
|
|
|
|
VkSemaphoreImportFlags flags;
|
|
|
|
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
|
|
|
zx_handle_t zirconHandle;
|
|
|
|
} VkImportSemaphoreZirconHandleInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkSemaphoreGetZirconHandleInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkSemaphore semaphore;
|
|
|
|
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
|
|
|
} VkSemaphoreGetZirconHandleInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreZirconHandleFUCHSIA)(VkDevice device, const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo);
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreZirconHandleFUCHSIA)(VkDevice device, const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle);
|
|
|
|
|
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreZirconHandleFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo);
|
|
|
|
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreZirconHandleFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo,
|
|
|
|
zx_handle_t* pZirconHandle);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define VK_FUCHSIA_buffer_collection 1
|
|
|
|
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferCollectionFUCHSIA)
|
|
|
|
#define VK_FUCHSIA_BUFFER_COLLECTION_SPEC_VERSION 2
|
|
|
|
#define VK_FUCHSIA_BUFFER_COLLECTION_EXTENSION_NAME "VK_FUCHSIA_buffer_collection"
|
|
|
|
typedef VkFlags VkImageFormatConstraintsFlagsFUCHSIA;
|
|
|
|
|
|
|
|
typedef enum VkImageConstraintsInfoFlagBitsFUCHSIA {
|
|
|
|
VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_RARELY_FUCHSIA = 0x00000001,
|
|
|
|
VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_OFTEN_FUCHSIA = 0x00000002,
|
|
|
|
VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_RARELY_FUCHSIA = 0x00000004,
|
|
|
|
VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_OFTEN_FUCHSIA = 0x00000008,
|
|
|
|
VK_IMAGE_CONSTRAINTS_INFO_PROTECTED_OPTIONAL_FUCHSIA = 0x00000010,
|
|
|
|
VK_IMAGE_CONSTRAINTS_INFO_FLAG_BITS_MAX_ENUM_FUCHSIA = 0x7FFFFFFF
|
|
|
|
} VkImageConstraintsInfoFlagBitsFUCHSIA;
|
|
|
|
typedef VkFlags VkImageConstraintsInfoFlagsFUCHSIA;
|
|
|
|
typedef struct VkBufferCollectionCreateInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
zx_handle_t collectionToken;
|
|
|
|
} VkBufferCollectionCreateInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkImportMemoryBufferCollectionFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkBufferCollectionFUCHSIA collection;
|
|
|
|
uint32_t index;
|
|
|
|
} VkImportMemoryBufferCollectionFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkBufferCollectionImageCreateInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkBufferCollectionFUCHSIA collection;
|
|
|
|
uint32_t index;
|
|
|
|
} VkBufferCollectionImageCreateInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkBufferCollectionConstraintsInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
uint32_t minBufferCount;
|
|
|
|
uint32_t maxBufferCount;
|
|
|
|
uint32_t minBufferCountForCamping;
|
|
|
|
uint32_t minBufferCountForDedicatedSlack;
|
|
|
|
uint32_t minBufferCountForSharedSlack;
|
|
|
|
} VkBufferCollectionConstraintsInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkBufferConstraintsInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkBufferCreateInfo createInfo;
|
|
|
|
VkFormatFeatureFlags requiredFormatFeatures;
|
|
|
|
VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints;
|
|
|
|
} VkBufferConstraintsInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkBufferCollectionBufferCreateInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkBufferCollectionFUCHSIA collection;
|
|
|
|
uint32_t index;
|
|
|
|
} VkBufferCollectionBufferCreateInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkSysmemColorSpaceFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
uint32_t colorSpace;
|
|
|
|
} VkSysmemColorSpaceFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkBufferCollectionPropertiesFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
uint32_t memoryTypeBits;
|
|
|
|
uint32_t bufferCount;
|
|
|
|
uint32_t createInfoIndex;
|
|
|
|
uint64_t sysmemPixelFormat;
|
|
|
|
VkFormatFeatureFlags formatFeatures;
|
|
|
|
VkSysmemColorSpaceFUCHSIA sysmemColorSpaceIndex;
|
|
|
|
VkComponentMapping samplerYcbcrConversionComponents;
|
|
|
|
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
|
|
|
|
VkSamplerYcbcrRange suggestedYcbcrRange;
|
|
|
|
VkChromaLocation suggestedXChromaOffset;
|
|
|
|
VkChromaLocation suggestedYChromaOffset;
|
|
|
|
} VkBufferCollectionPropertiesFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkImageFormatConstraintsInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkImageCreateInfo imageCreateInfo;
|
|
|
|
VkFormatFeatureFlags requiredFormatFeatures;
|
|
|
|
VkImageFormatConstraintsFlagsFUCHSIA flags;
|
|
|
|
uint64_t sysmemPixelFormat;
|
|
|
|
uint32_t colorSpaceCount;
|
|
|
|
const VkSysmemColorSpaceFUCHSIA* pColorSpaces;
|
|
|
|
} VkImageFormatConstraintsInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef struct VkImageConstraintsInfoFUCHSIA {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
uint32_t formatConstraintsCount;
|
|
|
|
const VkImageFormatConstraintsInfoFUCHSIA* pFormatConstraints;
|
|
|
|
VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints;
|
|
|
|
VkImageConstraintsInfoFlagsFUCHSIA flags;
|
|
|
|
} VkImageConstraintsInfoFUCHSIA;
|
|
|
|
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferCollectionFUCHSIA)(VkDevice device, const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferCollectionFUCHSIA* pCollection);
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkSetBufferCollectionImageConstraintsFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo);
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo);
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkDestroyBufferCollectionFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkAllocationCallbacks* pAllocator);
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkGetBufferCollectionPropertiesFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, VkBufferCollectionPropertiesFUCHSIA* pProperties);
|
|
|
|
|
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferCollectionFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo,
|
|
|
|
const VkAllocationCallbacks* pAllocator,
|
|
|
|
VkBufferCollectionFUCHSIA* pCollection);
|
|
|
|
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionImageConstraintsFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
VkBufferCollectionFUCHSIA collection,
|
|
|
|
const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo);
|
|
|
|
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionBufferConstraintsFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
VkBufferCollectionFUCHSIA collection,
|
|
|
|
const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo);
|
|
|
|
|
|
|
|
VKAPI_ATTR void VKAPI_CALL vkDestroyBufferCollectionFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
VkBufferCollectionFUCHSIA collection,
|
|
|
|
const VkAllocationCallbacks* pAllocator);
|
|
|
|
|
|
|
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetBufferCollectionPropertiesFUCHSIA(
|
|
|
|
VkDevice device,
|
|
|
|
VkBufferCollectionFUCHSIA collection,
|
|
|
|
VkBufferCollectionPropertiesFUCHSIA* pProperties);
|
|
|
|
#endif
|
|
|
|
|
Merge pull request #12703 from wzw-intel:vkcom
* dnn: Add a Vulkan based backend
This commit adds a new backend "DNN_BACKEND_VKCOM" and a
new target "DNN_TARGET_VULKAN". VKCOM means vulkan based
computation library.
This backend uses Vulkan API and SPIR-V shaders to do
the inference computation for layers. The layer types
that implemented in DNN_BACKEND_VKCOM include:
Conv, Concat, ReLU, LRN, PriorBox, Softmax, MaxPooling,
AvePooling, Permute
This is just a beginning work for Vulkan in OpenCV DNN,
more layer types will be supported and performance
tuning is on the way.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/vulkan: Add FindVulkan.cmake to detect Vulkan SDK
In order to build dnn with Vulkan support, need installing
Vulkan SDK and setting environment variable "VULKAN_SDK" and
add "-DWITH_VULKAN=ON" to cmake command.
You can download Vulkan SDK from:
https://vulkan.lunarg.com/sdk/home#linux
For how to install, see
https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html
https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html
respectively for linux, windows and mac.
To run the vulkan backend, also need installing mesa driver.
On Ubuntu, use this command 'sudo apt-get install mesa-vulkan-drivers'
To test, use command '$BUILD_DIR/bin/opencv_test_dnn --gtest_filter=*VkCom*'
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: dynamically load Vulkan runtime
No compile-time dependency on Vulkan library.
If Vulkan runtime is unavailable, fallback to CPU path.
Use environment "OPENCL_VULKAN_RUNTIME" to specify path to your
own vulkan runtime library.
Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
* dnn/Vulkan: Add a python script to compile GLSL shaders to SPIR-V shaders
The SPIR-V shaders are in format of text-based 32-bit hexadecimal
numbers, and inserted into .cpp files as unsigned int32 array.
* dnn/Vulkan: Put Vulkan headers into 3rdparty directory and some other fixes
Vulkan header files are copied from
https://github.com/KhronosGroup/Vulkan-Docs/tree/master/include/vulkan
to 3rdparty/include
Fix the Copyright declaration issue.
Refine OpenCVDetectVulkan.cmake
* dnn/Vulkan: Add vulkan backend tests into existing ones.
Also fixed some test failures.
- Don't use bool variable as uniform for shader
- Fix dispathed group number beyond max issue
- Bypass "group > 1" convolution. This should be support in future.
* dnn/Vulkan: Fix multiple initialization in one thread.
2018-10-29 22:51:26 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|