radv: only expose shaderFloat16 for chips with double rate fp16
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 5 Apr 2020 07:25:18 +0000 (09:25 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 9 Apr 2020 11:34:36 +0000 (13:34 +0200)
This disables shaderFloat16 on GFX8 because only GFX9+ supports
double rate packed math.

This improves consistency regarding other AMD Vulkan drivers and
it makes no sense to enable that feature without packed math.

This also reduces performance with Wolfeinstein Youngblood if
fp16 is forced enabled on GFX8, while it's similar on GFX9.

We might re-introduce that feature in the future with ACO support
if it ends up being faster and correct.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4453>

src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_shader.c

index 030fba00d117dd69782e0b6b5cb23b8a8e7e72a2..097f54931b94b10933fd724061a7542992fe3086 100644 (file)
@@ -1106,7 +1106,7 @@ void radv_GetPhysicalDeviceFeatures2(
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES: {
                        VkPhysicalDeviceShaderFloat16Int8Features *features =
                                (VkPhysicalDeviceShaderFloat16Int8Features*)ext;
-                       features->shaderFloat16 = pdevice->rad_info.chip_class >= GFX8 && !pdevice->use_aco;
+                       features->shaderFloat16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco;
                        features->shaderInt8 = !pdevice->use_aco;
                        break;
                }
@@ -1239,7 +1239,7 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->storagePushConstant8 = !pdevice->use_aco;
                        features->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9;
                        features->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9;
-                       features->shaderFloat16 = pdevice->rad_info.chip_class >= GFX8 && !pdevice->use_aco;
+                       features->shaderFloat16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco;
                        features->shaderInt8 = !pdevice->use_aco;
                        features->descriptorIndexing = true;
                        features->shaderInputAttachmentArrayDynamicIndexing = true;
index bb88b368d0531ef06a380c1d5010e59a9004628e..b04da4346604b0f617aba8f58ad9319fcf46ec5f 100644 (file)
@@ -350,7 +350,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
                                .device_group = true,
                                .draw_parameters = true,
                                .float_controls = true,
-                               .float16 = !device->physical_device->use_aco,
+                               .float16 = device->physical_device->rad_info.has_double_rate_fp16 && !device->physical_device->use_aco,
                                .float64 = true,
                                .geometry_streams = true,
                                .image_ms_array = true,