From 522f135d06c3f3e18f8dce1cdf7af001dbc105de Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 2 Aug 2021 19:48:55 +0100 Subject: [PATCH] radv: expose VK_KHR_shader_integer_dot_product Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Part-of: --- docs/features.txt | 1 + docs/relnotes/new_features.txt | 1 + src/amd/vulkan/radv_device.c | 46 ++++++++++++++++++++++++++++++++++ src/amd/vulkan/radv_shader.c | 2 ++ 4 files changed, 50 insertions(+) diff --git a/docs/features.txt b/docs/features.txt index 5e2cf45f2ed..cb994398208 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -491,6 +491,7 @@ Khronos extensions that are not part of any Vulkan version: VK_KHR_pipeline_executable_properties DONE (anv, radv, tu) VK_KHR_push_descriptor DONE (anv, lvp, radv, tu) VK_KHR_shader_clock DONE (anv, radv) + VK_KHR_shader_integer_dot_product DONE (radv) VK_KHR_shader_non_semantic_info DONE (anv, radv) VK_KHR_shader_subgroup_uniform_control_flow DONE (anv, radv) VK_KHR_shader_terminate_invocation DONE (anv, radv, tu) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 1d5d1cdfa7b..5652d4a3b83 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -9,3 +9,4 @@ GL 4.5 compatibility on llvmpipe VK_EXT_primitive_topology_list_restart on RADV and lavapipe. ES 3.2 on zink VK_KHR_depth_stencil_resolve on lavapipe +VK_KHR_shader_integer_dot_product on RADV. diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index ed25ab5f268..6a90663e471 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -437,6 +437,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .KHR_shader_draw_parameters = true, .KHR_shader_float16_int8 = true, .KHR_shader_float_controls = true, + .KHR_shader_integer_dot_product = true, .KHR_shader_non_semantic_info = true, .KHR_shader_subgroup_extended_types = true, .KHR_shader_subgroup_uniform_control_flow = true, @@ -1706,6 +1707,12 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, features->primitiveTopologyPatchListRestart = false; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES_KHR: { + VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR *features = + (VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR *)ext; + features->shaderIntegerDotProduct = true; + break; + } default: break; } @@ -2418,6 +2425,45 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, props->maxMultiDrawCount = 2048; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR: { + VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR *props = + (VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR *)ext; + + bool accel = pdevice->rad_info.has_accelerated_dot_product; + + props->integerDotProduct8BitUnsignedAccelerated = accel; + props->integerDotProduct8BitSignedAccelerated = accel; + props->integerDotProduct8BitMixedSignednessAccelerated = false; + props->integerDotProduct4x8BitPackedUnsignedAccelerated = accel; + props->integerDotProduct4x8BitPackedSignedAccelerated = accel; + props->integerDotProduct4x8BitPackedMixedSignednessAccelerated = false; + props->integerDotProduct16BitUnsignedAccelerated = accel; + props->integerDotProduct16BitSignedAccelerated = accel; + props->integerDotProduct16BitMixedSignednessAccelerated = false; + props->integerDotProduct32BitUnsignedAccelerated = false; + props->integerDotProduct32BitSignedAccelerated = false; + props->integerDotProduct32BitMixedSignednessAccelerated = false; + props->integerDotProduct64BitUnsignedAccelerated = false; + props->integerDotProduct64BitSignedAccelerated = false; + props->integerDotProduct64BitMixedSignednessAccelerated = false; + props->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = accel; + props->integerDotProductAccumulatingSaturating8BitSignedAccelerated = accel; + props->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = false; + props->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = accel; + props->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = accel; + props->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = + false; + props->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = accel; + props->integerDotProductAccumulatingSaturating16BitSignedAccelerated = accel; + props->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = false; + props->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = false; + props->integerDotProductAccumulatingSaturating32BitSignedAccelerated = false; + props->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated = false; + props->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated = false; + props->integerDotProductAccumulatingSaturating64BitSignedAccelerated = false; + props->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = false; + break; + } default: break; } diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 0b9d3d82835..46142843fab 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -84,6 +84,8 @@ radv_get_nir_options(struct radv_physical_device *device) .lower_iadd_sat = device->rad_info.chip_class <= GFX8, .has_fsub = true, .has_isub = true, + .has_dot_4x8 = device->rad_info.has_accelerated_dot_product, + .has_dot_2x16 = device->rad_info.has_accelerated_dot_product, .use_scoped_barrier = true, .max_unroll_iterations = 32, .max_unroll_iterations_aggressive = 128,