From f5dd6dfe012666123bb59b9a4f8e9afb46d67414 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Thu, 31 May 2018 11:44:21 +0200 Subject: [PATCH] anv: enable VK_KHR_shader_float_controls and SPV_KHR_float_controls MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This adds support for VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR and enables de Vulkan and SPIR-V extensions. Also, notice that this includes the updates applied to the VkPhysicalDeviceFloatControlsPropertiesKHR structure in the extension VK_KHR_shader_float_controls v4 and Vulkan 1.1.116. Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Andres Gomez Reviewed-by: Caio Marcelo de Oliveira Filho --- src/intel/vulkan/anv_device.c | 31 ++++++++++++++++++++++++++++++ src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_pipeline.c | 1 + 3 files changed, 33 insertions(+) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 50d910780cb..3d0198958f3 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1688,6 +1688,37 @@ void anv_GetPhysicalDeviceProperties2( props->requiredSubgroupSizeStages = VK_SHADER_STAGE_COMPUTE_BIT; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR : { + VkPhysicalDeviceFloatControlsPropertiesKHR *properties = (void *)ext; + properties->denormBehaviorIndependence = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR; + properties->roundingModeIndependence = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR; + + /* Broadwell does not support HF denorms and there are restrictions + * other gens. According to Kabylake's PRM: + * + * "math - Extended Math Function + * [...] + * Restriction : Half-float denorms are always retained." + */ + properties->shaderDenormFlushToZeroFloat16 = false; + properties->shaderDenormPreserveFloat16 = pdevice->info.gen > 8; + properties->shaderRoundingModeRTEFloat16 = true; + properties->shaderRoundingModeRTZFloat16 = true; + properties->shaderSignedZeroInfNanPreserveFloat16 = true; + + properties->shaderDenormFlushToZeroFloat32 = true; + properties->shaderDenormPreserveFloat32 = true; + properties->shaderRoundingModeRTEFloat32 = true; + properties->shaderRoundingModeRTZFloat32 = true; + properties->shaderSignedZeroInfNanPreserveFloat32 = true; + + properties->shaderDenormFlushToZeroFloat64 = true; + properties->shaderDenormPreserveFloat64 = true; + properties->shaderRoundingModeRTEFloat64 = true; + properties->shaderRoundingModeRTZFloat64 = true; + properties->shaderSignedZeroInfNanPreserveFloat64 = true; + break; + } case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT: { VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *props = diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 7e7ce428987..185fff92c73 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -110,6 +110,7 @@ EXTENSIONS = [ 'device->info.gen >= 9 && device->use_softpin'), Extension('VK_KHR_shader_draw_parameters', 1, True), Extension('VK_KHR_shader_float16_int8', 1, 'device->info.gen >= 8'), + Extension('VK_KHR_shader_float_controls', 1, 'device->info.gen >= 8'), Extension('VK_KHR_storage_buffer_storage_class', 1, True), Extension('VK_KHR_surface', 25, 'ANV_HAS_SURFACE'), Extension('VK_KHR_surface_protected_capabilities', 1, 'ANV_HAS_SURFACE'), diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 05dc54960ef..64e60525d77 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -191,6 +191,7 @@ anv_shader_compile_to_nir(struct anv_device *device, .physical_storage_buffer_address = pdevice->has_a64_buffer_access, .post_depth_coverage = pdevice->info.gen >= 9, .runtime_descriptor_array = true, + .float_controls = pdevice->info.gen >= 8, .shader_viewport_index_layer = true, .stencil_export = pdevice->info.gen >= 9, .storage_8bit = pdevice->info.gen >= 8, -- 2.30.2