diff options
author | Karol Herbst <kherbst@redhat.com> | 2022-09-14 20:37:55 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-11-02 23:36:56 +0000 |
commit | b8d10d9e87a32d039a6b9b11b61d969573d1d11c (patch) | |
tree | f156ce808e26e37986f889d3a673cff306af31bf /src/gallium/drivers/softpipe/sp_compute.c | |
parent | 7b015457163c35b66ed047d2dd2b8e2b85bf6765 (diff) |
gallium: split up req_local_mem
This will be required if a frontend has to request additional shared mem
on top of the shader declared one, but wants to create the CSO before
knowing the total amount.
In OpenCL applications can bind additional shared mem through kernel
arguments and this happens quite late.
Note: Clover sets the req_local_mem incorrectly before so we can leave it
as broken.
v2: fix panfrost code (Alyssa)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18581>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_compute.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_compute.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_compute.c b/src/gallium/drivers/softpipe/sp_compute.c index 221ef7ec797..2b70fb9777b 100644 --- a/src/gallium/drivers/softpipe/sp_compute.c +++ b/src/gallium/drivers/softpipe/sp_compute.c @@ -184,8 +184,9 @@ softpipe_launch_grid(struct pipe_context *context, fill_grid_size(context, info, grid_size); - if (cs->shader.req_local_mem) { - local_mem = CALLOC(1, cs->shader.req_local_mem); + uint32_t shared_mem_size = cs->shader.static_shared_mem + info->variable_shared_mem; + if (shared_mem_size) { + local_mem = CALLOC(1, shared_mem_size); } machines = CALLOC(sizeof(struct tgsi_exec_machine *), num_threads_in_group); @@ -202,7 +203,7 @@ softpipe_launch_grid(struct pipe_context *context, machines[idx] = tgsi_exec_machine_create(PIPE_SHADER_COMPUTE); machines[idx]->LocalMem = local_mem; - machines[idx]->LocalMemSize = cs->shader.req_local_mem; + machines[idx]->LocalMemSize = shared_mem_size; machines[idx]->NonHelperMask = (1 << (MIN2(TGSI_QUAD_SIZE, bwidth - local_x))) - 1; cs_prepare(cs, machines[idx], local_x, local_y, local_z, |