| 80 | } |
| 81 | |
| 82 | void PrintUsage(const char* program) { |
| 83 | std::string target_env_list = spvTargetEnvList(16, 80); |
| 84 | // NOTE: Please maintain flags in lexicographical order. |
| 85 | printf( |
| 86 | R"(%s - Optimize a SPIR-V binary file. |
| 87 | |
| 88 | USAGE: %s [options] [<input>] -o <output> |
| 89 | |
| 90 | The SPIR-V binary is read from <input>. If no file is specified, |
| 91 | or if <input> is "-", then the binary is read from standard input. |
| 92 | if <output> is "-", then the optimized output is written to |
| 93 | standard output. |
| 94 | |
| 95 | NOTE: The optimizer is a work in progress. |
| 96 | |
| 97 | Options (in lexicographical order):)", |
| 98 | program, program); |
| 99 | printf(R"( |
| 100 | --amd-ext-to-khr |
| 101 | Replaces the extensions VK_AMD_shader_ballot, VK_AMD_gcn_shader, |
| 102 | and VK_AMD_shader_trinary_minmax with equivalent code using core |
| 103 | instructions and capabilities.)"); |
| 104 | printf(R"( |
| 105 | --before-hlsl-legalization |
| 106 | Forwards this option to the validator. See the validator help |
| 107 | for details.)"); |
| 108 | printf(R"( |
| 109 | --ccp |
| 110 | Apply the conditional constant propagation transform. This will |
| 111 | propagate constant values throughout the program, and simplify |
| 112 | expressions and conditional jumps with known predicate |
| 113 | values. Performed on entry point call tree functions and |
| 114 | exported functions.)"); |
| 115 | printf(R"( |
| 116 | --cfg-cleanup |
| 117 | Cleanup the control flow graph. This will remove any unnecessary |
| 118 | code from the CFG like unreachable code. Performed on entry |
| 119 | point call tree functions and exported functions.)"); |
| 120 | printf(R"( |
| 121 | --combine-access-chains |
| 122 | Combines chained access chains to produce a single instruction |
| 123 | where possible.)"); |
| 124 | printf(R"( |
| 125 | --compact-ids |
| 126 | Remap result ids to a compact range starting from %%1 and without |
| 127 | any gaps.)"); |
| 128 | printf(R"( |
| 129 | --convert-local-access-chains |
| 130 | Convert constant index access chain loads/stores into |
| 131 | equivalent load/stores with inserts and extracts. Performed |
| 132 | on function scope variables referenced only with load, store, |
| 133 | and constant index access chains in entry point call tree |
| 134 | functions.)"); |
| 135 | printf(R"( |
| 136 | --convert-relaxed-to-half |
| 137 | Convert all RelaxedPrecision arithmetic operations to half |
| 138 | precision, inserting conversion operations where needed. |
| 139 | Run after function scope variable load and store elimination |
no test coverage detected