pan/bi: Report whether workgroups can be merged

This flag gates a Valhall hardware optimization for compute shaders.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15793>
This commit is contained in:
Alyssa Rosenzweig
2022-03-30 16:31:39 -04:00
committed by Marge Bot
parent 170d5a012e
commit ccdec68aee
2 changed files with 21 additions and 0 deletions

View File

@@ -4798,6 +4798,18 @@ bifrost_compile_shader_nir(nir_shader *nir,
bi_compile_variant(nir, inputs, binary, sysval_to_id, info, BI_IDVS_NONE);
}
if (gl_shader_stage_is_compute(nir->info.stage)) {
/* Workgroups may be merged if the structure of the workgroup is
* not software visible. This is true if neither shared memory
* nor barriers are used. The hardware may be able to optimize
* compute shaders that set this flag.
*/
info->cs.allow_merging_workgroups =
(nir->info.shared_size == 0) &&
!nir->info.uses_control_barrier &&
!nir->info.uses_memory_barrier;
}
info->ubo_mask &= (1 << nir->info.num_ubos) - 1;
_mesa_hash_table_u64_destroy(sysval_to_id);

View File

@@ -309,6 +309,15 @@ struct pan_shader_info {
*/
uint64_t secondary_preload;
} vs;
struct {
/* Is it legal to merge workgroups? This is true if the
* shader uses neither barriers nor shared memory.
*
* Used by the Valhall hardware.
*/
bool allow_merging_workgroups;
} cs;
};
/* Does the shader contains a barrier? or (for fragment shaders) does it