Skip to content

Commit

Permalink
AdvancedInterfaceVariableScalarReplacementPass added
Browse files Browse the repository at this point in the history
It is a full-rewrite of the existing InterfaceVariableScalarReplacementPass to cover all the corner cases and ability to skip matrices from being scalarized.
The plan is to contribute this back to replace the original pass, but before that happens we have this as a separate pass.
  • Loading branch information
den-mentiei committed Jun 7, 2024
1 parent 187ebec commit 4f74fd0
Show file tree
Hide file tree
Showing 8 changed files with 1,962 additions and 1 deletion.
16 changes: 16 additions & 0 deletions include/spirv-tools/optimizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,22 @@ Optimizer::PassToken CreateAndroidDriverPatchPass();
Optimizer::PassToken CreateReduceConstArrayToStructPass();
// UE Change End: Added support for reducing const arrays to structs

// UE Change Begin: Convert-Composite-To-Op-Access-Chain-Pass
Optimizer::PassToken CreateConvertCompositeToOpAccessChainPass();
// UE Change End: Convert-Composite-To-Op-Access-Chain-Pass

// UE Change Begin: Interface variable scalar replacement pass rewrite
// Create an adv-interface-variable-scalar-replacement pass that replaces array
// or matrix interface variables with a series of scalar or vector interface
// variables. For example, it replaces `float3 foo[2]` with `float3 foo0, foo1`.
// If |process_matrices| is true, matrix interface variables will be replaced by
// scalars.
// It handles more cases than existing interface-variable-scalar-replacement
// pass, and hopefully will replace that soon.
Optimizer::PassToken CreateAdvancedInterfaceVariableScalarReplacementPass(
bool process_matrices);
// UE Change End: Interface variable scalar replacement pass rewrite

} // namespace spvtools

#endif // INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_
26 changes: 26 additions & 0 deletions source/opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
# limitations under the License.
set(SPIRV_TOOLS_OPT_SOURCES
fix_func_call_arguments.h
# UE Change Begin: Interface variable scalar replacement pass rewrite
adv_interface_var_sroa.h
# UE Change End: Interface variable scalar replacement pass rewrite
aggressive_dead_code_elim_pass.h
amd_ext_to_khr.h
analyze_live_input_pass.h
# UE Change Begin: Added support for Android driver patch pass to fix platform specific issues
android_driver_patch_pass.h
# UE Change End: Added support for Android driver patch pass to fix platform specific issues
basic_block.h
block_merge_pass.h
block_merge_util.h
Expand Down Expand Up @@ -60,7 +65,11 @@ set(SPIRV_TOOLS_OPT_SOURCES
fold_spec_constant_op_and_composite_pass.h
freeze_spec_constant_value_pass.h
function.h
# UE Change Begin: Implement a fused-multiply-add pass to reduce the
# possibility of re-association.
fused_multiply_add_pass.h
# UE Change End: Implement a fused-multiply-add pass to reduce the
# possibility of re-association.
graphics_robust_access_pass.h
if_conversion.h
inline_exhaustive_pass.h
Expand Down Expand Up @@ -104,8 +113,12 @@ set(SPIRV_TOOLS_OPT_SOURCES
pass_manager.h
private_to_local_pass.h
propagator.h
# UE Change Begin: Added support for reducing const arrays to structs
reduce_const_array_to_struct_pass.h
# UE Change End: Added support for reducing const arrays to structs
# UE Change Begin: Convert-Composite-To-Op-Access-Chain-Pass
convert_composite_to_op_access_chain.h
# UE Change End: Convert-Composite-To-Op-Access-Chain-Pass
reduce_load_size.h
redundancy_elimination.h
reflect.h
Expand Down Expand Up @@ -140,10 +153,15 @@ set(SPIRV_TOOLS_OPT_SOURCES
wrap_opkill.h

fix_func_call_arguments.cpp
# UE Change Begin: Interface variable scalar replacement pass rewrite
adv_interface_var_sroa.cpp
# UE Change End: Interface variable scalar replacement pass rewrite
aggressive_dead_code_elim_pass.cpp
amd_ext_to_khr.cpp
analyze_live_input_pass.cpp
# UE Change Begin: Added support for Android driver patch pass to fix platform specific issues
android_driver_patch_pass.cpp
# UE Change End: Added support for Android driver patch pass to fix platform specific issues
basic_block.cpp
block_merge_pass.cpp
block_merge_util.cpp
Expand Down Expand Up @@ -186,7 +204,11 @@ set(SPIRV_TOOLS_OPT_SOURCES
fold_spec_constant_op_and_composite_pass.cpp
freeze_spec_constant_value_pass.cpp
function.cpp
# UE Change Begin: Implement a fused-multiply-add pass to reduce the
# possibility of re-association.
fused_multiply_add_pass.cpp
# UE Change End: Implement a fused-multiply-add pass to reduce the
# possibility of re-association.
graphics_robust_access_pass.cpp
if_conversion.cpp
inline_exhaustive_pass.cpp
Expand Down Expand Up @@ -228,8 +250,12 @@ set(SPIRV_TOOLS_OPT_SOURCES
pass_manager.cpp
private_to_local_pass.cpp
propagator.cpp
# UE Change Begin: Added support for reducing const arrays to structs
reduce_const_array_to_struct_pass.cpp
# UE Change End: Added support for reducing const arrays to structs
# UE Change Begin: Convert-Composite-To-Op-Access-Chain-Pass
convert_composite_to_op_access_chain.cpp
# UE Change End: Convert-Composite-To-Op-Access-Chain-Pass
reduce_load_size.cpp
redundancy_elimination.cpp
register_pressure.cpp
Expand Down
Loading

0 comments on commit 4f74fd0

Please sign in to comment.