ac/radv/radeonsi: refactor max simd waves into common code.
authorDave Airlie <airlied@redhat.com>
Mon, 23 Apr 2018 00:16:07 +0000 (10:16 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 23 Apr 2018 23:08:33 +0000 (09:08 +1000)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_gpu_info.h
src/amd/vulkan/radv_shader.c
src/gallium/drivers/radeonsi/si_shader.c

index 9227ff377998aad30a7efa14494561b160de4cad..de566c62fa9b2e8d7dd2df48bb5d172614098eb0 100644 (file)
@@ -134,6 +134,22 @@ int ac_get_gs_table_depth(enum chip_class chip_class, enum radeon_family family)
 void ac_get_raster_config(struct radeon_info *info,
                          uint32_t *raster_config_p,
                          uint32_t *raster_config_1_p);
+
+static inline unsigned ac_get_max_simd_waves(enum radeon_family family)
+{
+
+       switch (family) {
+       /* These always have 8 waves: */
+       case CHIP_POLARIS10:
+       case CHIP_POLARIS11:
+       case CHIP_POLARIS12:
+       case CHIP_VEGAM:
+               return 8;
+       default:
+               return 10;
+       }
+}
+
 #ifdef __cplusplus
 }
 #endif
index 8e8a32f0256c312cb0012af5163689dc832687f7..aaa670297551a60ba6bda06deaaf26aca3885dc6 100644 (file)
@@ -615,17 +615,7 @@ generate_shader_stats(struct radv_device *device,
        unsigned max_simd_waves;
        unsigned lds_per_wave = 0;
 
-       switch (device->physical_device->rad_info.family) {
-       /* These always have 8 waves: */
-       case CHIP_POLARIS10:
-       case CHIP_POLARIS11:
-       case CHIP_POLARIS12:
-       case CHIP_VEGAM:
-               max_simd_waves = 8;
-               break;
-       default:
-               max_simd_waves = 10;
-       }
+       max_simd_waves = ac_get_max_simd_waves(device->physical_device->rad_info.family);
 
        conf = &variant->config;
 
index 4eff4f57b97d274ded42aaf3078119e646fcab81..b866f14623e3a22bce5c622ca16e6a2edf0f4fb9 100644 (file)
@@ -5459,17 +5459,7 @@ static void si_calculate_max_simd_waves(struct si_shader *shader)
        unsigned lds_per_wave = 0;
        unsigned max_simd_waves;
 
-       switch (sscreen->info.family) {
-       /* These always have 8 waves: */
-       case CHIP_POLARIS10:
-       case CHIP_POLARIS11:
-       case CHIP_POLARIS12:
-       case CHIP_VEGAM:
-               max_simd_waves = 8;
-               break;
-       default:
-               max_simd_waves = 10;
-       }
+       max_simd_waves = ac_get_max_simd_waves(sscreen->info.family);
 
        /* Compute LDS usage for PS. */
        switch (shader->selector->type) {