mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
panfrost: Don't allocate WLS when not needed
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
This commit is contained in:
parent
5dd6030876
commit
8066131158
1 changed files with 20 additions and 15 deletions
|
|
@ -1317,25 +1317,30 @@ panfrost_emit_shared_memory(struct panfrost_batch *batch,
|
|||
struct panfrost_device *dev = pan_device(ctx->base.screen);
|
||||
struct panfrost_shader_variants *all = ctx->shader[PIPE_SHADER_COMPUTE];
|
||||
struct panfrost_shader_state *ss = &all->variants[all->active_variant];
|
||||
unsigned single_size = util_next_power_of_two(MAX2(ss->info.wls_size,
|
||||
128));
|
||||
|
||||
unsigned instances =
|
||||
util_next_power_of_two(info->grid[0]) *
|
||||
util_next_power_of_two(info->grid[1]) *
|
||||
util_next_power_of_two(info->grid[2]);
|
||||
|
||||
unsigned shared_size = single_size * instances * dev->core_count;
|
||||
struct panfrost_bo *bo = panfrost_batch_get_shared_memory(batch,
|
||||
shared_size,
|
||||
1);
|
||||
struct panfrost_ptr t =
|
||||
panfrost_pool_alloc_desc(&batch->pool, LOCAL_STORAGE);
|
||||
|
||||
pan_pack(t.cpu, LOCAL_STORAGE, ls) {
|
||||
ls.wls_base_pointer = bo->ptr.gpu;
|
||||
ls.wls_instances = instances;
|
||||
ls.wls_size_scale = util_logbase2(single_size) + 1;
|
||||
unsigned wls_single_size =
|
||||
util_next_power_of_two(MAX2(ss->info.wls_size, 128));
|
||||
|
||||
if (ss->info.wls_size) {
|
||||
ls.wls_instances =
|
||||
util_next_power_of_two(info->grid[0]) *
|
||||
util_next_power_of_two(info->grid[1]) *
|
||||
util_next_power_of_two(info->grid[2]);
|
||||
|
||||
ls.wls_size_scale = util_logbase2(wls_single_size) + 1;
|
||||
|
||||
unsigned wls_size = wls_single_size * ls.wls_instances * dev->core_count;
|
||||
|
||||
ls.wls_base_pointer =
|
||||
(panfrost_batch_get_shared_memory(batch,
|
||||
wls_size,
|
||||
1))->ptr.gpu;
|
||||
} else {
|
||||
ls.wls_instances = MALI_LOCAL_STORAGE_NO_WORKGROUP_MEM;
|
||||
}
|
||||
|
||||
if (ss->info.tls_size) {
|
||||
unsigned shift =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue