From: Lionel Landwerlin Date: Mon, 7 Aug 2023 14:06:49 +0000 (+0300) Subject: intel/fs: add variable for output of debug backend optimizer X-Git-Tag: upstream/23.3.3~3569 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f694432e431826fd4d55eca99464329874a7153;p=platform%2Fupstream%2Fmesa.git intel/fs: add variable for output of debug backend optimizer It can be useful to compare 2 runs with different compiler changes. Signed-off-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/docs/envvars.rst b/docs/envvars.rst index 4dc615c..204637d 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -713,6 +713,22 @@ Intel driver environment variables if set to 1, true or yes, then the driver prefers accuracy over performance in trig functions. +.. envvar:: INTEL_SHADER_OPTIMIZER_PATH + + if set, determines the directory to be used for overriding shader + assembly. The binaries with custom assembly should be placed in + this folder and have a name formatted as ``sha1_of_assembly.bin``. + The SHA-1 of a shader assembly is printed when assembly is dumped via + corresponding :envvar:`INTEL_DEBUG` flag (e.g. ``vs`` for vertex shader). + A binary could be generated from a dumped assembly by ``i965_asm``. + For :envvar:`INTEL_SHADER_ASM_READ_PATH` to work it is necessary to enable + dumping of corresponding shader stages via :envvar:`INTEL_DEBUG`. + It is advised to use ``nocompact`` flag of :envvar:`INTEL_DEBUG` when + dumping and overriding shader assemblies. + The success of assembly override would be signified by "Successfully + overrode shader with sha1 " in stderr replacing the original + assembly. + .. envvar:: INTEL_SHADER_ASM_READ_PATH if set, determines the directory to be used for overriding shader diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 8c981f0..188b60c 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -6200,7 +6200,8 @@ fs_visitor::debug_optimizer(const char *pass_name, return; char *filename; - int ret = asprintf(&filename, "%s%d-%s-%02d-%02d-%s", + int ret = asprintf(&filename, "%s/%s%d-%s-%02d-%02d-%s", + debug_get_option("INTEL_SHADER_OPTIMIZER_PATH", "./"), stage_abbrev, dispatch_width, nir->info.name, iteration, pass_num, pass_name); if (ret == -1)