ir3/cp: Prevent setting an address on subgroup macros

These macros expand to a mov in an if statement which breaks address
assumption that instruction which produces address and consumes it
are in the same block.

Fixes test:
 dEQP-VK.subgroups.ballot_broadcast.framebuffer.subgroupbroadcast_intvertex

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13931>
This commit is contained in:
Danylo Piliaiev
2021-11-23 18:57:17 +02:00
committed by Marge Bot
parent d14c09f7f6
commit a78c36ecc6
3 changed files with 25 additions and 0 deletions

View File

@@ -861,6 +861,23 @@ is_const_mov(struct ir3_instruction *instr)
(type_sint(src_type) && type_sint(dst_type));
}
static inline bool
is_subgroup_cond_mov_macro(struct ir3_instruction *instr)
{
switch (instr->opc) {
case OPC_BALLOT_MACRO:
case OPC_ANY_MACRO:
case OPC_ALL_MACRO:
case OPC_ELECT_MACRO:
case OPC_READ_COND_MACRO:
case OPC_READ_FIRST_MACRO:
case OPC_SWZ_SHARED_MACRO:
return true;
default:
return false;
}
}
static inline bool
is_alu(struct ir3_instruction *instr)
{

View File

@@ -397,6 +397,11 @@ reg_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr,
conflicts(instr->address, reg->def->instr->address))
return false;
/* These macros expand to a mov in an if statement */
if ((src_reg->flags & IR3_REG_RELATIV) &&
is_subgroup_cond_mov_macro(instr))
return false;
/* This seems to be a hw bug, or something where the timings
* just somehow don't work out. This restriction may only
* apply if the first src is also CONST.

View File

@@ -149,6 +149,9 @@ instr_cp_postsched(struct ir3_instruction *mov)
if (is_meta(use))
continue;
if (is_subgroup_cond_mov_macro(use))
continue;
struct ir3_register *def = src->def;
if (has_conflicting_write(mov, use, &def, src->array.id, offset))
continue;