ac/radv/radeonsi: add ac_get_num_physical_sgprs() helper

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
Timothy Arceri
2019-02-01 21:16:54 +11:00
parent 574186f0e8
commit a53d68d318
5 changed files with 12 additions and 13 deletions

View 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 #ifdef __cplusplus
} }
#endif #endif

View File

@@ -1129,7 +1129,7 @@ void radv_GetPhysicalDeviceProperties2(
/* SGPR. */ /* SGPR. */
properties->sgprsPerSimd = properties->sgprsPerSimd =
radv_get_num_physical_sgprs(pdevice); ac_get_num_physical_sgprs(pdevice->rad_info.chip_class);
properties->minSgprAllocation = properties->minSgprAllocation =
pdevice->rad_info.chip_class >= VI ? 16 : 8; pdevice->rad_info.chip_class >= VI ? 16 : 8;
properties->maxSgprAllocation = properties->maxSgprAllocation =

View File

@@ -751,7 +751,7 @@ generate_shader_stats(struct radv_device *device,
if (conf->num_sgprs) if (conf->num_sgprs)
max_simd_waves = max_simd_waves =
MIN2(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) if (conf->num_vgprs)
max_simd_waves = max_simd_waves =
@@ -836,7 +836,7 @@ radv_GetShaderInfoAMD(VkDevice _device,
VkShaderStatisticsInfoAMD statistics = {}; VkShaderStatisticsInfoAMD statistics = {};
statistics.shaderStageMask = shaderStage; statistics.shaderStageMask = shaderStage;
statistics.numPhysicalVgprs = RADV_NUM_PHYSICAL_VGPRS; 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; statistics.numAvailableSgprs = statistics.numPhysicalSgprs;
if (stage == MESA_SHADER_COMPUTE) { if (stage == MESA_SHADER_COMPUTE) {

View 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"); 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 #endif

View File

@@ -5380,10 +5380,9 @@ static void si_calculate_max_simd_waves(struct si_shader *shader)
/* Compute the per-SIMD wave counts. */ /* Compute the per-SIMD wave counts. */
if (conf->num_sgprs) { if (conf->num_sgprs) {
if (sscreen->info.chip_class >= VI) max_simd_waves =
max_simd_waves = MIN2(max_simd_waves, 800 / conf->num_sgprs); MIN2(max_simd_waves,
else ac_get_num_physical_sgprs(sscreen->info.chip_class) / conf->num_sgprs);
max_simd_waves = MIN2(max_simd_waves, 512 / conf->num_sgprs);
} }
if (conf->num_vgprs) if (conf->num_vgprs)