Files
third_party_mesa3d/src/compiler/nir/meson.build

371 lines
11 KiB
Meson
Raw Normal View History

# Copyright © 2017 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
nir_depends = files('nir_opcodes.py', 'nir_intrinsics.py')
nir_builder_opcodes_h = custom_target(
'nir_builder_opcodes.h',
input : 'nir_builder_opcodes_h.py',
output : 'nir_builder_opcodes.h',
command : [prog_python, '@INPUT@'],
capture : true,
depend_files : nir_depends,
)
nir_constant_expressions_c = custom_target(
'nir_constant_expressions.c',
input : 'nir_constant_expressions.py',
output : 'nir_constant_expressions.c',
command : [prog_python, '@INPUT@'],
capture : true,
depend_files : nir_depends,
)
nir_opcodes_h = custom_target(
'nir_opcodes.h',
input : 'nir_opcodes_h.py',
output : 'nir_opcodes.h',
command : [prog_python, '@INPUT@'],
capture : true,
depend_files : nir_depends,
)
nir_opcodes_c = custom_target(
'nir_opcodes.c',
input : 'nir_opcodes_c.py',
output : 'nir_opcodes.c',
command : [prog_python, '@INPUT@'],
capture : true,
depend_files : nir_depends,
)
nir_opt_algebraic_c = custom_target(
'nir_opt_algebraic.c',
input : 'nir_opt_algebraic.py',
output : 'nir_opt_algebraic.c',
command : [prog_python, '@INPUT@'],
capture : true,
depend_files : files('nir_algebraic.py'),
)
nir_intrinsics_h = custom_target(
'nir_intrinsics.h',
input : 'nir_intrinsics_h.py',
output : 'nir_intrinsics.h',
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
capture : false,
depend_files : files('nir_intrinsics.py'),
)
nir_intrinsics_c = custom_target(
'nir_intrinsic.c',
input : 'nir_intrinsics_c.py',
output : 'nir_intrinsics.c',
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
capture: false,
depend_files : files('nir_intrinsics.py'),
)
files_libnir = files(
'nir.c',
'nir.h',
'nir_builder.h',
'nir_builtin_builder.c',
'nir_builtin_builder.h',
'nir_clone.c',
'nir_constant_expressions.h',
'nir_control_flow.c',
'nir_control_flow.h',
'nir_control_flow_private.h',
'nir_deref.c',
'nir_deref.h',
'nir_divergence_analysis.c',
'nir_dominance.c',
'nir_format_convert.h',
'nir_from_ssa.c',
'nir_gather_info.c',
'nir_gather_ssa_types.c',
'nir_gather_xfb_info.c',
'nir_gs_count_vertices.c',
'nir_inline_functions.c',
'nir_instr_set.c',
'nir_instr_set.h',
'nir_linking_helpers.c',
'nir_liveness.c',
'nir_loop_analyze.c',
'nir_loop_analyze.h',
'nir_lower_alu.c',
'nir_lower_alu_to_scalar.c',
'nir_lower_alpha_test.c',
'nir_lower_amul.c',
'nir_lower_array_deref_of_vec.c',
'nir_lower_atomics_to_ssbo.c',
'nir_lower_bitmap.c',
'nir_lower_bool_to_bitsize.c',
'nir_lower_bool_to_float.c',
'nir_lower_bool_to_int32.c',
'nir_lower_clamp_color_outputs.c',
'nir_lower_clip.c',
'nir_lower_clip_cull_distance_arrays.c',
'nir_lower_clip_halfz.c',
'nir_lower_variable_initializers.c',
'nir_lower_discard_to_demote.c',
'nir_lower_double_ops.c',
'nir_lower_drawpixels.c',
'nir_lower_fb_read.c',
'nir_lower_flatshade.c',
'nir_lower_flrp.c',
'nir_lower_fragcoord_wtrans.c',
'nir_lower_frexp.c',
'nir_lower_global_vars_to_local.c',
'nir_lower_gs_intrinsics.c',
'nir_lower_load_const_to_scalar.c',
'nir_lower_locals_to_regs.c',
'nir_lower_idiv.c',
'nir_lower_indirect_derefs.c',
'nir_lower_input_attachments.c',
'nir_lower_int64.c',
'nir_lower_interpolation.c',
'nir_lower_int_to_float.c',
'nir_lower_io.c',
'nir_lower_io_arrays_to_elements.c',
'nir_lower_io_to_temporaries.c',
'nir_lower_io_to_scalar.c',
'nir_lower_io_to_vector.c',
'nir_lower_non_uniform_access.c',
'nir_lower_packing.c',
'nir_lower_passthrough_edgeflags.c',
'nir_lower_patch_vertices.c',
'nir_lower_phis_to_scalar.c',
'nir_lower_point_size.c',
'nir_lower_point_size_mov.c',
'nir_lower_regs_to_ssa.c',
'nir_lower_returns.c',
'nir_lower_samplers.c',
'nir_lower_scratch.c',
'nir_lower_ssbo.c',
'nir_lower_subgroups.c',
'nir_lower_system_values.c',
'nir_lower_tex.c',
'nir_lower_to_source_mods.c',
'nir_lower_two_sided_color.c',
'nir_lower_vars_to_ssa.c',
'nir_lower_var_copies.c',
'nir_lower_vec_to_movs.c',
'nir_lower_viewport_transform.c',
'nir_lower_wpos_center.c',
'nir_lower_wpos_ytransform.c',
'nir_lower_bit_size.c',
'nir_lower_uniforms_to_ubo.c',
'nir_metadata.c',
'nir_move_vec_src_uses_to_dest.c',
'nir_normalize_cubemap_coords.c',
'nir_opt_access.c',
'nir_opt_barriers.c',
'nir_opt_combine_stores.c',
'nir_opt_comparison_pre.c',
'nir_opt_conditional_discard.c',
'nir_opt_constant_folding.c',
'nir_opt_copy_prop_vars.c',
'nir_opt_copy_propagate.c',
'nir_opt_cse.c',
'nir_opt_dce.c',
'nir_opt_dead_cf.c',
'nir_opt_dead_write_vars.c',
'nir_opt_find_array_copies.c',
'nir_opt_gcm.c',
'nir_opt_idiv_const.c',
'nir_opt_if.c',
'nir_opt_intrinsics.c',
'nir_opt_large_constants.c',
nir: add a load/store vectorization pass This pass combines intersecting, adjacent and identical loads/stores into potentially larger ones and will be used by ACO to greatly reduce the number of memory operations. v2: handle nir_deref_type_ptr_as_array v3: assume explicitly laid out types for derefs v4: create less deref casts v4: fix shared boolean vectorization v4: fix copy+paste error in resources_different v4: fix extract_subvector() to pass nir_load_store_vectorize_test.ssbo_load_intersecting_32_32_64 v4: rebase v5: subtract from deref/offset instead of scheduling offset calculations v5: various non-functional changes/cleanups v5: require less metadata and preserve more v5: rebase v6: cleanup and improve dependency handling v6: emit less deref casts v6: pass undef to components not set in the write_mask for new stores v7: fix 8-bit extract_vector() with 64-bit input v7: cleanup creation of store write data v7: update align correctly for when the bit size of load/store increases v7: rename extract_vector to extract_component and update comment v8: prevent combining of row-major matrix column acceses v9: rework process_block() to be able to vectorize more v9: rework the callback function v9: update alignment on all loads/stores, even if they're not vectorized v9: remove entry::store_value, since it will not be updated if it's was from a vectorized load v9: fix bug in subtract_deref(), causing artifacts in Dishonored 2 v9: handle nir_intrinsic_scoped_memory_barrier v10: use nir_ssa_scalar v10: handle non-32-bit offsets v10: use signed offsets for comparison v10: improve create_entry_key_from_offset() v10: support load_shared/store_shared v10: remove strip_deref_casts() v10: don't ever pass NULL to memcmp v10: remove recursion in gcd() v10: fix outdated comment v11: use the new nir_extract_bits() v12: remove use of nir_src_as_const_value in resources_different v13: make entry key hash function deterministic v13: simplify mask_sign_extend() v14: add comment in hash_entry_key() about hashing pointers Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> (v9)
2019-03-19 20:55:30 +00:00
'nir_opt_load_store_vectorize.c',
'nir_opt_loop_unroll.c',
'nir_opt_move.c',
'nir_opt_peephole_select.c',
nir: Rematerialize compare instructions On some architectures, Boolean values used to control conditional branches or condtional selection must be propagated into a flag. This generally means that a stored Boolean value must be compared with zero. Rather than force the generation of extra compares with zero, re-emit the original comparison instruction. This can save register pressure by not needing to store the Boolean value. There are several possible ares for future improvement to this pass: 1. Be more conservative. If both sources to the comparison instruction are non-constants, it may be better for register pressure to emit the extra compare. The current shader-db results on Intel GPUs (next commit) lead me to believe that this is not currently a problem. 2. Be less conservative. Currently the pass requires that all users of the comparison match the pattern. The idea is that after the pass is complete, no instruction will use the resulting Boolean value. The only uses will be of the flag value. It may be beneficial to relax this requirement in some cases. 3. Be less conservative. Also try to rematerialize comparisons used for discard_if intrinsics. After changing the way the Intel compiler generates cod e for discard_if (see MR!935), I tried implementing this already. The changes were pretty small. Instructions were helped in 19 shaders, but, overall, cycles were hurt. A commit "nir: Rematerialize comparisons for nir_intrinsic_discard_if too" is on my fd.o cgit. 4. Copy the preceeding ALU instruction. If the comparison is a comparison with zero, and it is the only user of a particular ALU instruction (e.g., (a+b) != 0.0), it may be a further improvment to also copy the preceeding ALU instruction. On Intel GPUs, this may enable cmod propagation to make additional progress. v2: Use much simpler method to get the prev_block for an if-statement. Suggested by Tim. Reviewed-by: Matt Turner <mattst88@gmail.com>
2019-05-20 11:22:12 -07:00
'nir_opt_rematerialize_compares.c',
'nir_opt_remove_phis.c',
'nir_opt_shrink_load.c',
'nir_opt_sink.c',
'nir_opt_trivial_continues.c',
'nir_opt_undef.c',
'nir_opt_vectorize.c',
'nir_phi_builder.c',
'nir_phi_builder.h',
'nir_print.c',
'nir_propagate_invariant.c',
'nir_range_analysis.c',
'nir_range_analysis.h',
'nir_remove_dead_variables.c',
'nir_repair_ssa.c',
'nir_schedule.c',
'nir_search.c',
'nir_search.h',
'nir_search_helpers.h',
'nir_serialize.c',
'nir_serialize.h',
'nir_split_per_member_structs.c',
'nir_split_var_copies.c',
'nir_split_vars.c',
'nir_sweep.c',
'nir_to_lcssa.c',
'nir_validate.c',
'nir_vla.h',
'nir_worklist.c',
'nir_worklist.h',
'nir_xfb_info.h',
'../spirv/GLSL.ext.AMD.h',
'../spirv/GLSL.std.450.h',
'../spirv/gl_spirv.c',
'../spirv/nir_spirv.h',
'../spirv/OpenCL.std.h',
'../spirv/spirv.h',
'../spirv/spirv_info.h',
'../spirv/spirv_to_nir.c',
'../spirv/vtn_alu.c',
'../spirv/vtn_amd.c',
'../spirv/vtn_cfg.c',
'../spirv/vtn_glsl450.c',
'../spirv/vtn_opencl.c',
'../spirv/vtn_private.h',
'../spirv/vtn_subgroup.c',
'../spirv/vtn_variables.c',
)
_libnir = static_library(
'nir',
[files_libnir, spirv_info_c, nir_opt_algebraic_c, nir_opcodes_c,
nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h,
vtn_gather_types_c, nir_intrinsics_c, nir_intrinsics_h],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_compiler, include_directories('../spirv')],
c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
link_with : libcompiler,
build_by_default : false,
)
# Headers-only dependency
idep_nir_headers = declare_dependency(
sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h],
include_directories : include_directories('.'),
)
# Also link with nir
idep_nir = declare_dependency(
dependencies : idep_nir_headers,
link_with : _libnir,
)
nir_algebraic_py = files('nir_algebraic.py')
if with_tests
2019-11-08 19:24:05 -06:00
test(
'nir_builder',
executable(
'nir_builder_test',
files('tests/builder_tests.cpp'),
cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
2019-11-08 19:24:05 -06:00
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
)
test(
'nir_control_flow',
executable(
'nir_control_flow_test',
files('tests/control_flow_tests.cpp'),
cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
)
test(
'nir_vars',
executable(
'nir_vars_test',
files('tests/vars_tests.cpp'),
cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
)
test(
'nir_algebraic_parser',
prog_python,
args : [
join_paths(meson.current_source_dir(), 'tests/algebraic_parser_test.py')
],
suite : ['compiler', 'nir'],
)
test(
'negative_equal',
executable(
'negative_equal',
files('tests/negative_equal_tests.cpp'),
c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
)
test(
'comparison_pre',
executable(
'comparison_pre',
files('tests/comparison_pre_tests.cpp'),
c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
)
test(
'load_store_vectorizer',
executable(
'load_store_vectorizer',
files('tests/load_store_vectorizer_tests.cpp'),
cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
should_fail : meson.get_cross_property('xfail', '').contains('load_store_vectorizer'),
)
test(
'nir_serialize_test',
executable(
'nir_serialize_test',
files('tests/serialize_tests.cpp'),
cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
)
endif