radv: remove VK_AMD_shader_info support
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 9 Mar 2022 08:48:08 +0000 (09:48 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 15 Mar 2022 19:23:53 +0000 (19:23 +0000)
This extension is quite old and useless now.
VK_KHR_pipeline_executable_properties should be used instead.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15299>

docs/features.txt
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_pipeline_cache.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_shader.c

index 4f2e786..a07f7b1 100644 (file)
@@ -596,7 +596,6 @@ Khronos extensions that are not part of any Vulkan version:
   VK_AMD_shader_explicit_vertex_parameter               DONE (radv)
   VK_AMD_shader_fragment_mask                           DONE (radv)
   VK_AMD_shader_image_load_store_lod                    DONE (radv)
-  VK_AMD_shader_info                                    DONE (radv)
   VK_AMD_shader_trinary_minmax                          DONE (radv)
   VK_AMD_texture_gather_bias_lod                        DONE (radv)
   VK_ARM_rasterization_order_attachment_access          DONE (tu)
index 8b0a106..c20caaa 100644 (file)
@@ -544,7 +544,6 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
       .AMD_shader_explicit_vertex_parameter = true,
       .AMD_shader_fragment_mask = true,
       .AMD_shader_image_load_store_lod = true,
-      .AMD_shader_info = true,
       .AMD_shader_trinary_minmax = true,
       .AMD_texture_gather_bias_lod = true,
 #ifdef ANDROID
@@ -3230,8 +3229,6 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
    device->vk.create_sync_for_memory = radv_create_sync_for_memory;
    vk_device_set_drm_fd(&device->vk, device->ws->get_fd(device->ws));
 
-   keep_shader_info = device->vk.enabled_extensions.AMD_shader_info;
-
    /* With update after bind we can't attach bo's to the command buffer
     * from the descriptor set anymore, so we have to use a global BO list.
     */
index b7fb116..6398ba0 100644 (file)
@@ -288,9 +288,7 @@ radv_pipeline_cache_add_entry(struct radv_pipeline_cache *cache, struct cache_en
 static bool
 radv_is_cache_disabled(struct radv_device *device)
 {
-   /* Pipeline caches can be disabled with RADV_DEBUG=nocache, with
-    * MESA_GLSL_CACHE_DISABLE=1, and when VK_AMD_shader_info is requested.
-    */
+   /* Pipeline caches can be disabled with RADV_DEBUG=nocache and with MESA_GLSL_CACHE_DISABLE=1. */
    return (device->instance->debug_flags & RADV_DEBUG_NO_CACHE);
 }
 
index 831731e..710265d 100644 (file)
@@ -801,7 +801,7 @@ struct radv_device {
    struct radeon_winsys_bo *trace_bo;
    uint32_t *trace_id_ptr;
 
-   /* Whether to keep shader debug info, for tracing or VK_AMD_shader_info */
+   /* Whether to keep shader debug info, for debugging. */
    bool keep_shader_info;
 
    struct radv_physical_device *physical_device;
index a8eb7eb..146b1d4 100644 (file)
@@ -2382,110 +2382,6 @@ radv_compute_spi_ps_input(const struct radv_device *device,
    return spi_ps_input;
 }
 
-VKAPI_ATTR VkResult VKAPI_CALL
-radv_GetShaderInfoAMD(VkDevice _device, VkPipeline _pipeline, VkShaderStageFlagBits shaderStage,
-                      VkShaderInfoTypeAMD infoType, size_t *pInfoSize, void *pInfo)
-{
-   RADV_FROM_HANDLE(radv_device, device, _device);
-   RADV_FROM_HANDLE(radv_pipeline, pipeline, _pipeline);
-   gl_shader_stage stage = vk_to_mesa_shader_stage(shaderStage);
-   struct radv_shader *shader = pipeline->shaders[stage];
-   VkResult result = VK_SUCCESS;
-
-   /* Spec doesn't indicate what to do if the stage is invalid, so just
-    * return no info for this. */
-   if (!shader)
-      return vk_error(device, VK_ERROR_FEATURE_NOT_PRESENT);
-
-   switch (infoType) {
-   case VK_SHADER_INFO_TYPE_STATISTICS_AMD:
-      if (!pInfo) {
-         *pInfoSize = sizeof(VkShaderStatisticsInfoAMD);
-      } else {
-         unsigned lds_multiplier = device->physical_device->rad_info.lds_encode_granularity;
-         struct ac_shader_config *conf = &shader->config;
-
-         VkShaderStatisticsInfoAMD statistics = {0};
-         statistics.shaderStageMask = shaderStage;
-         statistics.numPhysicalVgprs =
-            device->physical_device->rad_info.num_physical_wave64_vgprs_per_simd;
-         statistics.numPhysicalSgprs =
-            device->physical_device->rad_info.num_physical_sgprs_per_simd;
-         statistics.numAvailableSgprs = statistics.numPhysicalSgprs;
-
-         if (stage == MESA_SHADER_COMPUTE) {
-            unsigned *local_size = shader->info.cs.block_size;
-            unsigned workgroup_size = pipeline->shaders[MESA_SHADER_COMPUTE]->info.workgroup_size;
-
-            statistics.numAvailableVgprs =
-               statistics.numPhysicalVgprs /
-               ceil((double)workgroup_size / statistics.numPhysicalVgprs);
-
-            statistics.computeWorkGroupSize[0] = local_size[0];
-            statistics.computeWorkGroupSize[1] = local_size[1];
-            statistics.computeWorkGroupSize[2] = local_size[2];
-         } else {
-            statistics.numAvailableVgprs = statistics.numPhysicalVgprs;
-         }
-
-         statistics.resourceUsage.numUsedVgprs = conf->num_vgprs;
-         statistics.resourceUsage.numUsedSgprs = conf->num_sgprs;
-         statistics.resourceUsage.ldsSizePerLocalWorkGroup = 32768;
-         statistics.resourceUsage.ldsUsageSizeInBytes = conf->lds_size * lds_multiplier;
-         statistics.resourceUsage.scratchMemUsageInBytes = conf->scratch_bytes_per_wave;
-
-         size_t size = *pInfoSize;
-         *pInfoSize = sizeof(statistics);
-
-         memcpy(pInfo, &statistics, MIN2(size, *pInfoSize));
-
-         if (size < *pInfoSize)
-            result = VK_INCOMPLETE;
-      }
-
-      break;
-   case VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD: {
-      char *out;
-      size_t outsize;
-      struct u_memstream mem;
-      u_memstream_open(&mem, &out, &outsize);
-      FILE *const memf = u_memstream_get(&mem);
-
-      fprintf(memf, "%s:\n", radv_get_shader_name(&shader->info, stage));
-      fprintf(memf, "%s\n\n", shader->ir_string);
-      if (shader->disasm_string) {
-         fprintf(memf, "%s\n\n", shader->disasm_string);
-      }
-      radv_dump_shader_stats(device, pipeline, stage, memf);
-      u_memstream_close(&mem);
-
-      /* Need to include the null terminator. */
-      size_t length = outsize + 1;
-
-      if (!pInfo) {
-         *pInfoSize = length;
-      } else {
-         size_t size = *pInfoSize;
-         *pInfoSize = length;
-
-         memcpy(pInfo, out, MIN2(size, length));
-
-         if (size < length)
-            result = VK_INCOMPLETE;
-      }
-
-      free(out);
-      break;
-   }
-   default:
-      /* VK_SHADER_INFO_TYPE_BINARY_AMD unimplemented for now. */
-      result = VK_ERROR_FEATURE_NOT_PRESENT;
-      break;
-   }
-
-   return result;
-}
-
 VkResult
 radv_dump_shader_stats(struct radv_device *device, struct radv_pipeline *pipeline,
                        gl_shader_stage stage, FILE *output)