Mesa (main): pan/va: Assign slots roundrobin
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 1 16:29:30 UTC 2022
Module: Mesa
Branch: main
Commit: 492f4055dd22a7ce999efbf1e8281a419b2dbc99
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=492f4055dd22a7ce999efbf1e8281a419b2dbc99
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Wed May 25 09:39:44 2022 -0400
pan/va: Assign slots roundrobin
This should reduce false dependencies with asynchronous instructions.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16804>
---
src/panfrost/bifrost/valhall/va_compiler.h | 1 +
src/panfrost/bifrost/valhall/va_insert_flow.c | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/src/panfrost/bifrost/valhall/va_compiler.h b/src/panfrost/bifrost/valhall/va_compiler.h
index 9d19be31896..c6f841c39b3 100644
--- a/src/panfrost/bifrost/valhall/va_compiler.h
+++ b/src/panfrost/bifrost/valhall/va_compiler.h
@@ -40,6 +40,7 @@ void va_repair_fau(bi_builder *b, bi_instr *I);
void va_fuse_add_imm(bi_instr *I);
void va_lower_constants(bi_context *ctx, bi_instr *I);
void va_lower_isel(bi_instr *I);
+void va_assign_slots(bi_context *ctx);
void va_insert_flow_control_nops(bi_context *ctx);
void va_merge_flow(bi_context *ctx);
uint64_t va_pack_instr(const bi_instr *I);
diff --git a/src/panfrost/bifrost/valhall/va_insert_flow.c b/src/panfrost/bifrost/valhall/va_insert_flow.c
index 3ca82670b97..f7e75f2d3ea 100644
--- a/src/panfrost/bifrost/valhall/va_insert_flow.c
+++ b/src/panfrost/bifrost/valhall/va_insert_flow.c
@@ -451,3 +451,29 @@ va_insert_flow_control_nops(bi_context *ctx)
if (frag && !start->pass_flags)
bi_flow(ctx, bi_before_block(start), VA_FLOW_DISCARD);
}
+
+/*
+ * Assign slots to all asynchronous instructions. A few special instructions
+ * require specific slots. For the rest, we assign slots in a round-robin
+ * fashion to reduce false dependencies when encoding waits.
+ *
+ * This should be called before va_insert_flow_control_nops.
+ */
+void
+va_assign_slots(bi_context *ctx)
+{
+ unsigned counter = 0;
+
+ bi_foreach_instr_global(ctx, I) {
+ if (I->op == BI_OPCODE_BARRIER) {
+ I->slot = 7;
+ } else if (I->op == BI_OPCODE_ZS_EMIT || I->op == BI_OPCODE_ATEST) {
+ I->slot = 0;
+ } else if (bi_opcode_props[I->op].message) {
+ I->slot = counter++;
+
+ if (counter == 3)
+ counter = 0;
+ }
+ }
+}
More information about the mesa-commit
mailing list