agx: compiler: Export scratch size to the driver

So it can configure the pipeline correctly, and allocate the required
scratch space.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
This commit is contained in:
Asahi Lina 2023-11-08 22:25:11 +09:00 committed by Marge Bot
parent b89da92a5e
commit 1f1751d258
2 changed files with 5 additions and 0 deletions

View file

@ -3172,6 +3172,8 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key,
nir_print_shader(nir, stdout);
out->local_size = nir->info.shared_size;
if (nir->scratch_size > 0)
out->scratch_size = ALIGN(DIV_ROUND_UP(nir->scratch_size, 4) + 10, 4);
nir_foreach_function_with_impl(func, impl, nir) {
unsigned offset =

View file

@ -114,6 +114,9 @@ struct agx_shader_info {
/* Local memory allocation in bytes */
unsigned local_size;
/* Scratch memory allocation in bytes */
unsigned scratch_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.
*/