mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-07 05:30:25 +01:00
radeonsi: store the total binary size in si_shader
si_get_shader_prefetch_size is called each time a shader is changed. Since the size of a given variant never changes, we can compute the value once and store the result. This has to be done in 2 places: * si_create_shader_variant for all types of shaders * si_create_compute_state_async for compute shader, when a shader is loaded from the cache. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29304>
This commit is contained in:
parent
14974fd097
commit
2a9bf2b512
3 changed files with 12 additions and 2 deletions
|
|
@ -162,6 +162,8 @@ static void si_create_compute_state_async(void *job, void *gdata, int thread_ind
|
|||
if (si_shader_cache_load_shader(sscreen, ir_sha1_cache_key, shader)) {
|
||||
simple_mtx_unlock(&sscreen->shader_cache_mutex);
|
||||
|
||||
shader->complete_shader_binary_size = si_get_shader_binary_size(sscreen, shader);
|
||||
|
||||
if (!si_shader_binary_upload(sscreen, shader, 0))
|
||||
program->shader.compilation_failed = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -840,7 +840,10 @@ static unsigned get_shader_binaries(struct si_shader *shader, struct si_shader_b
|
|||
return num_bin;
|
||||
}
|
||||
|
||||
static unsigned si_get_shader_binary_size(struct si_screen *screen, struct si_shader *shader)
|
||||
/* si_get_shader_binary_size should only be called once per shader
|
||||
* and the result should be stored in shader->complete_shader_binary_size.
|
||||
*/
|
||||
unsigned si_get_shader_binary_size(struct si_screen *screen, struct si_shader *shader)
|
||||
{
|
||||
if (shader->binary.type == SI_SHADER_BINARY_ELF) {
|
||||
struct ac_rtld_binary rtld;
|
||||
|
|
@ -867,7 +870,7 @@ unsigned si_get_shader_prefetch_size(struct si_shader *shader)
|
|||
/* 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));
|
||||
shader->complete_shader_binary_size);
|
||||
|
||||
/* INST_PREF_SIZE uses 128B granularity.
|
||||
* - GFX11: max 128 * 63 = 8064
|
||||
|
|
@ -3531,6 +3534,9 @@ bool si_create_shader_variant(struct si_screen *sscreen, struct ac_llvm_compiler
|
|||
|
||||
/* Upload. */
|
||||
bool ok = si_shader_binary_upload(sscreen, shader, 0) >= 0;
|
||||
|
||||
shader->complete_shader_binary_size = si_get_shader_binary_size(sscreen, shader);
|
||||
|
||||
si_shader_dump(sscreen, shader, debug, stderr, true);
|
||||
|
||||
if (!ok)
|
||||
|
|
|
|||
|
|
@ -874,6 +874,7 @@ struct si_shader {
|
|||
bool is_binary_shared;
|
||||
bool is_gs_copy_shader;
|
||||
uint8_t wave_size;
|
||||
unsigned complete_shader_binary_size;
|
||||
|
||||
/* The following data is all that's needed for binary shaders. */
|
||||
struct si_shader_binary binary;
|
||||
|
|
@ -1008,6 +1009,7 @@ bool si_shader_binary_open(struct si_screen *screen, struct si_shader *shader,
|
|||
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);
|
||||
unsigned si_get_shader_binary_size(struct si_screen *screen, struct si_shader *shader);
|
||||
|
||||
/* si_shader_info.c */
|
||||
void si_nir_scan_shader(struct si_screen *sscreen, const struct nir_shader *nir,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue