nir: add nir_remove_entrypoints helper

opposite of nir_remove_non_entrypoint. this operation comes up with
precompiling.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32382>
This commit is contained in:
Alyssa Rosenzweig 2024-11-25 07:52:27 -05:00 committed by Marge Bot
parent c076900360
commit 12cc22af4c
2 changed files with 14 additions and 0 deletions

View file

@ -3550,6 +3550,19 @@ nir_remove_non_exported(nir_shader *nir)
}
}
/*
* After precompiling entrypoints from a kernel library, we want to garbage
* collect the NIR entrypoints but leave the exported library functions. This
* helper does that.
*/
void
nir_remove_entrypoints(nir_shader *nir)
{
nir_foreach_entrypoint_safe(func, nir) {
exec_node_remove(&func->node);
}
}
unsigned
nir_static_workgroup_size(const nir_shader *s)
{

View file

@ -4582,6 +4582,7 @@ nir_shader_get_function_for_name(const nir_shader *shader, const char *name)
*/
void nir_remove_non_entrypoints(nir_shader *shader);
void nir_remove_non_exported(nir_shader *shader);
void nir_remove_entrypoints(nir_shader *shader);
void nir_fixup_is_exported(nir_shader *shader);
nir_shader *nir_shader_create(void *mem_ctx,