Browse Source

enable uniform 16bit and 8bit when available, fix validation error in fp16sa shader (#5233)

tags/20240102
nihui GitHub 2 years ago
parent
commit
8c4fc5e2a0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 4 deletions
  1. +18
    -4
      src/gpu.cpp

+ 18
- 4
src/gpu.cpp View File

@@ -1850,8 +1850,22 @@ int create_gpu_instance(const char* driver_path)
}
if (gpu_info.support_VK_KHR_shader_float16_int8)
{
gpu_info.support_fp16_arithmetic = queryFloat16Int8Features.shaderFloat16;
gpu_info.support_int8_arithmetic = queryFloat16Int8Features.shaderInt8;
if (gpu_info.support_fp16_storage)
{
gpu_info.support_fp16_arithmetic = queryFloat16Int8Features.shaderFloat16 && query16BitStorageFeatures.uniformAndStorageBuffer16BitAccess;
}
else
{
gpu_info.support_fp16_arithmetic = queryFloat16Int8Features.shaderFloat16;
}
if (gpu_info.support_int8_storage)
{
gpu_info.support_int8_arithmetic = queryFloat16Int8Features.shaderInt8 && query8BitStorageFeatures.uniformAndStorageBuffer8BitAccess;
}
else
{
gpu_info.support_int8_arithmetic = queryFloat16Int8Features.shaderInt8;
}
}
if (gpu_info.support_VK_KHR_sampler_ycbcr_conversion)
{
@@ -2444,7 +2458,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 = VK_FALSE;
enabled8BitStorageFeatures.uniformAndStorageBuffer8BitAccess = info.support_int8_storage() && info.support_int8_arithmetic();
enabled8BitStorageFeatures.storagePushConstant8 = VK_FALSE;
if (support_VK_KHR_get_physical_device_properties2 && info.support_VK_KHR_8bit_storage())
{
@@ -2457,7 +2471,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 = VK_FALSE;
enabled16BitStorageFeatures.uniformAndStorageBuffer16BitAccess = info.support_fp16_storage() && info.support_fp16_arithmetic();
enabled16BitStorageFeatures.storagePushConstant16 = VK_FALSE;
enabled16BitStorageFeatures.storageInputOutput16 = VK_FALSE;
if (support_VK_KHR_get_physical_device_properties2 && info.support_VK_KHR_16bit_storage())


Loading…
Cancel
Save