From 7b3149c99b6cde6b7b755030e55487bf37e323ff Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Tue, 30 Apr 2024 11:19:36 -0700 Subject: [PATCH] intel/brw: Retype some regs to BRW_TYPE_UD for Xe2 indirect accesses Following https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28957, some Xe2 code paths started triggering asserts. In the cases fixed by this patch, it was because of the assert added to brw_type_larger_of() in cf8ed9925f2 ("intel/brw: Make a helper for finding the largest of two types"), and then brw_type_larger_of() is used in 674e89953f0. (For example, the assert was triggering when the SHL types differed between D and UD.) Fixes: 674e89953f0 ("intel/brw: Use new builder helpers that allocate a VGRF destination") Signed-off-by: Jordan Justen Reviewed-by: Francisco Jerez Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_fs_nir.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index 48eae42a58b..fe22121b3d0 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -2754,7 +2754,7 @@ get_indirect_offset(nir_to_brw_state &ntb, nir_intrinsic_instr *instr) return offset; /* Convert Owords (16-bytes) to bytes */ - return ntb.bld.SHL(offset, brw_imm_ud(4u)); + return ntb.bld.SHL(retype(offset, BRW_TYPE_UD), brw_imm_ud(4u)); } static void @@ -5545,7 +5545,8 @@ emit_urb_indirect_writes_xe2(const fs_builder &bld, nir_intrinsic_instr *instr, payload_srcs[c] = horiz_offset(offset(src, bld, c), write_size * q); fs_reg addr = - wbld.ADD(wbld.SHL(horiz_offset(offset_src, write_size * q), + wbld.ADD(wbld.SHL(retype(horiz_offset(offset_src, write_size * q), + BRW_TYPE_UD), brw_imm_ud(2)), urb_handle); fs_reg srcs[URB_LOGICAL_NUM_SRCS]; @@ -5789,7 +5790,9 @@ emit_urb_indirect_reads_xe2(const fs_builder &bld, nir_intrinsic_instr *instr, for (unsigned q = 0; q < bld.dispatch_width() / 16; q++) { fs_builder wbld = bld.group(16, q); - fs_reg addr = wbld.SHL(horiz_offset(offset_src, 16 * q), brw_imm_ud(2)); + fs_reg addr = wbld.SHL(retype(horiz_offset(offset_src, 16 * q), + BRW_TYPE_UD), + brw_imm_ud(2)); fs_reg srcs[URB_LOGICAL_NUM_SRCS]; srcs[URB_LOGICAL_SRC_HANDLE] = wbld.ADD(addr, urb_handle);