panfrost: Honour cso->req_local_mem

Fixes api.min_max_local_mem_size.

nir->info.shared_size can't be trusted in OpenCL.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18559>
This commit is contained in:
Alyssa Rosenzweig 2022-06-27 10:19:47 -04:00 committed by Marge Bot
parent b4dd1b8916
commit ef75dbfddd
4 changed files with 11 additions and 6 deletions

View file

@ -41,7 +41,8 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
struct panfrost_pool *desc_pool,
const nir_shader *ir,
struct util_debug_callback *dbg,
struct panfrost_shader_state *state)
struct panfrost_shader_state *state,
unsigned req_local_mem)
{
struct panfrost_screen *screen = pan_screen(pscreen);
struct panfrost_device *dev = pan_device(pscreen);
@ -55,7 +56,7 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
xfb->info.internal = true;
state->xfb = calloc(1, sizeof(struct panfrost_shader_state));
panfrost_shader_compile(pscreen, shader_pool, desc_pool, xfb, dbg, state->xfb);
panfrost_shader_compile(pscreen, shader_pool, desc_pool, xfb, dbg, state->xfb, 0);
/* Main shader no longer uses XFB */
s->info.has_transform_feedback_varyings = false;
@ -98,6 +99,9 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
util_dynarray_init(&binary, NULL);
screen->vtbl.compile_shader(s, &inputs, &binary, &state->info);
assert(req_local_mem >= state->info.wls_size);
state->info.wls_size = req_local_mem;
if (binary.size) {
state->bin = panfrost_pool_take_ref(shader_pool,
pan_pool_upload_aligned(&shader_pool->base,

View file

@ -72,7 +72,7 @@ panfrost_create_compute_state(
panfrost_shader_compile(pctx->screen, &ctx->shaders, &ctx->descs,
deserialized ?: cso->prog,
&ctx->base.debug, v);
&ctx->base.debug, v, cso->req_local_mem);
/* There are no variants so we won't need the NIR again */
ralloc_free(deserialized);

View file

@ -345,7 +345,7 @@ panfrost_create_shader_state(
panfrost_shader_compile(pctx->screen,
&ctx->shaders, &ctx->descs,
so->nir, &ctx->base.debug, &state);
so->nir, &ctx->base.debug, &state, 0);
}
return so;
@ -517,7 +517,7 @@ panfrost_new_variant_locked(
/* We finally have a variant, so compile it */
panfrost_shader_compile(ctx->base.screen,
&ctx->shaders, &ctx->descs,
variants->nir, &ctx->base.debug, shader_state);
variants->nir, &ctx->base.debug, shader_state, 0);
/* Fixup the stream out information */
shader_state->stream_output = variants->stream_output;

View file

@ -405,7 +405,8 @@ panfrost_shader_compile(struct pipe_screen *pscreen,
struct panfrost_pool *desc_pool,
const nir_shader *ir,
struct util_debug_callback *dbg,
struct panfrost_shader_state *state);
struct panfrost_shader_state *state,
unsigned req_local_mem);
void
panfrost_analyze_sysvals(struct panfrost_shader_state *ss);