OS Manuals

/usr/bin/spirv-reduce

Collection of tools, libraries, and tests for Vulkan shader compilation

From shaderc 2026.4-r0 (os), captured 2026-11-05 by running spirv-reduce --help (exit 0). permalink

Also provided by 1 other package version
/usr/bin/spirv-reduce - Reduce a SPIR-V binary file with respect to a user-provided
interestingness test.

USAGE: /usr/bin/spirv-reduce [options] <input.spv> -o <output.spv> -- <interestingness_test> [args...]

The SPIR-V binary is read from <input.spv>. The reduced SPIR-V binary is
written to <output.spv>.

Whether a binary is interesting is determined by <interestingness_test>, which
should be the path to a script. The "--" characters are optional but denote
that all arguments that follow are positional arguments and thus will be
forwarded to the interestingness test, and not parsed by /usr/bin/spirv-reduce.

 * The script must be executable.

 * The script should take the path to a SPIR-V binary file (.spv) as an
   argument, and exit with code 0 if and only if the binary file is
   interesting.  The binary will be passed to the script as an argument after
   any other provided arguments [args...].

 * Example: an interestingness test for reducing a SPIR-V binary file that
   causes tool "foo" to exit with error code 1 and print "Fatal error: bar" to
   standard error should:
     - invoke "foo" on the binary passed as the script argument;
     - capture the return code and standard error from "bar";
     - exit with code 0 if and only if the return code of "foo" was 1 and the
       standard error from "bar" contained "Fatal error: bar".

 * The reducer does not place a time limit on how long the interestingness test
   takes to run, so it is advisable to use per-command timeouts inside the
   script when invoking SPIR-V-processing tools (such as "foo" in the above
   example).

NOTE: The reducer is a work in progress.

Options (in lexicographical order):

  --fail-on-validation-error
               Stop reduction with an error if any reduction step produces a
               SPIR-V module that fails to validate.
  -h, --help
               Print this help.
  --step-limit=
               32-bit unsigned integer specifying maximum number of steps the
               reducer will take before giving up.
  --target-function=
               32-bit unsigned integer specifying the id of a function in the
               input module.  The reducer will restrict attention to this
               function, and will not make changes to other functions or to
               instructions outside of functions, except that some global
               instructions may be added in support of reducing the target
               function.  If 0 is specified (the default) then all functions are
               reduced.
  --temp-file-prefix=
               Specifies a temporary file prefix that will be used to output
               temporary shader files during reduction.  A number and .spv
               extension will be added.  The default is "temp_", which will
               cause files like "temp_0001.spv" to be output to the current
               directory.
  --version
               Display reducer version information.

Supported validator options are as follows. See `spirv-val --help` for details.
  --before-hlsl-legalization
  --relax-block-layout
  --relax-logical-pointer
  --relax-struct-store
  --scalar-block-layout
  --skip-block-layout
Options (12)
OptionDescriptionSource
--fail-on-validation-errorStop reduction with an error if any reduction step produces a SPIR-V module that fails to validate.help
-h, --helpPrint this help.help
--step-limit32-bit unsigned integer specifying maximum number of steps the reducer will take before giving up.help
--target-function32-bit unsigned integer specifying the id of a function in the input module.help
--temp-file-prefixSpecifies a temporary file prefix that will be used to output temporary shader files during reduction.help
--versionDisplay reducer version information.help
--before-hlsl-legalizationhelp
--relax-block-layouthelp
--relax-logical-pointerhelp
--relax-struct-storehelp
--scalar-block-layouthelp
--skip-block-layouthelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.