radeonsi/gfx11: don't prefetch constants in binaries into the instruction cache

Only prefetch shader instructions. There will be more GFX versions
in that list.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28725>
This commit is contained in:
Marek Olšák 2024-03-17 15:53:51 -04:00 committed by Marge Bot
parent 71ae7b85ed
commit d478693dc6
4 changed files with 18 additions and 8 deletions

View file

@ -839,6 +839,23 @@ static unsigned si_get_shader_binary_size(struct si_screen *screen, struct si_sh
}
}
unsigned si_get_shader_prefetch_size(struct si_shader *shader)
{
struct si_screen *sscreen = shader->selector->screen;
/* This excludes arrays of constants after instructions. */
unsigned exec_size =
ac_align_shader_binary_for_prefetch(&sscreen->info,
si_get_shader_binary_size(sscreen, shader));
/* INST_PREF_SIZE uses 128B granularity.
* - GFX11: max 128 * 63 = 8064
*/
unsigned max_pref_size = 63;
unsigned exec_size_gran128 = DIV_ROUND_UP(exec_size, 128);
return MIN2(max_pref_size, exec_size_gran128);
}
bool si_get_external_symbol(enum amd_gfx_level gfx_level, void *data, const char *name,
uint64_t *value)
{

View file

@ -1004,6 +1004,7 @@ bool si_shader_binary_open(struct si_screen *screen, struct si_shader *shader,
struct ac_rtld_binary *rtld);
bool si_get_external_symbol(enum amd_gfx_level gfx_level, void *data, const char *name,
uint64_t *value);
unsigned si_get_shader_prefetch_size(struct si_shader *shader);
/* si_shader_info.c */
void si_nir_scan_shader(struct si_screen *sscreen, const struct nir_shader *nir,

View file

@ -673,7 +673,6 @@ void si_ps_key_update_framebuffer_rasterizer_sample_shading(struct si_context *s
void si_init_tess_factor_ring(struct si_context *sctx);
bool si_update_gs_ring_buffers(struct si_context *sctx);
bool si_update_spi_tmpring_size(struct si_context *sctx, unsigned bytes);
unsigned si_get_shader_prefetch_size(struct si_shader *shader);
bool si_set_tcs_to_fixed_func_shader(struct si_context *sctx);
void si_update_tess_io_layout_state(struct si_context *sctx);

View file

@ -662,13 +662,6 @@ static unsigned si_get_vs_vgpr_comp_cnt(struct si_screen *sscreen, struct si_sha
return max;
}
unsigned si_get_shader_prefetch_size(struct si_shader *shader)
{
/* inst_pref_size is calculated in cache line size granularity */
assert(!(shader->bo->b.b.width0 & 0x7f));
return MIN2(shader->bo->b.b.width0, 8064) / 128;
}
static void si_shader_ls(struct si_screen *sscreen, struct si_shader *shader)
{
struct si_pm4_state *pm4;