From: Sagar Ghuge Date: Wed, 8 Mar 2023 20:31:51 +0000 (-0800) Subject: intel/compiler: Add swsb_stall debug option X-Git-Tag: upstream/23.3.3~11860 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a34b2ab0e6f6fce8c959ac837c1455052618bb7;p=platform%2Fupstream%2Fmesa.git intel/compiler: Add swsb_stall debug option When enabled, on gfx12 plus, we will add the sync nop instruction after each instruction to make sure that current instruction depends on the previous instruction explicitly. This option will help us to get a hint if something is missing or broken in software scoreboard pass. Signed-off-by: Sagar Ghuge Reviewed-by: Lionel Landwerlin Part-of: --- diff --git a/docs/envvars.rst b/docs/envvars.rst index e1fff2c..346c68b 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -527,6 +527,8 @@ Intel driver environment variables ``sync`` after sending each batch, wait on the CPU for that batch to finish rendering + ``swsb-stall`` + Insert sync NOP after each instruction. This is only valid for Gfx12+. ``task`` dump shader assembly for task shaders ``tcs`` diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp index eee62e5..95227e9 100644 --- a/src/intel/compiler/brw_fs_generator.cpp +++ b/src/intel/compiler/brw_fs_generator.cpp @@ -30,6 +30,7 @@ #include "brw_eu.h" #include "brw_fs.h" #include "brw_cfg.h" +#include "dev/intel_debug.h" #include "util/mesa-sha1.h" #include "util/half_float.h" @@ -2387,6 +2388,14 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width, brw_inst_set_no_dd_check(p->devinfo, last, inst->no_dd_check); } } + + /* When enabled, insert sync NOP after every instruction and make sure + * that current instruction depends on the previous instruction. + */ + if (INTEL_DEBUG(DEBUG_SWSB_STALL) && devinfo->ver >= 12) { + brw_set_default_swsb(p, tgl_swsb_regdist(1)); + brw_SYNC(p, TGL_SYNC_NOP); + } } brw_set_uip_jip(p, start_offset); diff --git a/src/intel/dev/intel_debug.c b/src/intel/dev/intel_debug.c index aa7a8d0..8aaddfc 100644 --- a/src/intel/dev/intel_debug.c +++ b/src/intel/dev/intel_debug.c @@ -100,6 +100,7 @@ static const struct debug_control debug_control[] = { { "stall", DEBUG_STALL }, { "capture-all", DEBUG_CAPTURE_ALL }, { "perf-symbol-names", DEBUG_PERF_SYMBOL_NAMES }, + { "swsb-stall", DEBUG_SWSB_STALL }, { NULL, 0 } }; diff --git a/src/intel/dev/intel_debug.h b/src/intel/dev/intel_debug.h index ed90d3e..08d50f5 100644 --- a/src/intel/dev/intel_debug.h +++ b/src/intel/dev/intel_debug.h @@ -90,6 +90,7 @@ extern uint64_t intel_debug; #define DEBUG_MESH (1ull << 42) #define DEBUG_CAPTURE_ALL (1ull << 43) #define DEBUG_PERF_SYMBOL_NAMES (1ull << 44) +#define DEBUG_SWSB_STALL (1ull << 45) #define DEBUG_ANY (~0ull)