mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-10-18 11:10:05 +00:00
Allow various validation options to be passed to spirv-opt (#3314)
This change increases the set of validator options that can be passed to spirv-opt, to match those options that spirv-reduce and spirv-fuzz accept. This is useful to still allow some validation, at the start of and during optimisation, for SPIR-V modules that the strict validator would reject.
This commit is contained in:
parent
30ffe62e25
commit
5547553a0c
@ -114,6 +114,10 @@ Options (in lexicographical order):)",
|
|||||||
and VK_AMD_shader_trinary_minmax with equivalent code using core
|
and VK_AMD_shader_trinary_minmax with equivalent code using core
|
||||||
instructions and capabilities.)");
|
instructions and capabilities.)");
|
||||||
printf(R"(
|
printf(R"(
|
||||||
|
--before-hlsl-legalization
|
||||||
|
Forwards this option to the validator. See the validator help
|
||||||
|
for details.)");
|
||||||
|
printf(R"(
|
||||||
--ccp
|
--ccp
|
||||||
Apply the conditional constant propagation transform. This will
|
Apply the conditional constant propagation transform. This will
|
||||||
propagate constant values throughout the program, and simplify
|
propagate constant values throughout the program, and simplify
|
||||||
@ -403,14 +407,21 @@ Options (in lexicographical order):)",
|
|||||||
Looks for instructions in the same function that compute the
|
Looks for instructions in the same function that compute the
|
||||||
same value, and deletes the redundant ones.)");
|
same value, and deletes the redundant ones.)");
|
||||||
printf(R"(
|
printf(R"(
|
||||||
|
--relax-block-layout
|
||||||
|
Forwards this option to the validator. See the validator help
|
||||||
|
for details.)");
|
||||||
|
printf(R"(
|
||||||
--relax-float-ops
|
--relax-float-ops
|
||||||
Decorate all float operations with RelaxedPrecision if not already
|
Decorate all float operations with RelaxedPrecision if not already
|
||||||
so decorated. This does not decorate types or variables.)");
|
so decorated. This does not decorate types or variables.)");
|
||||||
printf(R"(
|
printf(R"(
|
||||||
|
--relax-logical-pointer
|
||||||
|
Forwards this option to the validator. See the validator help
|
||||||
|
for details.)");
|
||||||
|
printf(R"(
|
||||||
--relax-struct-store
|
--relax-struct-store
|
||||||
Allow store from one struct type to a different type with
|
Forwards this option to the validator. See the validator help
|
||||||
compatible layout and members. This option is forwarded to the
|
for details.)");
|
||||||
validator.)");
|
|
||||||
printf(R"(
|
printf(R"(
|
||||||
--remove-duplicates
|
--remove-duplicates
|
||||||
Removes duplicate types, decorations, capabilities and extension
|
Removes duplicate types, decorations, capabilities and extension
|
||||||
@ -425,6 +436,10 @@ Options (in lexicographical order):)",
|
|||||||
Replace loads and stores to function local variables with
|
Replace loads and stores to function local variables with
|
||||||
operations on SSA IDs.)");
|
operations on SSA IDs.)");
|
||||||
printf(R"(
|
printf(R"(
|
||||||
|
--scalar-block-layout
|
||||||
|
Forwards this option to the validator. See the validator help
|
||||||
|
for details.)");
|
||||||
|
printf(R"(
|
||||||
--scalar-replacement[=<n>]
|
--scalar-replacement[=<n>]
|
||||||
Replace aggregate function scope variables that are only accessed
|
Replace aggregate function scope variables that are only accessed
|
||||||
via their elements with new function variables representing each
|
via their elements with new function variables representing each
|
||||||
@ -444,6 +459,10 @@ Options (in lexicographical order):)",
|
|||||||
Will simplify all instructions in the function as much as
|
Will simplify all instructions in the function as much as
|
||||||
possible.)");
|
possible.)");
|
||||||
printf(R"(
|
printf(R"(
|
||||||
|
--skip-block-layout
|
||||||
|
Forwards this option to the validator. See the validator help
|
||||||
|
for details.)");
|
||||||
|
printf(R"(
|
||||||
--split-invalid-unreachable
|
--split-invalid-unreachable
|
||||||
Attempts to legalize for WebGPU cases where an unreachable
|
Attempts to legalize for WebGPU cases where an unreachable
|
||||||
merge-block is also a continue-target by splitting it into two
|
merge-block is also a continue-target by splitting it into two
|
||||||
@ -822,6 +841,18 @@ OptStatus ParseFlags(int argc, const char** argv,
|
|||||||
optimizer->RegisterWebGPUToVulkanPasses();
|
optimizer->RegisterWebGPUToVulkanPasses();
|
||||||
} else if (0 == strcmp(cur_arg, "--validate-after-all")) {
|
} else if (0 == strcmp(cur_arg, "--validate-after-all")) {
|
||||||
optimizer->SetValidateAfterAll(true);
|
optimizer->SetValidateAfterAll(true);
|
||||||
|
} else if (0 == strcmp(cur_arg, "--before-hlsl-legalization")) {
|
||||||
|
validator_options->SetBeforeHlslLegalization(true);
|
||||||
|
} else if (0 == strcmp(cur_arg, "--relax-logical-pointer")) {
|
||||||
|
validator_options->SetRelaxLogicalPointer(true);
|
||||||
|
} else if (0 == strcmp(cur_arg, "--relax-block-layout")) {
|
||||||
|
validator_options->SetRelaxBlockLayout(true);
|
||||||
|
} else if (0 == strcmp(cur_arg, "--scalar-block-layout")) {
|
||||||
|
validator_options->SetScalarBlockLayout(true);
|
||||||
|
} else if (0 == strcmp(cur_arg, "--skip-block-layout")) {
|
||||||
|
validator_options->SetSkipBlockLayout(true);
|
||||||
|
} else if (0 == strcmp(cur_arg, "--relax-struct-store")) {
|
||||||
|
validator_options->SetRelaxStructStore(true);
|
||||||
} else {
|
} else {
|
||||||
// Some passes used to accept the form '--pass arg', canonicalize them
|
// Some passes used to accept the form '--pass arg', canonicalize them
|
||||||
// to '--pass=arg'.
|
// to '--pass=arg'.
|
||||||
|
Loading…
Reference in New Issue
Block a user