asahi: Report local_size from compiler

So we can add more shared in the compiler.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
This commit is contained in:
Alyssa Rosenzweig
2023-08-01 07:25:04 -04:00
committed by Marge Bot
parent 5b3f4cf6f8
commit 6247e617c1
3 changed files with 9 additions and 3 deletions

View File

@@ -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);

View File

@@ -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.
*/

View File

@@ -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,8 +1848,11 @@ agx_create_compute_state(struct pipe_context *pctx,
nir_shader *nir = (void *)cso->prog;
agx_shader_initialize(dev, so, nir);
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);
return so;