[Mesa-dev] [PATCH 38/38] radv: expose float16, int16 and int8 features and extensions

Rhys Perry pendingchaos02 at gmail.com
Fri Dec 7 17:22:31 UTC 2018


Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
---
 src/amd/vulkan/radv_device.c      | 17 +++++++++++++++++
 src/amd/vulkan/radv_extensions.py |  4 ++++
 src/amd/vulkan/radv_shader.c      |  3 +++
 3 files changed, 24 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index ad057a8750..8444651a84 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -848,6 +848,23 @@ void radv_GetPhysicalDeviceFeatures2(
 			features->geometryStreams = true;
 			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 = enabled && HAVE_LLVM >= 0x0800;
+			features->shaderInt8 = enabled;
+			break;
+		}
+		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: {
+			VkPhysicalDevice8BitStorageFeaturesKHR *features =
+			    (VkPhysicalDevice8BitStorageFeaturesKHR*)ext;
+			bool enabled = pdevice->rad_info.chip_class >= VI;
+			features->storageBuffer8BitAccess = enabled;
+			features->uniformAndStorageBuffer8BitAccess = enabled;
+			features->storagePushConstant8 = enabled;
+			break;
+		}
 		default:
 			break;
 		}
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index 6bdf988d11..62c58e98af 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -91,6 +91,8 @@ EXTENSIONS = [
     Extension('VK_KHR_xlib_surface',                      6, 'VK_USE_PLATFORM_XLIB_KHR'),
     Extension('VK_KHR_multiview',                         1, True),
     Extension('VK_KHR_display',                          23, 'VK_USE_PLATFORM_DISPLAY_KHR'),
+    Extension('VK_KHR_shader_float16_int8',               1, 'device->rad_info.chip_class >= VI'),
+    Extension('VK_KHR_8bit_storage',                      1, 'device->rad_info.chip_class >= VI'),
     Extension('VK_EXT_direct_mode_display',               1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_acquire_xlib_display',              1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),
     Extension('VK_EXT_calibrated_timestamps',             1, True),
@@ -117,6 +119,8 @@ EXTENSIONS = [
     Extension('VK_AMD_shader_core_properties',            1, True),
     Extension('VK_AMD_shader_info',                       1, True),
     Extension('VK_AMD_shader_trinary_minmax',             1, True),
+    Extension('VK_AMD_gpu_shader_half_float',             1, 'device->rad_info.chip_class >= VI && HAVE_LLVM >= 0x0800'),
+    Extension('VK_AMD_gpu_shader_int16',                  1, 'device->rad_info.chip_class >= VI'),
     Extension('VK_GOOGLE_decorate_string',                1, True),
     Extension('VK_GOOGLE_hlsl_functionality1',            1, True),
 ]
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index a2ddf17680..921b9669f0 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -246,6 +246,9 @@ radv_shader_compile_to_nir(struct radv_device *device,
 				.storage_16bit = true,
 				.geometry_streams = true,
 				.transform_feedback = true,
+				.float16 = true,
+				.storage_8bit = true,
+				.int8 = true,
 			},
 		};
 		entry_point = spirv_to_nir(spirv, module->size / 4,
-- 
2.19.2



More information about the mesa-dev mailing list