2016-06-28 18:58:17 +00:00
|
|
|
// Copyright (c) 2016 Google Inc.
|
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
2016-06-28 18:58:17 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2016-06-28 18:58:17 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2016-06-28 18:58:17 +00:00
|
|
|
|
2018-08-03 12:05:33 +00:00
|
|
|
#ifndef SOURCE_OPT_PASSES_H_
|
|
|
|
#define SOURCE_OPT_PASSES_H_
|
2016-06-28 18:58:17 +00:00
|
|
|
|
2016-08-29 19:46:09 +00:00
|
|
|
// A single header to include all passes.
|
2016-06-28 18:58:17 +00:00
|
|
|
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/aggressive_dead_code_elim_pass.h"
|
2019-08-29 16:48:17 +00:00
|
|
|
#include "source/opt/amd_ext_to_khr.h"
|
2022-11-02 17:23:25 +00:00
|
|
|
#include "source/opt/analyze_live_input_pass.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/block_merge_pass.h"
|
|
|
|
#include "source/opt/ccp_pass.h"
|
|
|
|
#include "source/opt/cfg_cleanup_pass.h"
|
2019-01-17 20:56:36 +00:00
|
|
|
#include "source/opt/code_sink.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/combine_access_chains.h"
|
|
|
|
#include "source/opt/compact_ids_pass.h"
|
2019-09-03 17:22:13 +00:00
|
|
|
#include "source/opt/convert_to_half_pass.h"
|
2021-08-18 12:30:48 +00:00
|
|
|
#include "source/opt/convert_to_sampled_image_pass.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/copy_prop_arrays.h"
|
|
|
|
#include "source/opt/dead_branch_elim_pass.h"
|
|
|
|
#include "source/opt/dead_insert_elim_pass.h"
|
|
|
|
#include "source/opt/dead_variable_elimination.h"
|
2019-08-08 14:53:19 +00:00
|
|
|
#include "source/opt/desc_sroa.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/eliminate_dead_constant_pass.h"
|
|
|
|
#include "source/opt/eliminate_dead_functions_pass.h"
|
2022-11-25 23:48:13 +00:00
|
|
|
#include "source/opt/eliminate_dead_io_components_pass.h"
|
2019-02-14 18:42:35 +00:00
|
|
|
#include "source/opt/eliminate_dead_members_pass.h"
|
2022-11-02 17:23:25 +00:00
|
|
|
#include "source/opt/eliminate_dead_output_stores_pass.h"
|
2020-10-30 22:03:56 +00:00
|
|
|
#include "source/opt/empty_pass.h"
|
2022-05-06 14:39:26 +00:00
|
|
|
#include "source/opt/fix_func_call_arguments.h"
|
2019-04-05 17:12:08 +00:00
|
|
|
#include "source/opt/fix_storage_class.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/flatten_decoration_pass.h"
|
|
|
|
#include "source/opt/fold_spec_constant_op_and_composite_pass.h"
|
|
|
|
#include "source/opt/freeze_spec_constant_value_pass.h"
|
2019-07-30 23:52:46 +00:00
|
|
|
#include "source/opt/graphics_robust_access_pass.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/if_conversion.h"
|
|
|
|
#include "source/opt/inline_exhaustive_pass.h"
|
|
|
|
#include "source/opt/inline_opaque_pass.h"
|
2020-03-12 13:19:52 +00:00
|
|
|
#include "source/opt/inst_debug_printf_pass.h"
|
2022-05-09 18:04:52 +00:00
|
|
|
#include "source/opt/interface_var_sroa.h"
|
2021-03-31 18:26:36 +00:00
|
|
|
#include "source/opt/interp_fixup_pass.h"
|
Add a new legalization pass to dedupe invocation interlock instructions (#5409)
Add a new legalization pass to dedupe invocation interlock instructions
DXC will be adding support for HLSL's rasterizer ordered views by using
the SPV_EXT_fragment_shader_interlock_extension. That extension
stipulates that if an entry point has an interlock ordering execution
mode, it must dynamically execute OpBeginInvocationInterlockEXT and
OpEndInvocationInterlockEXT, in that order, exactly once. This would be
difficult to determine in DXC's SPIR-V backend, so instead we will emit
these instructions potentially multiple times, and use this legalization
pass to ensure that the final SPIR-V follows the specification.
This PR uses data-flow analysis to determine where to place begin and
end instructions; in essence, determining whether a block contains or is
preceded by a begin instruction is similar to a specialized case of a
reaching definitions analysis, where we have only a single definition,
such as `bool has_begun = false`. For this simpler case, we can compute
the set of blocks using BFS to determine the reachability of the begin
instruction.
We need to do this for both begin and end instructions, so I have
generalized portions of the code to run both forward and backward over
the CFG for each respective case.
2023-09-27 23:54:10 +00:00
|
|
|
#include "source/opt/invocation_interlock_placement_pass.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/licm_pass.h"
|
|
|
|
#include "source/opt/local_access_chain_convert_pass.h"
|
|
|
|
#include "source/opt/local_redundancy_elimination.h"
|
|
|
|
#include "source/opt/local_single_block_elim_pass.h"
|
|
|
|
#include "source/opt/local_single_store_elim_pass.h"
|
|
|
|
#include "source/opt/loop_fission.h"
|
|
|
|
#include "source/opt/loop_fusion_pass.h"
|
|
|
|
#include "source/opt/loop_peeling.h"
|
|
|
|
#include "source/opt/loop_unroller.h"
|
|
|
|
#include "source/opt/loop_unswitch_pass.h"
|
|
|
|
#include "source/opt/merge_return_pass.h"
|
2024-01-25 14:39:49 +00:00
|
|
|
#include "source/opt/modify_maximal_reconvergence.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/null_pass.h"
|
2024-06-13 09:09:58 +00:00
|
|
|
#include "source/opt/opextinst_forward_ref_fixup_pass.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/private_to_local_pass.h"
|
|
|
|
#include "source/opt/reduce_load_size.h"
|
|
|
|
#include "source/opt/redundancy_elimination.h"
|
2019-09-03 17:22:13 +00:00
|
|
|
#include "source/opt/relax_float_ops_pass.h"
|
2022-03-07 17:45:17 +00:00
|
|
|
#include "source/opt/remove_dontinline_pass.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/remove_duplicates_pass.h"
|
2021-06-29 15:33:58 +00:00
|
|
|
#include "source/opt/remove_unused_interface_variables_pass.h"
|
2021-10-26 21:20:58 +00:00
|
|
|
#include "source/opt/replace_desc_array_access_using_var_index.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/replace_invalid_opc.h"
|
|
|
|
#include "source/opt/scalar_replacement_pass.h"
|
|
|
|
#include "source/opt/set_spec_constant_default_value_pass.h"
|
2018-09-10 15:49:41 +00:00
|
|
|
#include "source/opt/simplification_pass.h"
|
spirv-opt: add pass to Spread Volatile semantics (#4667)
Add a pass to spread Volatile semantics to variables with SMIDNV,
WarpIDNV, SubgroupSize, SubgroupLocalInvocationId, SubgroupEqMask,
SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or SubgroupLtMask BuiltIn
decorations or OpLoad for them when the shader model is the ray
generation, closest hit, miss, intersection, or callable shaders. This
pass can be used for VUID-StandaloneSpirv-VulkanMemoryModel-04678 and
VUID-StandaloneSpirv-VulkanMemoryModel-04679 (See "Standalone SPIR-V
Validation" section of Vulkan spec "Appendix A: Vulkan Environment for
SPIR-V").
Handle variables used by multiple entry points:
1. Update error check to make it working regardless of the order of
entry points.
2. For a variable, if it is used by two entry points E1 and E2 and
it needs the Volatile semantics for E1 while it does not for E2
- If VulkanMemoryModel capability is enabled, which means we have to
set memory operation of load instructions for the variable, we
update load instructions in E1, but do not update the ones in E2.
- If VulkanMemoryModel capability is disabled, which means we have
to add Volatile decoration for the variable, we report an error
because E1 needs to add Volatile decoration for the variable while
E2 does not.
For the simplicity of the implementation, we assume that all functions
other than entry point functions are inlined.
2022-01-25 18:14:36 +00:00
|
|
|
#include "source/opt/spread_volatile_semantics.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/ssa_rewrite_pass.h"
|
|
|
|
#include "source/opt/strength_reduction_pass.h"
|
|
|
|
#include "source/opt/strip_debug_info_pass.h"
|
2021-12-15 14:55:30 +00:00
|
|
|
#include "source/opt/strip_nonsemantic_info_pass.h"
|
2024-09-05 19:24:29 +00:00
|
|
|
#include "source/opt/struct_packing_pass.h"
|
2023-08-22 00:16:35 +00:00
|
|
|
#include "source/opt/switch_descriptorset_pass.h"
|
2023-07-25 14:52:41 +00:00
|
|
|
#include "source/opt/trim_capabilities_pass.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/unify_const_pass.h"
|
2018-11-30 19:15:51 +00:00
|
|
|
#include "source/opt/upgrade_memory_model.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/opt/vector_dce.h"
|
|
|
|
#include "source/opt/workaround1209.h"
|
2019-08-14 13:27:12 +00:00
|
|
|
#include "source/opt/wrap_opkill.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
|
2018-08-03 12:05:33 +00:00
|
|
|
#endif // SOURCE_OPT_PASSES_H_
|