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

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Apr 9 09:21:54 UTC 2018


On Mon, Apr 9, 2018 at 10:12 AM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Simple extension that only returns information for AMD hw.
>
> v2: - update computation of computeUnitsPerShaderArray
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_device.c      | 40 +++++++++++++++++++++++++++++++
>  src/amd/vulkan/radv_extensions.py |  1 +
>  2 files changed, 41 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 41f8242754..8dd80da070 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -961,6 +961,46 @@ 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 =
> +                               pdevice->rad_info.num_good_compute_units /
> +                                       (pdevice->rad_info.max_se *
> +                                        pdevice->rad_info.max_sh_per_se);

This behavior is different than AMDVLK. Your query determines the
number of active compute units per SH, while AMDVLK returns the full
number of CUs per SH for the chip. The latter is reported as
num_cu_per_sh by the kernel.

> +                       properties->simdPerComputeUnit = 4;
> +                       properties->wavefrontsPerSimd =
> +                               pdevice->rad_info.family == CHIP_TONGA ||
> +                               pdevice->rad_info.family == CHIP_ICELAND ||
> +                               pdevice->rad_info.family == CHIP_POLARIS10 ||
> +                               pdevice->rad_info.family == CHIP_POLARIS11 ||
> +                               pdevice->rad_info.family == CHIP_POLARIS12 ? 8 : 10;
> +                       properties->wavefrontSize = 64;
> +
> +                       /* SGPR. */
> +                       properties->sgprsPerSimd =
> +                               radv_get_num_physical_sgprs(pdevice);
> +                       properties->minSgprAllocation =
> +                               pdevice->rad_info.chip_class >= VI ? 16 : 8;
> +                       properties->maxSgprAllocation =
> +                               pdevice->rad_info.family == CHIP_TONGA ||
> +                               pdevice->rad_info.family == CHIP_ICELAND ? 96 : 104;
> +                       properties->sgprAllocationGranularity =
> +                               pdevice->rad_info.chip_class >= VI ? 16 : 8;
> +
> +                       /* VGPR. */
> +                       properties->vgprsPerSimd = RADV_NUM_PHYSICAL_VGPRS;
> +                       properties->minVgprAllocation = 4;
> +                       properties->maxVgprAllocation = 256;
> +                       properties->vgprAllocationGranularity = 4;
> +                       break;
> +               }
>                 default:
>                         break;
>                 }
> diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
> index bc63a34896..a25db637e2 100644
> --- a/src/amd/vulkan/radv_extensions.py
> +++ b/src/amd/vulkan/radv_extensions.py
> @@ -96,6 +96,7 @@ EXTENSIONS = [
>      Extension('VK_AMD_draw_indirect_count',               1, True),
>      Extension('VK_AMD_gcn_shader',                        1, True),
>      Extension('VK_AMD_rasterization_order',               1, 'device->has_out_of_order_rast'),
> +    Extension('VK_AMD_shader_core_properties',            1, True),
>      Extension('VK_AMD_shader_info',                       1, True),
>      Extension('VK_AMD_shader_trinary_minmax',             1, True),
>  ]
> --
> 2.17.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list