Mesa (main): pan/bi: Report whether workgroups can be merged
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 14:35:00 UTC 2022
Module: Mesa
Branch: main
Commit: ccdec68aee284243e722e89830800afb99cf2688
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccdec68aee284243e722e89830800afb99cf2688
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Wed Mar 30 16:31:39 2022 -0400
pan/bi: Report whether workgroups can be merged
This flag gates a Valhall hardware optimization for compute shaders.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15793>
---
src/panfrost/bifrost/bifrost_compile.c | 12 ++++++++++++
src/panfrost/util/pan_ir.h | 9 +++++++++
2 files changed, 21 insertions(+)
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 27f7ae6e8d6..bcc8e0c7031 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -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);
diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h
index 5b5a0019c94..0ae68b70bf6 100644
--- a/src/panfrost/util/pan_ir.h
+++ b/src/panfrost/util/pan_ir.h
@@ -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
More information about the mesa-commit
mailing list