From: Timothy Arceri Date: Fri, 1 Feb 2019 10:16:54 +0000 (+1100) Subject: ac/radv/radeonsi: add ac_get_num_physical_sgprs() helper X-Git-Tag: android-x86-9.0-r1~10192 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a53d68d3185f1eee4eccc5ddc8d8519c62df3686;p=android-x86%2Fexternal-mesa.git ac/radv/radeonsi: add ac_get_num_physical_sgprs() helper Reviewed-by: Samuel Pitoiset --- diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h index a7dc1094c05..b1ef9c53734 100644 --- a/src/amd/common/ac_gpu_info.h +++ b/src/amd/common/ac_gpu_info.h @@ -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 diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 34d93b262f8..b8ef93d0cd2 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -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 = diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 32cd9ae25e9..2fd287fcd17 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -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) { diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 3652a811e80..b67cd2b4f15 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -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 diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index a2ed899b58f..efae02ee91c 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -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)