radv: implement VK_AMD_shader_core_properties
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 6 Apr 2018 10:40:33 +0000 (12:40 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 9 Apr 2018 12:28:13 +0000 (14:28 +0200)
Simple extension that only returns information for AMD hw.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_extensions.py

index de184603eb0698d71ad016c2266a8b461c030796..4fc7392e65e66ccc362aa987fe31c3005833ac36 100644 (file)
@@ -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);
+                       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;
                }
index bc63a34896a68cf0a8debd2b2f76431fc64e70d2..a25db637e2b84d817266926266421fb69599d024 100644 (file)
@@ -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),
 ]