<div dir="auto"><div>Hi Samuel, a question below<br><br><div class="gmail_quote"><div dir="ltr">Den fre 6 apr. 2018 14:28Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> skrev:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Simple extension that only returns information for AMD hw.<br>
<br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" target="_blank" rel="noreferrer">samuel.pitoiset@gmail.com</a>><br>
---<br>
 src/amd/vulkan/radv_device.c      | 71 +++++++++++++++++++++++++++++++++++++++<br>
 src/amd/vulkan/radv_extensions.py |  1 +<br>
 2 files changed, 72 insertions(+)<br>
<br>
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c<br>
index 41f8242754..fba0b5c586 100644<br>
--- a/src/amd/vulkan/radv_device.c<br>
+++ b/src/amd/vulkan/radv_device.c<br>
@@ -888,6 +888,39 @@ void radv_GetPhysicalDeviceProperties(<br>
        memcpy(pProperties->pipelineCacheUUID, pdevice->cache_uuid, VK_UUID_SIZE);<br>
 }<br>
<br>
+static uint32_t<br>
+radv_get_max_cu_per_sh(struct radv_physical_device *device)<br>
+{<br>
+       /* This should be queried from the KMD, like the number of SEs. */<br>
+       switch (device->rad_info.family) {<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Isn't Polaris missing from this switch?</div><div dir="auto"><br></div><div dir="auto">BR</div><div dir="auto">Nils</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+       case CHIP_TAHITI:<br>
+               return 8;<br>
+       case CHIP_HAINAN:<br>
+               return 5;<br>
+       case CHIP_BONAIRE:<br>
+               return 7;<br>
+       case CHIP_HAWAII:<br>
+               return 11;<br>
+       case CHIP_ICELAND:<br>
+               return 6;<br>
+       case CHIP_CARRIZO:<br>
+               return 8;<br>
+       case CHIP_TONGA:<br>
+               return 8;<br>
+       case CHIP_FIJI:<br>
+               return 16;<br>
+       case CHIP_STONEY:<br>
+               return 3;<br>
+       case CHIP_VEGA10:<br>
+               return 16;<br>
+       case CHIP_RAVEN:<br>
+               return 11;<br>
+       default:<br>
+               fprintf(stderr, "Number of CUs per SH unknown!\n");<br>
+               return 0;<br>
+       }<br>
+}<br>
+<br>
 void radv_GetPhysicalDeviceProperties2(<br>
        VkPhysicalDevice                            physicalDevice,<br>
        VkPhysicalDeviceProperties2KHR             *pProperties)<br>
@@ -961,6 +994,44 @@ void radv_GetPhysicalDeviceProperties2(<br>
                        properties->filterMinmaxSingleComponentFormats = true;<br>
                        break;<br>
                }<br>
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD: {<br>
+                       VkPhysicalDeviceShaderCorePropertiesAMD *properties =<br>
+                               (VkPhysicalDeviceShaderCorePropertiesAMD *)ext;<br>
+<br>
+                       /* Shader engines. */<br>
+                       properties->shaderEngineCount =<br>
+                               pdevice->rad_info.max_se;<br>
+                       properties->shaderArraysPerEngineCount =<br>
+                               pdevice->rad_info.max_sh_per_se;<br>
+                       properties->computeUnitsPerShaderArray =<br>
+                               radv_get_max_cu_per_sh(pdevice);<br>
+                       properties->simdPerComputeUnit = 4;<br>
+                       properties->wavefrontsPerSimd =<br>
+                               pdevice->rad_info.family == CHIP_TONGA ||<br>
+                               pdevice->rad_info.family == CHIP_ICELAND ||<br>
+                               pdevice->rad_info.family == CHIP_POLARIS10 ||<br>
+                               pdevice->rad_info.family == CHIP_POLARIS11 ||<br>
+                               pdevice->rad_info.family == CHIP_POLARIS12 ? 8 : 10;<br>
+                       properties->wavefrontSize = 64;<br>
+<br>
+                       /* SGPR. */<br>
+                       properties->sgprsPerSimd =<br>
+                               radv_get_num_physical_sgprs(pdevice);<br>
+                       properties->minSgprAllocation =<br>
+                               pdevice->rad_info.chip_class >= VI ? 16 : 8;<br>
+                       properties->maxSgprAllocation =<br>
+                               pdevice->rad_info.family == CHIP_TONGA ||<br>
+                               pdevice->rad_info.family == CHIP_ICELAND ? 96 : 104;<br>
+                       properties->sgprAllocationGranularity =<br>
+                               pdevice->rad_info.chip_class >= VI ? 16 : 8;<br>
+<br>
+                       /* VGPR. */<br>
+                       properties->vgprsPerSimd = RADV_NUM_PHYSICAL_VGPRS;<br>
+                       properties->minVgprAllocation = 4;<br>
+                       properties->maxVgprAllocation = 256;<br>
+                       properties->vgprAllocationGranularity = 4;<br>
+                       break;<br>
+               }<br>
                default:<br>
                        break;<br>
                }<br>
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py<br>
index bc63a34896..a25db637e2 100644<br>
--- a/src/amd/vulkan/radv_extensions.py<br>
+++ b/src/amd/vulkan/radv_extensions.py<br>
@@ -96,6 +96,7 @@ EXTENSIONS = [<br>
     Extension('VK_AMD_draw_indirect_count',               1, True),<br>
     Extension('VK_AMD_gcn_shader',                        1, True),<br>
     Extension('VK_AMD_rasterization_order',               1, 'device->has_out_of_order_rast'),<br>
+    Extension('VK_AMD_shader_core_properties',            1, True),<br>
     Extension('VK_AMD_shader_info',                       1, True),<br>
     Extension('VK_AMD_shader_trinary_minmax',             1, True),<br>
 ]<br>
--<br>
2.16.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div></div>