Module: Mesa Branch: staging/22.0 Commit: e0db9764680816143664daaa4af03c22db83e091 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0db9764680816143664daaa4af03c22db83e091
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 28361f073ca..8e20e5397fc 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -7140,7 +7140,7 @@ "description": "intel/compiler: Call inst->resize_sources before setting the sources", "nominated": true, "nomination_type": 1, - "resolution": 5, + "resolution": 1, "because_sha": "a920979d4f30a48a23f8ff375ce05fa8a947dd96" }, { diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index c4639f43098..6be5e66d37f 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -5791,11 +5791,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 @@ -6018,11 +6018,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 @@ -6088,10 +6088,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
