summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2023-03-02 13:35:58 +0100
committerMarge Bot <emma+marge@anholt.net>2024-04-26 12:55:13 +0000
commit37748bbe78064ed73bc08498f4b0f35f7e05b866 (patch)
tree7b2e23a9afc4aa50d7e5c4a30000b20c206871e4
parent06cf178edeb66fa99c6f8aa1854cc64eb24daf72 (diff)
ir3: Validate scalar ALU sources
This is a HW restriction that leads to a hang if violated. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22075>
-rw-r--r--src/freedreno/ir3/ir3_validate.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/freedreno/ir3/ir3_validate.c b/src/freedreno/ir3/ir3_validate.c
index 31bfc932a24..9ed7c102016 100644
--- a/src/freedreno/ir3/ir3_validate.c
+++ b/src/freedreno/ir3/ir3_validate.c
@@ -26,6 +26,7 @@
#include "util/ralloc.h"
#include "ir3.h"
+#include "ir3_compiler.h"
struct ir3_validate_ctx {
struct ir3 *ir;
@@ -229,6 +230,10 @@ validate_instr(struct ir3_validate_ctx *ctx, struct ir3_instruction *instr)
(reg->flags & IR3_REG_HALF));
}
+ if (is_scalar_alu(instr, ctx->ir->compiler) && reg != instr->address)
+ validate_assert(ctx, reg->flags & (IR3_REG_SHARED | IR3_REG_IMMED |
+ IR3_REG_CONST));
+
last_reg = reg;
}
@@ -240,6 +245,12 @@ validate_instr(struct ir3_validate_ctx *ctx, struct ir3_instruction *instr)
_mesa_set_add(ctx->defs, instr);
+ if ((opc_cat(instr->opc) == 2 || opc_cat(instr->opc) == 3 ||
+ opc_cat(instr->opc) == 4)) {
+ validate_assert(ctx, !(instr->dsts[0]->flags & IR3_REG_SHARED) ||
+ ctx->ir->compiler->has_scalar_alu);
+ }
+
/* Check that src/dst types match the register types, and for
* instructions that have different opcodes depending on type,
* that the opcodes are correct.