From e62606b2ecd1ed9b99e548ad69aa824f3fadc2a5 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Sun, 24 Mar 2024 14:25:40 -0700 Subject: [PATCH] intel/brw/validate: Update dst grf crossing check for Xe2 Rework: * Update grf_size_shift calculation (s-b Ken) Backport-to: 24.2 Signed-off-by: Jordan Justen Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_eu_validate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c index 45e0698b025..d0cadbdf3d5 100644 --- a/src/intel/compiler/brw_eu_validate.c +++ b/src/intel/compiler/brw_eu_validate.c @@ -1076,15 +1076,17 @@ general_restrictions_on_region_parameters(const struct brw_isa_info *isa, * implies that elements within a 'Width' cannot cross GRF boundaries. */ unsigned rowbase = subreg; + 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++) { bool spans_grfs = false; unsigned offset = rowbase; - unsigned first_grf = offset / REG_SIZE; + unsigned first_grf = offset >> grf_size_shift; for (int x = 0; x < width; x++) { const unsigned end_byte = offset + (element_size - 1); - const unsigned end_grf = end_byte / REG_SIZE; + const unsigned end_grf = end_byte >> grf_size_shift; spans_grfs = end_grf != first_grf; if (spans_grfs) break;