From 6247e617c137322951f5e5ee5773bbc0cd89b8d1 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 1 Aug 2023 07:25:04 -0400 Subject: [PATCH] asahi: Report local_size from compiler So we can add more shared in the compiler. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 2 ++ src/asahi/compiler/agx_compile.h | 3 +++ src/gallium/drivers/asahi/agx_state.c | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 99ea7d08e5e..22aa6d82c2e 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2795,6 +2795,8 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, if (agx_should_dump(nir, AGX_DBG_SHADERS)) nir_print_shader(nir, stdout); + out->local_size = nir->info.shared_size; + nir_foreach_function_with_impl(func, impl, nir) { unsigned offset = agx_compile_function_nir(nir, impl, key, debug, binary, out); diff --git a/src/asahi/compiler/agx_compile.h b/src/asahi/compiler/agx_compile.h index 26e2d36153d..96548a1cb6a 100644 --- a/src/asahi/compiler/agx_compile.h +++ b/src/asahi/compiler/agx_compile.h @@ -101,6 +101,9 @@ struct agx_shader_info { /* Number of uniforms */ unsigned push_count; + /* Local memory allocation in bytes */ + unsigned local_size; + /* Does the shader have a preamble? If so, it is at offset preamble_offset. * The main shader is at offset main_offset. The preamble is executed first. */ diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 8d7c1821312..052bc980fb5 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1839,8 +1839,6 @@ agx_create_compute_state(struct pipe_context *pctx, if (!so) return NULL; - so->static_shared_mem = cso->static_shared_mem; - so->variants = _mesa_hash_table_create(so, asahi_cs_shader_key_hash, asahi_cs_shader_key_equal); @@ -1850,7 +1848,10 @@ agx_create_compute_state(struct pipe_context *pctx, nir_shader *nir = (void *)cso->prog; agx_shader_initialize(dev, so, nir); - agx_get_shader_variant(agx_screen(pctx->screen), so, &pctx->debug, &key); + struct agx_compiled_shader *cs = + agx_get_shader_variant(agx_screen(pctx->screen), so, &pctx->debug, &key); + + so->static_shared_mem = cs->info.local_size; /* We're done with the NIR, throw it away */ ralloc_free(nir);