[Mesa-dev] [PATCH 4/4] radv: implement VK_AMD_shader_core_properties

Grazvydas Ignotas notasas at gmail.com
Fri Apr 6 13:24:29 UTC 2018


On Fri, Apr 6, 2018 at 3:28 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Simple extension that only returns information for AMD hw.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_device.c      | 71 +++++++++++++++++++++++++++++++++++++++
>  src/amd/vulkan/radv_extensions.py |  1 +
>  2 files changed, 72 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 41f8242754..fba0b5c586 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -888,6 +888,39 @@ void radv_GetPhysicalDeviceProperties(
>         memcpy(pProperties->pipelineCacheUUID, pdevice->cache_uuid, VK_UUID_SIZE);
>  }
>
> +static uint32_t
> +radv_get_max_cu_per_sh(struct radv_physical_device *device)
> +{
> +       /* This should be queried from the KMD, like the number of SEs. */
> +       switch (device->rad_info.family) {
> +       case CHIP_TAHITI:
> +               return 8;
> +       case CHIP_HAINAN:
> +               return 5;
> +       case CHIP_BONAIRE:
> +               return 7;
> +       case CHIP_HAWAII:
> +               return 11;
> +       case CHIP_ICELAND:
> +               return 6;
> +       case CHIP_CARRIZO:
> +               return 8;
> +       case CHIP_TONGA:
> +               return 8;
> +       case CHIP_FIJI:
> +               return 16;
> +       case CHIP_STONEY:
> +               return 3;
> +       case CHIP_VEGA10:
> +               return 16;
> +       case CHIP_RAVEN:
> +               return 11;
> +       default:
> +               fprintf(stderr, "Number of CUs per SH unknown!\n");
> +               return 0;
> +       }
> +}
> +
>  void radv_GetPhysicalDeviceProperties2(
>         VkPhysicalDevice                            physicalDevice,
>         VkPhysicalDeviceProperties2KHR             *pProperties)
> @@ -961,6 +994,44 @@ void radv_GetPhysicalDeviceProperties2(
>                         properties->filterMinmaxSingleComponentFormats = true;
>                         break;
>                 }
> +               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD: {
> +                       VkPhysicalDeviceShaderCorePropertiesAMD *properties =
> +                               (VkPhysicalDeviceShaderCorePropertiesAMD *)ext;
> +
> +                       /* Shader engines. */
> +                       properties->shaderEngineCount =
> +                               pdevice->rad_info.max_se;
> +                       properties->shaderArraysPerEngineCount =
> +                               pdevice->rad_info.max_sh_per_se;
> +                       properties->computeUnitsPerShaderArray =
> +                               radv_get_max_cu_per_sh(pdevice);

Maybe
pdevice->rad_info.num_good_compute_units / (pdevice->rad_info.max_se *
pdevice->rad_info.max_sh_per_se);
would do the trick?

GraÅžvydas


More information about the mesa-dev mailing list