From 31c1cb06adabcdfca0f25839909c8e837aa8e24f Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 17 Oct 2022 11:18:57 +0200 Subject: [PATCH] radv: Use available dot product instructions on gfx11. Signed-off-by: Georg Lehmann Reviewed-by: Rhys Perry Part-of: --- src/amd/vulkan/radv_device.c | 17 +++++++++-------- src/amd/vulkan/radv_shader.c | 5 ++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 4f69ed61e66..7d3175d87c6 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -2269,14 +2269,15 @@ radv_get_physical_device_properties_1_3(struct radv_physical_device *pdevice, p->maxInlineUniformTotalSize = UINT16_MAX; bool accel = pdevice->rad_info.has_accelerated_dot_product; + bool gfx11plus = pdevice->rad_info.gfx_level >= GFX11; p->integerDotProduct8BitUnsignedAccelerated = accel; p->integerDotProduct8BitSignedAccelerated = accel; - p->integerDotProduct8BitMixedSignednessAccelerated = false; + p->integerDotProduct8BitMixedSignednessAccelerated = accel && gfx11plus; p->integerDotProduct4x8BitPackedUnsignedAccelerated = accel; p->integerDotProduct4x8BitPackedSignedAccelerated = accel; - p->integerDotProduct4x8BitPackedMixedSignednessAccelerated = false; - p->integerDotProduct16BitUnsignedAccelerated = accel; - p->integerDotProduct16BitSignedAccelerated = accel; + p->integerDotProduct4x8BitPackedMixedSignednessAccelerated = accel && gfx11plus; + p->integerDotProduct16BitUnsignedAccelerated = accel && !gfx11plus; + p->integerDotProduct16BitSignedAccelerated = accel && !gfx11plus; p->integerDotProduct16BitMixedSignednessAccelerated = false; p->integerDotProduct32BitUnsignedAccelerated = false; p->integerDotProduct32BitSignedAccelerated = false; @@ -2286,12 +2287,12 @@ radv_get_physical_device_properties_1_3(struct radv_physical_device *pdevice, p->integerDotProduct64BitMixedSignednessAccelerated = false; p->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = accel; p->integerDotProductAccumulatingSaturating8BitSignedAccelerated = accel; - p->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = false; + p->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = accel && gfx11plus; p->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = accel; p->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = accel; - p->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = false; - p->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = accel; - p->integerDotProductAccumulatingSaturating16BitSignedAccelerated = accel; + p->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = accel && gfx11plus; + p->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = accel && !gfx11plus; + p->integerDotProductAccumulatingSaturating16BitSignedAccelerated = accel && !gfx11plus; p->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = false; p->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = false; p->integerDotProductAccumulatingSaturating32BitSignedAccelerated = false; diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index f4bd677e454..7d3eb31303a 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -95,8 +95,11 @@ get_nir_options_for_stage(struct radv_physical_device *device, gl_shader_stage s .has_fsub = true, .has_isub = true, .has_sdot_4x8 = device->rad_info.has_accelerated_dot_product, + .has_sudot_4x8 = + device->rad_info.has_accelerated_dot_product && device->rad_info.gfx_level >= GFX11, .has_udot_4x8 = device->rad_info.has_accelerated_dot_product, - .has_dot_2x16 = device->rad_info.has_accelerated_dot_product, + .has_dot_2x16 = + device->rad_info.has_accelerated_dot_product && device->rad_info.gfx_level < GFX11, .has_find_msb_rev = true, .use_scoped_barrier = true, #ifdef LLVM_AVAILABLE