radv: partially enable VK_KHR_shader_float16_int8
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 1 Apr 2019 14:18:11 +0000 (16:18 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 1 Apr 2019 16:53:59 +0000 (18:53 +0200)
Only 8-bit integers for now, float16 requires a bit more work.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_extensions.py
src/amd/vulkan/radv_shader.c

index d26557fd449e9688bde2bf8eeb6c5b8fcfcf2db7..ffec7cfdb19e02dc303b5eabaae61cb2366666d8 100644 (file)
@@ -902,6 +902,14 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->storagePushConstant8 = enabled;
                        break;
                }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR: {
+                       VkPhysicalDeviceFloat16Int8FeaturesKHR *features =
+                               (VkPhysicalDeviceFloat16Int8FeaturesKHR*)ext;
+                       bool enabled = pdevice->rad_info.chip_class >= VI;
+                       features->shaderFloat16 = VK_FALSE;
+                       features->shaderInt8 = enabled;
+                       break;
+               }
                default:
                        break;
                }
index 79562ff6e97be850f3d485e86cef82ab0682bcc7..4b118b4ba824badae7a9c0696282943ce0bc464d 100644 (file)
@@ -82,6 +82,7 @@ EXTENSIONS = [
     Extension('VK_KHR_relaxed_block_layout',              1, True),
     Extension('VK_KHR_sampler_mirror_clamp_to_edge',      1, True),
     Extension('VK_KHR_shader_draw_parameters',            1, True),
+    Extension('VK_KHR_shader_float16_int8',               1, 'device->rad_info.chip_class >= VI'),
     Extension('VK_KHR_storage_buffer_storage_class',      1, True),
     Extension('VK_KHR_surface',                          25, 'RADV_HAS_SURFACE'),
     Extension('VK_KHR_surface_protected_capabilities',    1, 'RADV_HAS_SURFACE'),
index f905dfd9e5b353d266a0d1251123319ea87384e0..d3d073d1db81a9e80049d7788eed23cc14bca7cb 100644 (file)
@@ -251,6 +251,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
                                .trinary_minmax = true,
                                .variable_pointers = true,
                                .storage_8bit = true,
+                               .int8 = true,
                        },
                        .ubo_ptr_type = glsl_vector_type(GLSL_TYPE_UINT, 2),
                        .ssbo_ptr_type = glsl_vector_type(GLSL_TYPE_UINT, 2),