2017-10-05 23:07:31 +00:00
|
|
|
LOCAL_PATH := $(call my-dir)
|
|
|
|
SPVTOOLS_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT)))
|
2018-11-28 14:13:38 +00:00
|
|
|
|
|
|
|
ifeq ($(SPVHEADERS_LOCAL_PATH),)
|
|
|
|
SPVHEADERS_LOCAL_PATH := $(LOCAL_PATH)/external/spirv-headers
|
|
|
|
endif
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
SPVTOOLS_SRC_FILES := \
|
|
|
|
source/assembly_grammar.cpp \
|
|
|
|
source/binary.cpp \
|
|
|
|
source/diagnostic.cpp \
|
|
|
|
source/disassemble.cpp \
|
|
|
|
source/ext_inst.cpp \
|
|
|
|
source/enum_string_mapping.cpp \
|
|
|
|
source/extensions.cpp \
|
|
|
|
source/libspirv.cpp \
|
|
|
|
source/name_mapper.cpp \
|
|
|
|
source/opcode.cpp \
|
|
|
|
source/operand.cpp \
|
|
|
|
source/parsed_operand.cpp \
|
|
|
|
source/print.cpp \
|
|
|
|
source/software_version.cpp \
|
|
|
|
source/spirv_endian.cpp \
|
2018-09-10 15:49:41 +00:00
|
|
|
source/spirv_optimizer_options.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/spirv_target_env.cpp \
|
|
|
|
source/spirv_validator_options.cpp \
|
|
|
|
source/table.cpp \
|
|
|
|
source/text.cpp \
|
|
|
|
source/text_handler.cpp \
|
2024-09-12 21:30:18 +00:00
|
|
|
source/to_string.cpp \
|
2018-04-23 15:13:07 +00:00
|
|
|
source/util/bit_vector.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/util/parse_number.cpp \
|
|
|
|
source/util/string_utils.cpp \
|
2018-03-07 14:25:51 +00:00
|
|
|
source/util/timer.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/val/basic_block.cpp \
|
|
|
|
source/val/construct.cpp \
|
|
|
|
source/val/function.cpp \
|
|
|
|
source/val/instruction.cpp \
|
|
|
|
source/val/validation_state.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate.cpp \
|
|
|
|
source/val/validate_adjacency.cpp \
|
2018-08-08 18:21:27 +00:00
|
|
|
source/val/validate_annotation.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_arithmetics.cpp \
|
|
|
|
source/val/validate_atomics.cpp \
|
|
|
|
source/val/validate_barriers.cpp \
|
|
|
|
source/val/validate_bitwise.cpp \
|
|
|
|
source/val/validate_builtins.cpp \
|
|
|
|
source/val/validate_capability.cpp \
|
|
|
|
source/val/validate_cfg.cpp \
|
|
|
|
source/val/validate_composites.cpp \
|
2018-08-17 15:20:55 +00:00
|
|
|
source/val/validate_constants.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_conversion.cpp \
|
2018-08-08 17:47:09 +00:00
|
|
|
source/val/validate_debug.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_decorations.cpp \
|
|
|
|
source/val/validate_derivatives.cpp \
|
2018-11-27 21:20:01 +00:00
|
|
|
source/val/validate_extensions.cpp \
|
2018-08-10 13:53:17 +00:00
|
|
|
source/val/validate_execution_limitations.cpp \
|
|
|
|
source/val/validate_function.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_id.cpp \
|
|
|
|
source/val/validate_image.cpp \
|
|
|
|
source/val/validate_interfaces.cpp \
|
|
|
|
source/val/validate_instruction.cpp \
|
2018-08-01 18:44:56 +00:00
|
|
|
source/val/validate_memory.cpp \
|
2018-12-06 19:38:15 +00:00
|
|
|
source/val/validate_memory_semantics.cpp \
|
2022-09-23 15:06:46 +00:00
|
|
|
source/val/validate_mesh_shading.cpp \
|
2019-06-03 14:55:07 +00:00
|
|
|
source/val/validate_misc.cpp \
|
2018-08-08 18:49:59 +00:00
|
|
|
source/val/validate_mode_setting.cpp \
|
2018-07-11 14:27:34 +00:00
|
|
|
source/val/validate_layout.cpp \
|
|
|
|
source/val/validate_literals.cpp \
|
|
|
|
source/val/validate_logicals.cpp \
|
|
|
|
source/val/validate_non_uniform.cpp \
|
|
|
|
source/val/validate_primitives.cpp \
|
2022-07-20 14:12:58 +00:00
|
|
|
source/val/validate_ray_query.cpp \
|
2022-08-08 18:45:04 +00:00
|
|
|
source/val/validate_ray_tracing.cpp \
|
2022-11-24 14:50:45 +00:00
|
|
|
source/val/validate_ray_tracing_reorder.cpp \
|
2018-11-29 18:48:42 +00:00
|
|
|
source/val/validate_scopes.cpp \
|
2019-07-11 17:05:14 +00:00
|
|
|
source/val/validate_small_type_uses.cpp \
|
2024-10-24 17:55:04 +00:00
|
|
|
source/val/validate_tensor_layout.cpp \
|
2018-08-03 15:38:51 +00:00
|
|
|
source/val/validate_type.cpp
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
SPVTOOLS_OPT_SRC_FILES := \
|
|
|
|
source/opt/aggressive_dead_code_elim_pass.cpp \
|
2019-08-29 16:48:17 +00:00
|
|
|
source/opt/amd_ext_to_khr.cpp \
|
2022-11-02 17:23:25 +00:00
|
|
|
source/opt/analyze_live_input_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/basic_block.cpp \
|
|
|
|
source/opt/block_merge_pass.cpp \
|
2019-01-25 10:57:13 +00:00
|
|
|
source/opt/block_merge_util.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/build_module.cpp \
|
2017-10-30 21:42:26 +00:00
|
|
|
source/opt/cfg.cpp \
|
2017-09-06 12:56:41 +00:00
|
|
|
source/opt/cfg_cleanup_pass.cpp \
|
2017-12-05 16:39:25 +00:00
|
|
|
source/opt/ccp_pass.cpp \
|
2019-01-17 20:56:36 +00:00
|
|
|
source/opt/code_sink.cpp \
|
2018-07-23 15:23:11 +00:00
|
|
|
source/opt/combine_access_chains.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/compact_ids_pass.cpp \
|
2018-01-27 00:05:33 +00:00
|
|
|
source/opt/composite.cpp \
|
2018-02-08 15:59:03 +00:00
|
|
|
source/opt/const_folding_rules.cpp \
|
2017-12-07 21:42:27 +00:00
|
|
|
source/opt/constants.cpp \
|
2021-07-28 16:44:32 +00:00
|
|
|
source/opt/control_dependence.cpp \
|
2021-08-18 12:30:48 +00:00
|
|
|
source/opt/convert_to_sampled_image_pass.cpp \
|
2019-09-03 17:22:13 +00:00
|
|
|
source/opt/convert_to_half_pass.cpp \
|
2018-03-21 03:33:24 +00:00
|
|
|
source/opt/copy_prop_arrays.cpp \
|
2021-08-09 20:43:36 +00:00
|
|
|
source/opt/dataflow.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/dead_branch_elim_pass.cpp \
|
2018-01-27 00:05:33 +00:00
|
|
|
source/opt/dead_insert_elim_pass.cpp \
|
2017-10-20 16:17:41 +00:00
|
|
|
source/opt/dead_variable_elimination.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/decoration_manager.cpp \
|
2020-04-27 19:18:55 +00:00
|
|
|
source/opt/debug_info_manager.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/def_use_manager.cpp \
|
2019-08-08 14:53:19 +00:00
|
|
|
source/opt/desc_sroa.cpp \
|
2021-10-26 21:20:58 +00:00
|
|
|
source/opt/desc_sroa_util.cpp \
|
2018-01-16 16:15:06 +00:00
|
|
|
source/opt/dominator_analysis.cpp \
|
2017-11-27 21:21:26 +00:00
|
|
|
source/opt/dominator_tree.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/eliminate_dead_constant_pass.cpp \
|
|
|
|
source/opt/eliminate_dead_functions_pass.cpp \
|
2019-02-08 16:20:29 +00:00
|
|
|
source/opt/eliminate_dead_functions_util.cpp \
|
2022-11-25 23:48:13 +00:00
|
|
|
source/opt/eliminate_dead_io_components_pass.cpp \
|
2019-02-14 18:42:35 +00:00
|
|
|
source/opt/eliminate_dead_members_pass.cpp \
|
2022-11-02 17:23:25 +00:00
|
|
|
source/opt/eliminate_dead_output_stores_pass.cpp \
|
2017-11-30 22:03:06 +00:00
|
|
|
source/opt/feature_manager.cpp \
|
2022-05-06 14:39:26 +00:00
|
|
|
source/opt/fix_func_call_arguments.cpp \
|
2019-04-05 17:12:08 +00:00
|
|
|
source/opt/fix_storage_class.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/flatten_decoration_pass.cpp \
|
2017-10-18 14:28:12 +00:00
|
|
|
source/opt/fold.cpp \
|
2018-01-24 18:26:33 +00:00
|
|
|
source/opt/folding_rules.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/fold_spec_constant_op_and_composite_pass.cpp \
|
|
|
|
source/opt/freeze_spec_constant_value_pass.cpp \
|
|
|
|
source/opt/function.cpp \
|
2019-07-30 23:52:46 +00:00
|
|
|
source/opt/graphics_robust_access_pass.cpp \
|
2018-01-16 16:15:06 +00:00
|
|
|
source/opt/if_conversion.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/inline_pass.cpp \
|
|
|
|
source/opt/inline_exhaustive_pass.cpp \
|
|
|
|
source/opt/inline_opaque_pass.cpp \
|
|
|
|
source/opt/instruction.cpp \
|
2017-10-20 18:38:50 +00:00
|
|
|
source/opt/instruction_list.cpp \
|
2022-05-09 18:04:52 +00:00
|
|
|
source/opt/interface_var_sroa.cpp \
|
2021-03-31 18:26:36 +00:00
|
|
|
source/opt/interp_fixup_pass.cpp \
|
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
|
|
|
source/opt/invocation_interlock_placement_pass.cpp \
|
2017-11-02 18:25:48 +00:00
|
|
|
source/opt/ir_context.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/ir_loader.cpp \
|
2018-01-29 10:39:55 +00:00
|
|
|
source/opt/licm_pass.cpp \
|
2022-11-02 17:23:25 +00:00
|
|
|
source/opt/liveness.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/local_access_chain_convert_pass.cpp \
|
2017-11-11 01:26:55 +00:00
|
|
|
source/opt/local_redundancy_elimination.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/local_single_block_elim_pass.cpp \
|
|
|
|
source/opt/local_single_store_elim_pass.cpp \
|
2018-03-29 12:39:54 +00:00
|
|
|
source/opt/loop_dependence.cpp \
|
|
|
|
source/opt/loop_dependence_helpers.cpp \
|
2017-12-21 14:47:25 +00:00
|
|
|
source/opt/loop_descriptor.cpp \
|
2018-04-23 20:01:12 +00:00
|
|
|
source/opt/loop_fission.cpp \
|
2018-04-20 14:14:45 +00:00
|
|
|
source/opt/loop_fusion.cpp \
|
|
|
|
source/opt/loop_fusion_pass.cpp \
|
2018-03-07 18:21:11 +00:00
|
|
|
source/opt/loop_peeling.cpp \
|
2018-02-14 17:03:12 +00:00
|
|
|
source/opt/loop_unroller.cpp \
|
2018-02-12 21:42:15 +00:00
|
|
|
source/opt/loop_unswitch_pass.cpp \
|
|
|
|
source/opt/loop_utils.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/mem_pass.cpp \
|
2017-11-11 01:26:55 +00:00
|
|
|
source/opt/merge_return_pass.cpp \
|
2024-01-25 14:39:49 +00:00
|
|
|
source/opt/modify_maximal_reconvergence.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/module.cpp \
|
2024-06-13 09:09:58 +00:00
|
|
|
source/opt/opextinst_forward_ref_fixup_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/optimizer.cpp \
|
|
|
|
source/opt/pass.cpp \
|
|
|
|
source/opt/pass_manager.cpp \
|
2017-12-11 18:10:24 +00:00
|
|
|
source/opt/private_to_local_pass.cpp \
|
2017-11-17 13:59:25 +00:00
|
|
|
source/opt/propagator.cpp \
|
2018-05-07 16:31:03 +00:00
|
|
|
source/opt/reduce_load_size.cpp \
|
2017-12-04 17:29:51 +00:00
|
|
|
source/opt/redundancy_elimination.cpp \
|
2018-04-17 14:31:09 +00:00
|
|
|
source/opt/register_pressure.cpp \
|
2019-09-03 17:22:13 +00:00
|
|
|
source/opt/relax_float_ops_pass.cpp \
|
2022-03-07 17:45:17 +00:00
|
|
|
source/opt/remove_dontinline_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/remove_duplicates_pass.cpp \
|
2021-06-29 15:33:58 +00:00
|
|
|
source/opt/remove_unused_interface_variables_pass.cpp \
|
2021-10-26 21:20:58 +00:00
|
|
|
source/opt/replace_desc_array_access_using_var_index.cpp \
|
2018-01-30 16:24:03 +00:00
|
|
|
source/opt/replace_invalid_opc.cpp \
|
2018-03-28 13:19:55 +00:00
|
|
|
source/opt/scalar_analysis.cpp \
|
|
|
|
source/opt/scalar_analysis_simplification.cpp \
|
2017-11-30 22:03:06 +00:00
|
|
|
source/opt/scalar_replacement_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/set_spec_constant_default_value_pass.cpp \
|
2018-02-02 16:55:05 +00:00
|
|
|
source/opt/simplification_pass.cpp \
|
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
|
|
|
source/opt/spread_volatile_semantics.cpp \
|
SSA rewrite pass.
This pass replaces the load/store elimination passes. It implements the
SSA re-writing algorithm proposed in
Simple and Efficient Construction of Static Single Assignment Form.
Braun M., Buchwald S., Hack S., Leißa R., Mallon C., Zwinkau A. (2013)
In: Jhala R., De Bosschere K. (eds)
Compiler Construction. CC 2013.
Lecture Notes in Computer Science, vol 7791.
Springer, Berlin, Heidelberg
https://link.springer.com/chapter/10.1007/978-3-642-37051-9_6
In contrast to common eager algorithms based on dominance and dominance
frontier information, this algorithm works backwards from load operations.
When a target variable is loaded, it queries the variable's reaching
definition. If the reaching definition is unknown at the current location,
it searches backwards in the CFG, inserting Phi instructions at join points
in the CFG along the way until it finds the desired store instruction.
The algorithm avoids repeated lookups using memoization.
For reducible CFGs, which are a superset of the structured CFGs in SPIRV,
this algorithm is proven to produce minimal SSA. That is, it inserts the
minimal number of Phi instructions required to ensure the SSA property, but
some Phi instructions may be dead
(https://en.wikipedia.org/wiki/Static_single_assignment_form).
2018-02-22 21:18:29 +00:00
|
|
|
source/opt/ssa_rewrite_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/strength_reduction_pass.cpp \
|
|
|
|
source/opt/strip_debug_info_pass.cpp \
|
2021-12-15 14:55:30 +00:00
|
|
|
source/opt/strip_nonsemantic_info_pass.cpp \
|
2018-09-17 17:00:24 +00:00
|
|
|
source/opt/struct_cfg_analysis.cpp \
|
2024-09-05 19:24:29 +00:00
|
|
|
source/opt/struct_packing_pass.cpp \
|
2023-08-22 00:16:35 +00:00
|
|
|
source/opt/switch_descriptorset_pass.cpp \
|
2023-07-27 15:21:23 +00:00
|
|
|
source/opt/trim_capabilities_pass.cpp \
|
2017-10-05 23:07:31 +00:00
|
|
|
source/opt/type_manager.cpp \
|
|
|
|
source/opt/types.cpp \
|
2017-11-08 21:22:10 +00:00
|
|
|
source/opt/unify_const_pass.cpp \
|
2018-11-30 19:15:51 +00:00
|
|
|
source/opt/upgrade_memory_model.cpp \
|
2018-01-17 19:57:37 +00:00
|
|
|
source/opt/value_number_table.cpp \
|
2018-04-23 15:13:07 +00:00
|
|
|
source/opt/vector_dce.cpp \
|
2019-08-14 13:27:12 +00:00
|
|
|
source/opt/workaround1209.cpp \
|
|
|
|
source/opt/wrap_opkill.cpp
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
# Locations of grammar files.
|
2018-02-09 19:29:02 +00:00
|
|
|
#
|
2018-03-02 20:24:15 +00:00
|
|
|
SPV_COREUNIFIED1_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/spirv.core.grammar.json
|
2020-07-30 16:08:53 +00:00
|
|
|
SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.glsl.std.450.grammar.json
|
|
|
|
SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.opencl.std.100.grammar.json
|
|
|
|
SPV_DEBUGINFO_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.debuginfo.grammar.json
|
|
|
|
SPV_CLDEBUGINFO100_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json
|
2021-09-15 18:38:53 +00:00
|
|
|
SPV_VKDEBUGINFO100_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
define gen_spvtools_grammar_tables
|
2019-12-19 22:16:26 +00:00
|
|
|
$(call generate-file-dir,$(1)/core.insts-unified1.inc)
|
|
|
|
$(1)/core.insts-unified1.inc $(1)/operand.kinds-unified1.inc \
|
|
|
|
$(1)/glsl.std.450.insts.inc \
|
|
|
|
$(1)/opencl.std.insts.inc \
|
|
|
|
: \
|
2017-10-05 23:07:31 +00:00
|
|
|
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-19 22:16:26 +00:00
|
|
|
$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-10-05 23:07:31 +00:00
|
|
|
$(SPV_GLSL_GRAMMAR) \
|
2019-12-19 22:16:26 +00:00
|
|
|
$(SPV_OpenCL_GRAMMAR) \
|
|
|
|
$(SPV_DEBUGINFO_GRAMMAR) \
|
|
|
|
$(SPV_CLDEBUGINFO100_GRAMMAR)
|
2017-10-05 23:07:31 +00:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-19 22:16:26 +00:00
|
|
|
--spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-10-05 23:07:31 +00:00
|
|
|
--extinst-glsl-grammar=$(SPV_GLSL_GRAMMAR) \
|
|
|
|
--extinst-opencl-grammar=$(SPV_OPENCL_GRAMMAR) \
|
2017-12-03 17:30:08 +00:00
|
|
|
--extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \
|
2019-12-19 22:16:26 +00:00
|
|
|
--extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR) \
|
|
|
|
--core-insts-output=$(1)/core.insts-unified1.inc \
|
2017-12-13 22:55:00 +00:00
|
|
|
--glsl-insts-output=$(1)/glsl.std.450.insts.inc \
|
|
|
|
--opencl-insts-output=$(1)/opencl.std.insts.inc \
|
2022-11-04 21:27:10 +00:00
|
|
|
--operand-kinds-output=$(1)/operand.kinds-unified1.inc \
|
|
|
|
--output-language=c++
|
2019-12-19 22:16:26 +00:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Grammar (from unified1) : instructions & operands <= grammar JSON files"
|
|
|
|
$(LOCAL_PATH)/source/opcode.cpp: $(1)/core.insts-unified1.inc
|
|
|
|
$(LOCAL_PATH)/source/operand.cpp: $(1)/operand.kinds-unified1.inc
|
2018-02-09 19:29:02 +00:00
|
|
|
$(LOCAL_PATH)/source/ext_inst.cpp: \
|
|
|
|
$(1)/glsl.std.450.insts.inc \
|
|
|
|
$(1)/opencl.std.insts.inc \
|
|
|
|
$(1)/debuginfo.insts.inc \
|
2019-12-19 22:16:26 +00:00
|
|
|
$(1)/opencl.debuginfo.100.insts.inc \
|
2021-09-15 18:38:53 +00:00
|
|
|
$(1)/nonsemantic.shader.debuginfo.100.insts.inc \
|
2018-02-09 19:29:02 +00:00
|
|
|
$(1)/spv-amd-gcn-shader.insts.inc \
|
|
|
|
$(1)/spv-amd-shader-ballot.insts.inc \
|
|
|
|
$(1)/spv-amd-shader-explicit-vertex-parameter.insts.inc \
|
|
|
|
$(1)/spv-amd-shader-trinary-minmax.insts.inc
|
2019-09-18 21:42:48 +00:00
|
|
|
$(LOCAL_PATH)/source/opt/amd_ext_to_khr.cpp: \
|
|
|
|
$(1)/spv-amd-shader-ballot.insts.inc
|
2017-10-05 23:07:31 +00:00
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_grammar_tables,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
2017-12-03 17:30:08 +00:00
|
|
|
|
|
|
|
define gen_spvtools_lang_headers
|
|
|
|
# Generate language-specific headers. So far we only generate C headers
|
|
|
|
# $1 is the output directory.
|
|
|
|
# $2 is the base name of the header file, e.g. "DebugInfo".
|
|
|
|
# $3 is the grammar file containing token definitions.
|
|
|
|
$(call generate-file-dir,$(1)/$(2).h)
|
|
|
|
$(1)/$(2).h : \
|
|
|
|
$(LOCAL_PATH)/utils/generate_language_headers.py \
|
|
|
|
$(3)
|
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_language_headers.py \
|
|
|
|
--extinst-grammar=$(3) \
|
2020-02-25 05:46:52 +00:00
|
|
|
--extinst-output-path=$(1)/$(2).h
|
2017-12-03 17:30:08 +00:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate language specific header for $(2): headers <= grammar"
|
2020-01-23 22:04:30 +00:00
|
|
|
$(foreach F,$(SPVTOOLS_SRC_FILES) $(SPVTOOLS_OPT_SRC_FILES),$(LOCAL_PATH)/$F ) \
|
|
|
|
: $(1)/$(2).h
|
2017-12-03 17:30:08 +00:00
|
|
|
endef
|
2019-12-19 22:16:26 +00:00
|
|
|
# We generate language-specific headers for DebugInfo and OpenCL.DebugInfo.100
|
2017-12-03 17:30:08 +00:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),DebugInfo,$(SPV_DEBUGINFO_GRAMMAR)))
|
2019-12-19 22:16:26 +00:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),OpenCLDebugInfo100,$(SPV_CLDEBUGINFO100_GRAMMAR)))
|
2021-09-15 18:38:53 +00:00
|
|
|
$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),NonSemanticShaderDebugInfo100,$(SPV_VKDEBUGINFO100_GRAMMAR)))
|
2017-12-03 17:30:08 +00:00
|
|
|
|
|
|
|
|
2017-10-05 23:07:31 +00:00
|
|
|
define gen_spvtools_vendor_tables
|
|
|
|
$(call generate-file-dir,$(1)/$(2).insts.inc)
|
|
|
|
$(1)/$(2).insts.inc : \
|
|
|
|
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2020-07-30 16:08:53 +00:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.$(2).grammar.json
|
2017-10-05 23:07:31 +00:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2020-07-30 16:08:53 +00:00
|
|
|
--extinst-vendor-grammar=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/extinst.$(2).grammar.json \
|
2019-12-19 22:16:26 +00:00
|
|
|
--vendor-insts-output=$(1)/$(2).insts.inc \
|
|
|
|
--vendor-operand-kind-prefix=$(3)
|
2017-10-05 23:07:31 +00:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Vendor extended instruction set: $(2) tables <= grammar"
|
|
|
|
$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/$(2).insts.inc
|
|
|
|
endef
|
2019-12-19 22:16:26 +00:00
|
|
|
# Vendor and debug extended instruction sets, with grammars from SPIRV-Tools source tree.
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),debuginfo,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),opencl.debuginfo.100,"CLDEBUG100_"))
|
2021-09-15 18:38:53 +00:00
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.shader.debuginfo.100,"SHDEBUG100_"))
|
2019-12-19 22:16:26 +00:00
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-gcn-shader,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-ballot,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-explicit-vertex-parameter,""))
|
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-trinary-minmax,""))
|
2020-07-30 16:08:53 +00:00
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.clspvreflection,""))
|
2024-03-15 17:46:42 +00:00
|
|
|
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.vkspreflection,""))
|
2017-10-05 23:07:31 +00:00
|
|
|
|
|
|
|
define gen_spvtools_enum_string_mapping
|
|
|
|
$(call generate-file-dir,$(1)/extension_enum.inc.inc)
|
|
|
|
$(1)/extension_enum.inc $(1)/enum_string_mapping.inc: \
|
|
|
|
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-19 22:16:26 +00:00
|
|
|
$(SPV_COREUNIFIED1_GRAMMAR)
|
2017-10-05 23:07:31 +00:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
|
2019-12-19 22:16:26 +00:00
|
|
|
--spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \
|
2017-12-03 17:30:08 +00:00
|
|
|
--extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \
|
2019-12-19 22:16:26 +00:00
|
|
|
--extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR) \
|
2017-10-05 23:07:31 +00:00
|
|
|
--extension-enum-output=$(1)/extension_enum.inc \
|
2022-11-04 21:27:10 +00:00
|
|
|
--enum-string-mapping-output=$(1)/enum_string_mapping.inc \
|
|
|
|
--output-language=c++
|
2017-10-05 23:07:31 +00:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate enum<->string mapping <= grammar JSON files"
|
|
|
|
# Generated header extension_enum.inc is transitively included by table.h, which is
|
|
|
|
# used pervasively. Capture the pervasive dependency.
|
|
|
|
$(foreach F,$(SPVTOOLS_SRC_FILES) $(SPVTOOLS_OPT_SRC_FILES),$(LOCAL_PATH)/$F ) \
|
|
|
|
: $(1)/extension_enum.inc
|
|
|
|
$(LOCAL_PATH)/source/enum_string_mapping.cpp: $(1)/enum_string_mapping.inc
|
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_enum_string_mapping,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
|
|
|
define gen_spvtools_build_version_inc
|
|
|
|
$(call generate-file-dir,$(1)/dummy_filename)
|
|
|
|
$(1)/build-version.inc: \
|
|
|
|
$(LOCAL_PATH)/utils/update_build_version.py \
|
2023-03-09 17:24:20 +00:00
|
|
|
$(LOCAL_PATH)/CHANGES
|
2017-10-05 23:07:31 +00:00
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/update_build_version.py \
|
2023-03-09 17:24:20 +00:00
|
|
|
$(LOCAL_PATH)/CHANGES $(1)/build-version.inc
|
2017-10-05 23:07:31 +00:00
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate : build-version.inc <= CHANGES"
|
|
|
|
$(LOCAL_PATH)/source/software_version.cpp: $(1)/build-version.inc
|
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_build_version_inc,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
|
|
|
define gen_spvtools_generators_inc
|
|
|
|
$(call generate-file-dir,$(1)/dummy_filename)
|
|
|
|
$(1)/generators.inc: \
|
|
|
|
$(LOCAL_PATH)/utils/generate_registry_tables.py \
|
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include/spirv/spir-v.xml
|
|
|
|
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_registry_tables.py \
|
|
|
|
--xml=$(SPVHEADERS_LOCAL_PATH)/include/spirv/spir-v.xml \
|
|
|
|
--generator-output=$(1)/generators.inc
|
|
|
|
@echo "[$(TARGET_ARCH_ABI)] Generate : generators.inc <= spir-v.xml"
|
|
|
|
$(LOCAL_PATH)/source/opcode.cpp: $(1)/generators.inc
|
|
|
|
endef
|
|
|
|
$(eval $(call gen_spvtools_generators_inc,$(SPVTOOLS_OUT_PATH)))
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := SPIRV-Tools
|
|
|
|
LOCAL_C_INCLUDES := \
|
|
|
|
$(LOCAL_PATH)/include \
|
2018-11-28 14:13:38 +00:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include \
|
2017-10-05 23:07:31 +00:00
|
|
|
$(SPVTOOLS_OUT_PATH)
|
|
|
|
LOCAL_EXPORT_C_INCLUDES := \
|
|
|
|
$(LOCAL_PATH)/include
|
2023-06-28 12:37:55 +00:00
|
|
|
LOCAL_CXXFLAGS:=-std=c++17 -fno-exceptions -fno-rtti -Werror
|
2017-10-05 23:07:31 +00:00
|
|
|
LOCAL_SRC_FILES:= $(SPVTOOLS_SRC_FILES)
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := SPIRV-Tools-opt
|
|
|
|
LOCAL_C_INCLUDES := \
|
|
|
|
$(LOCAL_PATH)/include \
|
|
|
|
$(LOCAL_PATH)/source \
|
2018-11-28 14:13:38 +00:00
|
|
|
$(SPVHEADERS_LOCAL_PATH)/include \
|
2017-10-05 23:07:31 +00:00
|
|
|
$(SPVTOOLS_OUT_PATH)
|
2023-06-28 12:37:55 +00:00
|
|
|
LOCAL_CXXFLAGS:=-std=c++17 -fno-exceptions -fno-rtti -Werror
|
2017-10-05 23:07:31 +00:00
|
|
|
LOCAL_STATIC_LIBRARIES:=SPIRV-Tools
|
|
|
|
LOCAL_SRC_FILES:= $(SPVTOOLS_OPT_SRC_FILES)
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|