intel/fs/gfx20+: Handle subdword integer regioning restrictions in copy propagation.

This makes sure that copy propagation doesn't undo the lowering of
restricted sub-dword integer regions done by brw_fs_lower_regioning().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28698>
This commit is contained in:
Francisco Jerez 2024-04-10 15:23:45 -07:00
parent 217d412360
commit 62aab1437e
2 changed files with 22 additions and 5 deletions

View File

@ -788,6 +788,15 @@ try_copy_propagate(const brw_compiler *compiler, fs_inst *inst,
(reg_offset(inst->dst) % (REG_SIZE * reg_unit(devinfo))) != (reg_offset(entry->src) % (REG_SIZE * reg_unit(devinfo))))
return false;
/*
* Bail if the composition of both regions would be affected by the Xe2+
* regioning restrictions that apply to integer types smaller than a dword.
* See BSpec #56640 for details.
*/
const fs_reg tmp = horiz_stride(entry->src, inst->src[arg].stride);
if (has_subdword_integer_region_restriction(devinfo, inst, &tmp, 1))
return false;
/* The <8;8,0> regions used for FS attributes in multipolygon
* dispatch mode could violate regioning restrictions, don't copy
* propagate them in such cases.

View File

@ -813,15 +813,15 @@ has_dst_aligned_region_restriction(const intel_device_info *devinfo,
*/
static inline bool
has_subdword_integer_region_restriction(const intel_device_info *devinfo,
const fs_inst *inst)
const fs_inst *inst,
const fs_reg *srcs, unsigned num_srcs)
{
if (devinfo->ver >= 20 &&
brw_reg_type_is_integer(inst->dst.type) &&
MAX2(byte_stride(inst->dst), type_sz(inst->dst.type)) < 4) {
for (unsigned i = 0; i < inst->sources; i++) {
if (brw_reg_type_is_integer(inst->src[i].type) &&
type_sz(inst->src[i].type) < 4 &&
byte_stride(inst->src[i]) >= 4)
for (unsigned i = 0; i < num_srcs; i++) {
if (brw_reg_type_is_integer(srcs[i].type) &&
type_sz(srcs[i].type) < 4 && byte_stride(srcs[i]) >= 4)
return true;
}
}
@ -829,6 +829,14 @@ has_subdword_integer_region_restriction(const intel_device_info *devinfo,
return false;
}
static inline bool
has_subdword_integer_region_restriction(const intel_device_info *devinfo,
const fs_inst *inst)
{
return has_subdword_integer_region_restriction(devinfo, inst,
inst->src, inst->sources);
}
/**
* Return whether the LOAD_PAYLOAD instruction is a plain copy of bits from
* the specified register file into a VGRF.