From f437bcdd4c5981a7d27df9205dac985d29bebf72 Mon Sep 17 00:00:00 2001 From: nihuini Date: Thu, 28 Jan 2021 16:31:29 +0800 Subject: [PATCH] enable fp16s and int8s on newer adreno/mali, actually enable int8 tests --- src/gpu.cpp | 10 +++++----- tests/test_convolution.cpp | 2 +- tests/test_innerproduct.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gpu.cpp b/src/gpu.cpp index 07a7625bf..bec5893bc 100644 --- a/src/gpu.cpp +++ b/src/gpu.cpp @@ -1392,12 +1392,12 @@ int create_gpu_instance() if (gpu_info.support_VK_KHR_8bit_storage) { - gpu_info.support_int8_storage = query8BitStorageFeatures.storageBuffer8BitAccess && query8BitStorageFeatures.uniformAndStorageBuffer8BitAccess; + gpu_info.support_int8_storage = query8BitStorageFeatures.storageBuffer8BitAccess; } if (gpu_info.support_VK_KHR_16bit_storage && queryFeatures.features.shaderStorageImageExtendedFormats) { // shaderStorageImageExtendedFormats enables r16f format in storage image - gpu_info.support_fp16_storage = query16BitStorageFeatures.storageBuffer16BitAccess && query16BitStorageFeatures.uniformAndStorageBuffer16BitAccess; + gpu_info.support_fp16_storage = query16BitStorageFeatures.storageBuffer16BitAccess; } if (gpu_info.support_VK_KHR_shader_float16_int8) { @@ -1416,7 +1416,7 @@ int create_gpu_instance() // vkGetPhysicalDeviceFeatures(physicalDevice, &features); } - if (physicalDeviceProperties.vendorID == 0x13b5) + if (physicalDeviceProperties.vendorID == 0x13b5 && physicalDeviceProperties.apiVersion < VK_MAKE_VERSION(1, 0, 82)) { // the 16bit_storage implementation of arm mali driver is buggy :[ gpu_info.support_fp16_storage = false; @@ -1830,7 +1830,7 @@ VulkanDevice::VulkanDevice(int device_index) enabled8BitStorageFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR; enabled8BitStorageFeatures.pNext = 0; enabled8BitStorageFeatures.storageBuffer8BitAccess = info.support_int8_storage(); - enabled8BitStorageFeatures.uniformAndStorageBuffer8BitAccess = info.support_int8_storage(); + enabled8BitStorageFeatures.uniformAndStorageBuffer8BitAccess = VK_FALSE; enabled8BitStorageFeatures.storagePushConstant8 = VK_FALSE; if (support_VK_KHR_get_physical_device_properties2 && info.support_VK_KHR_8bit_storage()) { @@ -1843,7 +1843,7 @@ VulkanDevice::VulkanDevice(int device_index) enabled16BitStorageFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR; enabled16BitStorageFeatures.pNext = 0; enabled16BitStorageFeatures.storageBuffer16BitAccess = info.support_fp16_storage(); - enabled16BitStorageFeatures.uniformAndStorageBuffer16BitAccess = info.support_fp16_storage(); + enabled16BitStorageFeatures.uniformAndStorageBuffer16BitAccess = VK_FALSE; enabled16BitStorageFeatures.storagePushConstant16 = VK_FALSE; enabled16BitStorageFeatures.storageInputOutput16 = VK_FALSE; if (support_VK_KHR_get_physical_device_properties2 && info.support_VK_KHR_16bit_storage()) diff --git a/tests/test_convolution.cpp b/tests/test_convolution.cpp index ce85a3872..8ebe13e37 100644 --- a/tests/test_convolution.cpp +++ b/tests/test_convolution.cpp @@ -208,7 +208,7 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int fprintf(stderr, "test_convolution_int8 failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d requant=%d\n", w, h, c, outch, kernel, dilation, stride, pad, bias, requant); } - return 0; + return ret; } static int test_convolution_1() diff --git a/tests/test_innerproduct.cpp b/tests/test_innerproduct.cpp index 6e7df02d9..db32698a2 100644 --- a/tests/test_innerproduct.cpp +++ b/tests/test_innerproduct.cpp @@ -119,7 +119,7 @@ static int test_innerproduct_int8(const ncnn::Mat& a, int outch, int bias) fprintf(stderr, "test_innerproduct_int8 failed a.dims=%d a=(%d %d %d) outch=%d bias=%d\n", a.dims, a.w, a.h, a.c, outch, bias); } - return 0; + return ret; } static int test_innerproduct_3()