ac/radv/radeonsi: add ac_get_num_physical_sgprs() helper
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 1 Feb 2019 10:16:54 +0000 (21:16 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 1 Feb 2019 11:25:30 +0000 (22:25 +1100)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_gpu_info.h
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h
src/gallium/drivers/radeonsi/si_shader.c

index a7dc1094c0516201452597009c6a5634444369e0..b1ef9c53734a3cc73f569f55a94b98b4c19dfd30 100644 (file)
@@ -172,6 +172,12 @@ static inline unsigned ac_get_max_simd_waves(enum radeon_family family)
        }
 }
 
+static inline uint32_t
+ac_get_num_physical_sgprs(enum chip_class chip_class)
+{
+       return chip_class >= VI ? 800 : 512;
+}
+
 #ifdef __cplusplus
 }
 #endif
index 34d93b262f85563f70ba465cc75e095f3800cb18..b8ef93d0cd28075c7ca5f38d2a03cb5fc7db0727 100644 (file)
@@ -1129,7 +1129,7 @@ void radv_GetPhysicalDeviceProperties2(
 
                        /* SGPR. */
                        properties->sgprsPerSimd =
-                               radv_get_num_physical_sgprs(pdevice);
+                               ac_get_num_physical_sgprs(pdevice->rad_info.chip_class);
                        properties->minSgprAllocation =
                                pdevice->rad_info.chip_class >= VI ? 16 : 8;
                        properties->maxSgprAllocation =
index 32cd9ae25e91c213a05606694c9958d9f051e6ad..2fd287fcd17f43caa16d28f6a7871885e44661cf 100644 (file)
@@ -751,7 +751,7 @@ generate_shader_stats(struct radv_device *device,
        if (conf->num_sgprs)
                max_simd_waves =
                        MIN2(max_simd_waves,
-                            radv_get_num_physical_sgprs(device->physical_device) / conf->num_sgprs);
+                            ac_get_num_physical_sgprs(device->physical_device->rad_info.chip_class) / conf->num_sgprs);
 
        if (conf->num_vgprs)
                max_simd_waves =
@@ -836,7 +836,7 @@ radv_GetShaderInfoAMD(VkDevice _device,
                        VkShaderStatisticsInfoAMD statistics = {};
                        statistics.shaderStageMask = shaderStage;
                        statistics.numPhysicalVgprs = RADV_NUM_PHYSICAL_VGPRS;
-                       statistics.numPhysicalSgprs = radv_get_num_physical_sgprs(device->physical_device);
+                       statistics.numPhysicalSgprs = ac_get_num_physical_sgprs(device->physical_device->rad_info.chip_class);
                        statistics.numAvailableSgprs = statistics.numPhysicalSgprs;
 
                        if (stage == MESA_SHADER_COMPUTE) {
index 3652a811e80491a8e2f3c746fd91bb6f9b92b108..b67cd2b4f158ddedd9e47dccd6abda12ec0d2dad 100644 (file)
@@ -407,10 +407,4 @@ static inline unsigned shader_io_get_unique_index(gl_varying_slot slot)
        unreachable("illegal slot in get unique index\n");
 }
 
-static inline uint32_t
-radv_get_num_physical_sgprs(struct radv_physical_device *physical_device)
-{
-       return physical_device->rad_info.chip_class >= VI ? 800 : 512;
-}
-
 #endif
index a2ed899b58f4a51652f1bf586a6c0c02195cd230..efae02ee91c5e7f1172e37eab14561ab806513a9 100644 (file)
@@ -5380,10 +5380,9 @@ static void si_calculate_max_simd_waves(struct si_shader *shader)
 
        /* Compute the per-SIMD wave counts. */
        if (conf->num_sgprs) {
-               if (sscreen->info.chip_class >= VI)
-                       max_simd_waves = MIN2(max_simd_waves, 800 / conf->num_sgprs);
-               else
-                       max_simd_waves = MIN2(max_simd_waves, 512 / conf->num_sgprs);
+               max_simd_waves =
+                       MIN2(max_simd_waves,
+                            ac_get_num_physical_sgprs(sscreen->info.chip_class) / conf->num_sgprs);
        }
 
        if (conf->num_vgprs)