intel/compiler: Centralize type stomping logic for Gen12.5 restrictions
This patch improves code readability by centralizing the type stomping logic for Gen12.5 region restrictions in `brw_lower_alu_restrictions`. It removes redundant comments and ensures type consistency assertions in `brw_broadcast`, `generate_mov_indirect`, and `generate_shuffle`. Thank you Ken for guiding me on this. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35006>
This commit is contained in:
committed by
Marge Bot
parent
80f6b5b483
commit
524733a990
@@ -1716,18 +1716,8 @@ brw_broadcast(struct brw_codegen *p,
|
||||
assert(src.file == FIXED_GRF &&
|
||||
src.address_mode == BRW_ADDRESS_DIRECT);
|
||||
assert(!src.abs && !src.negate);
|
||||
|
||||
/* Gen12.5 adds the following region restriction:
|
||||
*
|
||||
* "Vx1 and VxH indirect addressing for Float, Half-Float, Double-Float
|
||||
* and Quad-Word data must not be used."
|
||||
*
|
||||
* We require the source and destination types to match so stomp to an
|
||||
* unsigned integer type.
|
||||
*/
|
||||
assert(brw_type_is_uint(src.type));
|
||||
assert(src.type == dst.type);
|
||||
src.type = dst.type =
|
||||
brw_type_with_size(BRW_TYPE_UD, brw_type_size_bits(src.type));
|
||||
|
||||
if ((src.vstride == 0 && src.hstride == 0) ||
|
||||
idx.file == IMM) {
|
||||
|
||||
@@ -202,18 +202,8 @@ brw_generator::generate_mov_indirect(brw_inst *inst,
|
||||
assert(indirect_byte_offset.type == BRW_TYPE_UD);
|
||||
assert(indirect_byte_offset.file == FIXED_GRF);
|
||||
assert(!reg.abs && !reg.negate);
|
||||
|
||||
/* Gen12.5 adds the following region restriction:
|
||||
*
|
||||
* "Vx1 and VxH indirect addressing for Float, Half-Float, Double-Float
|
||||
* and Quad-Word data must not be used."
|
||||
*
|
||||
* We require the source and destination types to match so stomp to an
|
||||
* unsigned integer type.
|
||||
*/
|
||||
assert(brw_type_is_uint(reg.type));
|
||||
assert(reg.type == dst.type);
|
||||
reg.type = dst.type =
|
||||
brw_type_with_size(BRW_TYPE_UD, brw_type_size_bits(reg.type));
|
||||
|
||||
unsigned imm_byte_offset = reg.nr * REG_SIZE + reg.subnr;
|
||||
|
||||
@@ -337,18 +327,8 @@ brw_generator::generate_shuffle(brw_inst *inst,
|
||||
* implement for 64-bit values so we just don't bother.
|
||||
*/
|
||||
assert(devinfo->has_64bit_float || brw_type_size_bytes(src.type) <= 4);
|
||||
|
||||
/* Gen12.5 adds the following region restriction:
|
||||
*
|
||||
* "Vx1 and VxH indirect addressing for Float, Half-Float, Double-Float
|
||||
* and Quad-Word data must not be used."
|
||||
*
|
||||
* We require the source and destination types to match so stomp to an
|
||||
* unsigned integer type.
|
||||
*/
|
||||
assert(brw_type_is_uint(src.type));
|
||||
assert(src.type == dst.type);
|
||||
src.type = dst.type =
|
||||
brw_type_with_size(BRW_TYPE_UD, brw_type_size_bits(src.type));
|
||||
|
||||
/* Because we're using the address register, we're limited to 16-wide
|
||||
* by the address register file and 8-wide for 64-bit types. We could try
|
||||
|
||||
@@ -727,6 +727,22 @@ brw_lower_alu_restrictions(brw_shader &s)
|
||||
}
|
||||
break;
|
||||
|
||||
case SHADER_OPCODE_SHUFFLE:
|
||||
case SHADER_OPCODE_MOV_INDIRECT:
|
||||
case SHADER_OPCODE_BROADCAST:
|
||||
/* Gen12.5 adds the following region restriction:
|
||||
*
|
||||
* "Vx1 and VxH indirect addressing for Float, Half-Float,
|
||||
* Double-Float and Quad-Word data must not be used."
|
||||
*
|
||||
* We require the source and destination types to match so stomp to
|
||||
* an unsigned integer type.
|
||||
*/
|
||||
assert(inst->src[0].type == inst->dst.type);
|
||||
inst->src[0].type = inst->dst.type = brw_type_with_size(BRW_TYPE_UD,
|
||||
brw_type_size_bits(inst->src[0].type));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -161,8 +161,6 @@ brw_optimize(brw_shader &s)
|
||||
|
||||
brw_shader_phase_update(s, BRW_SHADER_PHASE_AFTER_MIDDLE_LOWERING);
|
||||
|
||||
OPT(brw_lower_alu_restrictions);
|
||||
|
||||
OPT(brw_opt_combine_constants);
|
||||
if (OPT(brw_lower_integer_multiplication)) {
|
||||
/* If lower_integer_multiplication made progress, it may have produced
|
||||
@@ -213,6 +211,8 @@ brw_optimize(brw_shader &s)
|
||||
|
||||
OPT(brw_lower_indirect_mov);
|
||||
|
||||
OPT(brw_lower_alu_restrictions);
|
||||
|
||||
OPT(brw_lower_find_live_channel);
|
||||
|
||||
OPT(brw_lower_load_subgroup_invocation);
|
||||
|
||||
Reference in New Issue
Block a user