From d2d72fccf1bdd996e5a429e5cc20205cd110995e Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Mon, 20 Dec 2021 14:49:02 -0800 Subject: [PATCH] intel/fs: Fix destination suboffset calculations for non-trivial strides in SHUFFLE codegen. One of the two SHUFFLE implementations wasn't taking into account the destination stride at all, and the other (more commonly used) one was taking it into account incorrectly since brw_reg::hstride represents the stride logarithmically, so we need to use a left-shift operator instead of product. Found by inspection. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_fs_generator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp index 2158bbad17d..cfc96570cca 100644 --- a/src/intel/compiler/brw_fs_generator.cpp +++ b/src/intel/compiler/brw_fs_generator.cpp @@ -631,7 +631,7 @@ fs_generator::generate_shuffle(fs_inst *inst, */ const unsigned i = idx.file == BRW_IMMEDIATE_VALUE ? idx.ud : 0; struct brw_reg group_src = stride(suboffset(src, i), 0, 1, 0); - struct brw_reg group_dst = suboffset(dst, group); + struct brw_reg group_dst = suboffset(dst, group << (dst.hstride - 1)); if (type_sz(src.type) > 4 && !devinfo->has_64bit_float) { brw_MOV(p, subscript(group_dst, BRW_REGISTER_TYPE_UD, 0), subscript(group_src, BRW_REGISTER_TYPE_UD, 0)); @@ -743,7 +743,7 @@ fs_generator::generate_shuffle(fs_inst *inst, brw_MOV(p, byte_offset(dst_d, 4), retype(brw_VxH_indirect(0, 4), BRW_REGISTER_TYPE_D)); } else { - brw_MOV(p, suboffset(dst, group * dst.hstride), + brw_MOV(p, suboffset(dst, group << (dst.hstride - 1)), retype(brw_VxH_indirect(0, 0), src.type)); } }