ac,radeonsi: rework how scratch_waves is used and move it to ac_gpu_info.c
The addition of the "compute" parameter is for a future change. Reviewed-by: Mihai Preda <mhpreda@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15966>
This commit is contained in:
@@ -1270,6 +1270,15 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,
|
||||
info->num_physical_wave64_vgprs_per_simd = info->chip_class >= GFX10 ? 512 : 256;
|
||||
info->num_simd_per_compute_unit = info->chip_class >= GFX10 ? 2 : 4;
|
||||
|
||||
/* The maximum number of scratch waves. The number is only a function of the number of CUs.
|
||||
* It should be large enough to hold at least 1 threadgroup. Use the minimum per-SA CU count.
|
||||
*
|
||||
* We can decrease the number to make it fit into the infinity cache.
|
||||
*/
|
||||
const unsigned max_waves_per_tg = 32; /* 1024 threads in Wave32 */
|
||||
info->max_scratch_waves = MAX2(32 * info->min_good_cu_per_sa * info->max_sa_per_se * info->num_se,
|
||||
max_waves_per_tg);
|
||||
|
||||
set_custom_cu_en_mask(info);
|
||||
|
||||
const char *ib_filename = debug_get_option("AMD_PARSE_IB", NULL);
|
||||
@@ -1480,6 +1489,7 @@ void ac_print_gpu_info(struct radeon_info *info, FILE *f)
|
||||
fprintf(f, " min_wave64_vgpr_alloc = %i\n", info->min_wave64_vgpr_alloc);
|
||||
fprintf(f, " max_vgpr_alloc = %i\n", info->max_vgpr_alloc);
|
||||
fprintf(f, " wave64_vgpr_alloc_granularity = %i\n", info->wave64_vgpr_alloc_granularity);
|
||||
fprintf(f, " max_scratch_waves = %i\n", info->max_scratch_waves);
|
||||
|
||||
fprintf(f, "Render backend info:\n");
|
||||
fprintf(f, " pa_sc_tile_steering_override = 0x%x\n", info->pa_sc_tile_steering_override);
|
||||
|
||||
@@ -217,6 +217,7 @@ struct radeon_info {
|
||||
uint32_t min_wave64_vgpr_alloc;
|
||||
uint32_t max_vgpr_alloc;
|
||||
uint32_t wave64_vgpr_alloc_granularity;
|
||||
uint32_t max_scratch_waves;
|
||||
|
||||
/* Render backends (color + depth blocks). */
|
||||
uint32_t r300_num_gb_pipes;
|
||||
|
||||
@@ -607,7 +607,7 @@ void ac_set_reg_cu_en(void *cs, unsigned reg_offset, uint32_t value, uint32_t cl
|
||||
}
|
||||
|
||||
/* Return the register value and tune bytes_per_wave to increase scratch performance. */
|
||||
void ac_get_scratch_tmpring_size(const struct radeon_info *info, unsigned max_scratch_waves,
|
||||
void ac_get_scratch_tmpring_size(const struct radeon_info *info, bool compute,
|
||||
unsigned bytes_per_wave, unsigned *max_seen_bytes_per_wave,
|
||||
uint32_t *tmpring_size)
|
||||
{
|
||||
@@ -640,6 +640,6 @@ void ac_get_scratch_tmpring_size(const struct radeon_info *info, unsigned max_sc
|
||||
*max_seen_bytes_per_wave = MAX2(*max_seen_bytes_per_wave, bytes_per_wave);
|
||||
|
||||
/* TODO: We could decrease WAVES to make the whole buffer fit into the infinity cache. */
|
||||
*tmpring_size = S_0286E8_WAVES(max_scratch_waves) |
|
||||
*tmpring_size = S_0286E8_WAVES(info->max_scratch_waves) |
|
||||
S_0286E8_WAVESIZE(*max_seen_bytes_per_wave >> size_shift);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ void ac_set_reg_cu_en(void *cs, unsigned reg_offset, uint32_t value, uint32_t cl
|
||||
unsigned value_shift, const struct radeon_info *info,
|
||||
void set_sh_reg(void*, unsigned, uint32_t));
|
||||
|
||||
void ac_get_scratch_tmpring_size(const struct radeon_info *info, unsigned max_scratch_waves,
|
||||
void ac_get_scratch_tmpring_size(const struct radeon_info *info, bool compute,
|
||||
unsigned bytes_per_wave, unsigned *max_seen_bytes_per_wave,
|
||||
uint32_t *tmpring_size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user