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 <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24552>
This commit is contained in:
Lionel Landwerlin 2023-08-07 17:06:49 +03:00 committed by Marge Bot
parent 0e244d56e3
commit 6f694432e4
2 changed files with 18 additions and 1 deletions

View file

@ -713,6 +713,22 @@ Intel driver environment variables
if set to 1, true or yes, then the driver prefers accuracy over if set to 1, true or yes, then the driver prefers accuracy over
performance in trig functions. 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 <SHA-1>" in stderr replacing the original
assembly.
.. envvar:: INTEL_SHADER_ASM_READ_PATH .. envvar:: INTEL_SHADER_ASM_READ_PATH
if set, determines the directory to be used for overriding shader if set, determines the directory to be used for overriding shader

View file

@ -6200,7 +6200,8 @@ fs_visitor::debug_optimizer(const char *pass_name,
return; return;
char *filename; 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, stage_abbrev, dispatch_width, nir->info.name,
iteration, pass_num, pass_name); iteration, pass_num, pass_name);
if (ret == -1) if (ret == -1)