intel/compiler: Call inst->resize_sources before setting the sources

You should probably resize the sources array before accessing entries
that might be out of bounds.  inst->resize_sources() always allocates
enough space for at least 3 sources, so this is really only an issue
when there are 4+ sources.

Fixes: a920979d4f ("intel/fs: Use split sends for surface writes on gen9+")
Fixes: 4f86a70599 ("intel/fs: Lower DW untyped r/w messages to LSC when available")
Fixes: d372abe397 ("intel/fs: Add surface OWORD BLOCK opcodes")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15632>
This commit is contained in:
Kenneth Graunke 2022-03-29 02:42:41 -07:00
parent 356f6bb8a5
commit 1967fd3b10

View file

@ -5813,11 +5813,11 @@ lower_surface_logical_send(const fs_builder &bld, fs_inst *inst)
inst->sfid = sfid;
setup_surface_descriptors(bld, inst, desc, surface, surface_handle);
inst->resize_sources(4);
/* Finally, the payload */
inst->src[2] = payload;
inst->src[3] = payload2;
inst->resize_sources(4);
}
static enum lsc_opcode
@ -6040,11 +6040,11 @@ lower_lsc_surface_logical_send(const fs_builder &bld, fs_inst *inst)
inst->send_has_side_effects = has_side_effects;
inst->send_is_volatile = !has_side_effects;
inst->resize_sources(4);
/* Finally, the payload */
inst->src[2] = payload;
inst->src[3] = payload2;
inst->resize_sources(4);
}
static void
@ -6110,10 +6110,10 @@ lower_surface_block_logical_send(const fs_builder &bld, fs_inst *inst)
arg.ud, write);
setup_surface_descriptors(bld, inst, desc, surface, surface_handle);
inst->resize_sources(4);
inst->src[2] = header;
inst->src[3] = data;
inst->resize_sources(4);
}
static fs_reg