intel/brw: Only validate GRF boundary crossing restriction for GRFs

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31294>
This commit is contained in:
Caio Oliveira 2024-09-20 15:17:28 -07:00 committed by Marge Bot
parent 878ae9708a
commit e1b74407bb

View file

@ -1014,10 +1014,11 @@ general_restrictions_on_region_parameters(const struct brw_isa_info *isa,
for (unsigned i = 0; i < num_sources; i++) { for (unsigned i = 0; i < num_sources; i++) {
unsigned vstride, width, hstride, element_size, subreg; unsigned vstride, width, hstride, element_size, subreg;
enum brw_reg_type type; enum brw_reg_type type;
enum brw_reg_file file;
#define DO_SRC(n) \ #define DO_SRC(n) \
if (brw_inst_src ## n ## _reg_file(devinfo, inst) == \ file = brw_inst_src ## n ## _reg_file(devinfo, inst); \
IMM) \ if (file == IMM) \
continue; \ continue; \
\ \
vstride = STRIDE(brw_inst_src ## n ## _vstride(devinfo, inst)); \ vstride = STRIDE(brw_inst_src ## n ## _vstride(devinfo, inst)); \
@ -1075,29 +1076,31 @@ general_restrictions_on_region_parameters(const struct brw_isa_info *isa,
/* VertStride must be used to cross GRF register boundaries. This rule /* VertStride must be used to cross GRF register boundaries. This rule
* implies that elements within a 'Width' cannot cross GRF boundaries. * implies that elements within a 'Width' cannot cross GRF boundaries.
*/ */
unsigned rowbase = subreg; if (file == FIXED_GRF) {
assert(util_is_power_of_two_nonzero(reg_unit(devinfo))); unsigned rowbase = subreg;
unsigned grf_size_shift = ffs(REG_SIZE * reg_unit(devinfo)) - 1; assert(util_is_power_of_two_nonzero(reg_unit(devinfo)));
unsigned grf_size_shift = ffs(REG_SIZE * reg_unit(devinfo)) - 1;
for (int y = 0; y < exec_size / width; y++) { for (int y = 0; y < exec_size / width; y++) {
bool spans_grfs = false; bool spans_grfs = false;
unsigned offset = rowbase; unsigned offset = rowbase;
unsigned first_grf = offset >> grf_size_shift; unsigned first_grf = offset >> grf_size_shift;
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
const unsigned end_byte = offset + (element_size - 1); const unsigned end_byte = offset + (element_size - 1);
const unsigned end_grf = end_byte >> grf_size_shift; const unsigned end_grf = end_byte >> grf_size_shift;
spans_grfs = end_grf != first_grf; spans_grfs = end_grf != first_grf;
if (spans_grfs) if (spans_grfs)
break;
offset += hstride * element_size;
}
rowbase += vstride * element_size;
if (spans_grfs) {
ERROR("VertStride must be used to cross GRF register boundaries");
break; break;
offset += hstride * element_size; }
}
rowbase += vstride * element_size;
if (spans_grfs) {
ERROR("VertStride must be used to cross GRF register boundaries");
break;
} }
} }
} }