From a53d68d3185f1eee4eccc5ddc8d8519c62df3686 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 1 Feb 2019 21:16:54 +1100 Subject: [PATCH] ac/radv/radeonsi: add ac_get_num_physical_sgprs() helper Reviewed-by: Samuel Pitoiset --- src/amd/common/ac_gpu_info.h | 6 ++++++ src/amd/vulkan/radv_device.c | 2 +- src/amd/vulkan/radv_shader.c | 4 ++-- src/amd/vulkan/radv_shader.h | 6 ------ src/gallium/drivers/radeonsi/si_shader.c | 7 +++---- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h index a7dc109..b1ef9c5 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 34d93b2..b8ef93d 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 32cd9ae..2fd287f 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 3652a81..b67cd2b 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 a2ed899..efae02e 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) -- 2.7.4