Add in individual flags for Vulkan <-> WebGPU passes (#2615)

Adds flags and/or documentation for individual transformation passes
that had been missed in previous patches.

Fixes #2574
This commit is contained in:
Ryan Harrison 2019-05-22 10:06:53 -07:00 committed by GitHub
parent 13f61bf859
commit 4557d08584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -472,6 +472,10 @@ bool Optimizer::RegisterPassFromFlag(const std::string& flag) {
RegisterPass(CreateGenerateWebGPUInitializersPass());
} else if (pass_name == "legalize-vector-shuffle") {
RegisterPass(CreateLegalizeVectorShufflePass());
} else if (pass_name == "split-invalid-unreachable") {
RegisterPass(CreateLegalizeVectorShufflePass());
} else if (pass_name == "decompose-initialized-variables") {
RegisterPass(CreateDecomposeInitializedVariablesPass());
} else {
Errorf(consumer(), nullptr, {},
"Unknown flag '--%s'. Use --help for a list of valid flags",

View File

@ -140,6 +140,12 @@ Options (in lexicographical order):)",
another. It will only propagate an array if the source is never
written to, and the only store to the target is the copy.)");
printf(R"(
--decompose-initialized-variables
Decomposes initialized variable declarations into a declaration
followed by a store of the initial value. This is done to work
around known issues with some Vulkan drivers for initialize
variables.)");
printf(R"(
--eliminate-common-uniform
Perform load/load elimination for duplicate uniform values.
Converts any constant index access chain uniform loads into
@ -228,6 +234,11 @@ Options (in lexicographical order):)",
option --relax-logical-pointer to the validator.)",
GetLegalizationPasses().c_str());
printf(R"(
--legalize-vector-shuffle
Converts any usages of 0xFFFFFFFF for the literals in
OpVectorShuffle to a literal 0. This is done since 0xFFFFFFFF is
forbidden in WebGPU.)");
printf(R"(
--local-redundancy-elimination
Looks for instructions in the same basic block that compute the
same value, and deletes the redundant ones.)");
@ -398,6 +409,13 @@ Options (in lexicographical order):)",
Will simplify all instructions in the function as much as
possible.)");
printf(R"(
--split-invalid-unreachable
Attempts to legalize for WebGPU cases where an unreachable
merge-block is also a continue-target by splitting it into two
seperate blocks. There exist legal, for Vulkan, instances of this
pattern that cannot be converted into legal WebGPU, so this
conversion may not succeed.)");
printf(R"(
--skip-validation
Will not validate the SPIR-V before optimizing. If the SPIR-V
is invalid, the optimizer may fail or generate incorrect code.