radv/aco: enable 8/16-bit storage and int8/int16 on GFX8+
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 6 Apr 2020 10:22:55 +0000 (11:22 +0100)
committerRhys Perry <pendingchaos02@gmail.com>
Fri, 24 Apr 2020 19:04:39 +0000 (20:04 +0100)
With this, Doom Eternal should now run with ACO on GFX8+.

The generated 8/16-bit storage code is okay but the generated int8/int16
code is currently pretty bad but it works and apparently Doom Eternal
doesn't actually use it (even though it requires it).

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4707>

docs/relnotes/new_features.txt
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_extensions.py
src/amd/vulkan/radv_shader.c

index 49541cf476382fe026ccc8978b60ae9951795d0e..701c1e5e912608e97e9771119bc4dbd48d596fe4 100644 (file)
@@ -8,3 +8,7 @@ GL_NV_viewport_array2 on nvc0 (GM200+).
 GL_NV_viewport_swizzle on nvc0 (GM200+).
 VK_KHR_shader_non_semantic_info on Intel, RADV.
 GL_EXT_draw_instanced on gles2
+VK_KHR_8bit_storage for ACO on GFX8+
+VK_KHR_16bit_storage for ACO on GFX8+ (storageInputOutput16 is still unsupported)
+shaderInt16 for ACO on GFX9+
+VK_KHR_shader_float16_int8 for ACO on GFX8+ (shaderFloat16 is still unsupported)
index bed7062ec1d1dd49dd6916c1172682c611f79624..75c72f5eb15715f749f495dbd130fe6ffe1fab42 100644 (file)
@@ -957,7 +957,7 @@ void radv_GetPhysicalDeviceFeatures(
                .shaderCullDistance                       = true,
                .shaderFloat64                            = true,
                .shaderInt64                              = true,
-               .shaderInt16                              = pdevice->rad_info.chip_class >= GFX9 && !pdevice->use_aco,
+               .shaderInt16                              = pdevice->rad_info.chip_class >= GFX9,
                .sparseBinding                            = true,
                .variableMultisampleRate                  = true,
                .inheritedQueries                         = true,
@@ -999,9 +999,10 @@ void radv_GetPhysicalDeviceFeatures2(
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
                        VkPhysicalDevice16BitStorageFeatures *features =
                            (VkPhysicalDevice16BitStorageFeatures*)ext;
-                       features->storageBuffer16BitAccess = !pdevice->use_aco;
-                       features->uniformAndStorageBuffer16BitAccess = !pdevice->use_aco;
-                       features->storagePushConstant16 = !pdevice->use_aco;
+                       bool enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
+                       features->storageBuffer16BitAccess = enable;
+                       features->uniformAndStorageBuffer16BitAccess = enable;
+                       features->storagePushConstant16 = enable;
                        features->storageInputOutput16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco && LLVM_VERSION_MAJOR >= 9;
                        break;
                }
@@ -1100,16 +1101,17 @@ void radv_GetPhysicalDeviceFeatures2(
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES: {
                        VkPhysicalDevice8BitStorageFeatures *features =
                            (VkPhysicalDevice8BitStorageFeatures *)ext;
-                       features->storageBuffer8BitAccess = !pdevice->use_aco;
-                       features->uniformAndStorageBuffer8BitAccess = !pdevice->use_aco;
-                       features->storagePushConstant8 = !pdevice->use_aco;
+                       bool enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
+                       features->storageBuffer8BitAccess = enable;
+                       features->uniformAndStorageBuffer8BitAccess = enable;
+                       features->storagePushConstant8 = enable;
                        break;
                }
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES: {
                        VkPhysicalDeviceShaderFloat16Int8Features *features =
                                (VkPhysicalDeviceShaderFloat16Int8Features*)ext;
                        features->shaderFloat16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco;
-                       features->shaderInt8 = !pdevice->use_aco;
+                       features->shaderInt8 = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
                        break;
                }
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES: {
@@ -1217,9 +1219,10 @@ void radv_GetPhysicalDeviceFeatures2(
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: {
                        VkPhysicalDeviceVulkan11Features *features =
                                (VkPhysicalDeviceVulkan11Features *)ext;
-                       features->storageBuffer16BitAccess = !pdevice->use_aco;
-                       features->uniformAndStorageBuffer16BitAccess = !pdevice->use_aco;
-                       features->storagePushConstant16 = !pdevice->use_aco;
+                       bool storage16_enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
+                       features->storageBuffer16BitAccess = storage16_enable;
+                       features->uniformAndStorageBuffer16BitAccess = storage16_enable;
+                       features->storagePushConstant16 = storage16_enable;
                        features->storageInputOutput16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco && LLVM_VERSION_MAJOR >= 9;
                        features->multiview = true;
                        features->multiviewGeometryShader = true;
@@ -1234,15 +1237,16 @@ void radv_GetPhysicalDeviceFeatures2(
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES: {
                        VkPhysicalDeviceVulkan12Features *features =
                                (VkPhysicalDeviceVulkan12Features *)ext;
+                       bool int8_enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
                        features->samplerMirrorClampToEdge = true;
                        features->drawIndirectCount = true;
-                       features->storageBuffer8BitAccess = !pdevice->use_aco;
-                       features->uniformAndStorageBuffer8BitAccess = !pdevice->use_aco;
-                       features->storagePushConstant8 = !pdevice->use_aco;
+                       features->storageBuffer8BitAccess = int8_enable;
+                       features->uniformAndStorageBuffer8BitAccess = int8_enable;
+                       features->storagePushConstant8 = int8_enable;
                        features->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9;
                        features->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9;
                        features->shaderFloat16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco;
-                       features->shaderInt8 = !pdevice->use_aco;
+                       features->shaderInt8 = int8_enable;
                        features->descriptorIndexing = true;
                        features->shaderInputAttachmentArrayDynamicIndexing = true;
                        features->shaderUniformTexelBufferArrayDynamicIndexing = true;
index 23a6bb6702faf56c9f2b5ab180dfeccfa3ef5be6..ea789bbded79c49ae846a30412a489addfd151ec 100644 (file)
@@ -52,7 +52,7 @@ class Extension:
 EXTENSIONS = [
     Extension('VK_ANDROID_external_memory_android_hardware_buffer', 3, 'RADV_SUPPORT_ANDROID_HARDWARE_BUFFER  && device->rad_info.has_syncobj_wait_for_submit'),
     Extension('VK_ANDROID_native_buffer',                 5, 'ANDROID && device->rad_info.has_syncobj_wait_for_submit'),
-    Extension('VK_KHR_16bit_storage',                     1, '!device->use_aco'),
+    Extension('VK_KHR_16bit_storage',                     1, '!device->use_aco || device->rad_info.chip_class >= GFX8'),
     Extension('VK_KHR_bind_memory2',                      1, True),
     Extension('VK_KHR_buffer_device_address',             1, True),
     Extension('VK_KHR_create_renderpass2',                1, True),
@@ -92,7 +92,7 @@ EXTENSIONS = [
     Extension('VK_KHR_shader_clock',                      1, True),
     Extension('VK_KHR_shader_draw_parameters',            1, True),
     Extension('VK_KHR_shader_float_controls',             1, True),
-    Extension('VK_KHR_shader_float16_int8',               1, '!device->use_aco'),
+    Extension('VK_KHR_shader_float16_int8',               1, '!device->use_aco || device->rad_info.chip_class >= GFX8'),
     Extension('VK_KHR_shader_non_semantic_info',          1, True),
     Extension('VK_KHR_shader_subgroup_extended_types',    1, '!device->use_aco'),
     Extension('VK_KHR_spirv_1_4',                         1, True),
@@ -109,7 +109,7 @@ 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_8bit_storage',                      1, '!device->use_aco'),
+    Extension('VK_KHR_8bit_storage',                      1, '!device->use_aco || device->rad_info.chip_class >= GFX8'),
     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_buffer_device_address',             1, True),
@@ -258,6 +258,7 @@ def _init_exts_from_xml(xml):
 
     for ext in EXTENSIONS:
         if ext.type == 'device':
+            ext.enable = '(' + ext.enable + ')'
             for dep in extra_deps(ext):
                 ext.enable += ' && ' + dep
 
index 42a664f7f369f9c4ba659878acd0480be7c95215..36a7b5f5511444bee063dfbbc6bb2e306481b576 100644 (file)
@@ -346,6 +346,8 @@ radv_shader_compile_to_nir(struct radv_device *device,
                                }
                        }
                }
+               bool int8_int16_enable = !device->physical_device->use_aco ||
+                                        device->physical_device->rad_info.chip_class >= GFX8;
                const struct spirv_to_nir_options spirv_options = {
                        .lower_ubo_ssbo_access_to_offsets = true,
                        .caps = {
@@ -369,8 +371,8 @@ radv_shader_compile_to_nir(struct radv_device *device,
                                .image_ms_array = true,
                                .image_read_without_format = true,
                                .image_write_without_format = true,
-                               .int8 = !device->physical_device->use_aco,
-                               .int16 = !device->physical_device->use_aco,
+                               .int8 = int8_int16_enable,
+                               .int16 = int8_int16_enable,
                                .int64 = true,
                                .int64_atomics = true,
                                .multiview = true,
@@ -380,8 +382,8 @@ radv_shader_compile_to_nir(struct radv_device *device,
                                .shader_clock = true,
                                .shader_viewport_index_layer = true,
                                .stencil_export = true,
-                               .storage_8bit = !device->physical_device->use_aco,
-                               .storage_16bit = !device->physical_device->use_aco,
+                               .storage_8bit = int8_int16_enable,
+                               .storage_16bit = int8_int16_enable,
                                .storage_image_ms = true,
                                .subgroup_arithmetic = true,
                                .subgroup_ballot = true,