radeonsi: convert the compute blit shader hash table to u64 keys

32 bits is not enough anymore. We'll add more.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28917>
This commit is contained in:
Marek Olšák 2024-03-29 19:22:33 -04:00 committed by Marge Bot
parent 40bcb588dd
commit 7ee936bf65
3 changed files with 8 additions and 14 deletions

View file

@ -1106,7 +1106,6 @@ bool si_compute_blit(struct si_context *sctx, const struct pipe_blit_info *info,
union si_compute_blit_shader_key options;
options.key = 0;
options.always_true = true;
options.is_clear = is_clear;
options.wg_dim = wg_dim;
options.has_start_xyz = start_x || start_y || start_z;
@ -1164,13 +1163,10 @@ bool si_compute_blit(struct si_context *sctx, const struct pipe_blit_info *info,
(is_resolve ? 10 : 11));
}
struct hash_entry *entry = _mesa_hash_table_search(sctx->cs_blit_shaders,
(void*)(uintptr_t)options.key);
void *shader = entry ? entry->data : NULL;
void *shader = _mesa_hash_table_u64_search(sctx->cs_blit_shaders, options.key);
if (!shader) {
shader = si_create_blit_cs(sctx, &options);
_mesa_hash_table_insert(sctx->cs_blit_shaders,
(void*)(uintptr_t)options.key, shader);
_mesa_hash_table_u64_insert(sctx->cs_blit_shaders, options.key, shader);
}
sctx->cs_user_data[0] = (info->src.box.x & 0xffff) | ((info->dst.box.x & 0xffff) << 16);

View file

@ -366,10 +366,10 @@ static void si_destroy_context(struct pipe_context *context)
p_atomic_dec(&context->screen->num_contexts);
if (sctx->cs_blit_shaders) {
hash_table_foreach(sctx->cs_blit_shaders, entry) {
context->delete_compute_state(context, entry->data);
hash_table_u64_foreach(sctx->cs_blit_shaders, entry) {
context->delete_compute_state(context, entry.data);
}
_mesa_hash_table_destroy(sctx->cs_blit_shaders, NULL);
_mesa_hash_table_u64_destroy(sctx->cs_blit_shaders);
}
FREE(sctx);
@ -864,7 +864,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
sctx->initial_gfx_cs_size = sctx->gfx_cs.current.cdw;
sctx->last_timestamp_cmd = NULL;
sctx->cs_blit_shaders = _mesa_hash_table_create_u32_keys(NULL);
sctx->cs_blit_shaders = _mesa_hash_table_u64_create(NULL);
if (!sctx->cs_blit_shaders)
goto fail;

View file

@ -993,7 +993,7 @@ struct si_context {
void *cs_clear_12bytes_buffer;
void *cs_dcc_retile[32];
void *cs_fmask_expand[3][2]; /* [log2(samples)-1][is_array] */
struct hash_table *cs_blit_shaders;
struct hash_table_u64 *cs_blit_shaders;
struct si_screen *screen;
struct util_debug_callback debug;
struct ac_llvm_compiler *compiler; /* only non-threaded compilation */
@ -1634,8 +1634,6 @@ void *si_clear_image_dcc_single_shader(struct si_context *sctx, bool is_msaa, un
union si_compute_blit_shader_key {
struct {
/* The key saved in _mesa_hash_table_create_u32_keys() can't be 0. */
bool always_true:1;
/* Workgroup settings. */
uint8_t wg_dim:2; /* 1, 2, or 3 */
bool has_start_xyz:1;
@ -1662,7 +1660,7 @@ union si_compute_blit_shader_key {
uint8_t last_src_channel:2;
uint8_t last_dst_channel:2;
};
uint32_t key;
uint64_t key;
};
void *si_create_blit_cs(struct si_context *sctx, const union si_compute_blit_shader_key *options);