Module: Mesa Branch: staging/22.0 Commit: e73afedf21efb05c4fe6881c92e5415d73d8d225 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e73afedf21efb05c4fe6881c92e5415d73d8d225
Author: Kenneth Graunke <[email protected]> Date: Tue Mar 29 02:42:41 2022 -0700 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: a920979d4f3 ("intel/fs: Use split sends for surface writes on gen9+") Fixes: 4f86a70599a ("intel/fs: Lower DW untyped r/w messages to LSC when available") Fixes: d372abe3973 ("intel/fs: Add surface OWORD BLOCK opcodes") Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Rohan Garg <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15632> (cherry picked from commit 1967fd3b1018c8c609b388f4dc49afc641f501c5) --- .pick_status.json | 2 +- src/intel/compiler/brw_fs.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index fc8507956ac..e46c67426d1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1852,7 +1852,7 @@ "description": "intel/compiler: Call inst->resize_sources before setting the sources", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "because_sha": "a920979d4f30a48a23f8ff375ce05fa8a947dd96" }, { diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index fd3b921f714..c94bfc3d407 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -5751,11 +5751,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 @@ -5978,11 +5978,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 @@ -6048,10 +6048,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
