2017-09-14 17:57:17 -07:00
|
|
|
# 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.
|
|
|
|
|
2018-05-02 12:43:50 -04:00
|
|
|
nir_depends = files('nir_opcodes.py', 'nir_intrinsics.py')
|
2017-09-14 17:57:17 -07:00
|
|
|
|
|
|
|
nir_builder_opcodes_h = custom_target(
|
|
|
|
'nir_builder_opcodes.h',
|
|
|
|
input : 'nir_builder_opcodes_h.py',
|
|
|
|
output : 'nir_builder_opcodes.h',
|
2018-08-09 10:27:26 +02:00
|
|
|
command : [prog_python, '@INPUT@'],
|
2017-09-14 17:57:17 -07:00
|
|
|
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',
|
2018-08-09 10:27:26 +02:00
|
|
|
command : [prog_python, '@INPUT@'],
|
2017-09-14 17:57:17 -07:00
|
|
|
capture : true,
|
|
|
|
depend_files : nir_depends,
|
|
|
|
)
|
|
|
|
|
|
|
|
nir_opcodes_h = custom_target(
|
|
|
|
'nir_opcodes.h',
|
|
|
|
input : 'nir_opcodes_h.py',
|
|
|
|
output : 'nir_opcodes.h',
|
2018-08-09 10:27:26 +02:00
|
|
|
command : [prog_python, '@INPUT@'],
|
2017-09-14 17:57:17 -07:00
|
|
|
capture : true,
|
|
|
|
depend_files : nir_depends,
|
|
|
|
)
|
|
|
|
|
|
|
|
nir_opcodes_c = custom_target(
|
|
|
|
'nir_opcodes.c',
|
|
|
|
input : 'nir_opcodes_c.py',
|
|
|
|
output : 'nir_opcodes.c',
|
2018-08-09 10:27:26 +02:00
|
|
|
command : [prog_python, '@INPUT@'],
|
2017-09-14 17:57:17 -07:00
|
|
|
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',
|
2018-08-09 10:27:26 +02:00
|
|
|
command : [prog_python, '@INPUT@'],
|
2017-09-14 17:57:17 -07:00
|
|
|
capture : true,
|
|
|
|
depend_files : files('nir_algebraic.py'),
|
|
|
|
)
|
|
|
|
|
2018-03-15 18:42:44 -04:00
|
|
|
nir_intrinsics_h = custom_target(
|
|
|
|
'nir_intrinsics.h',
|
|
|
|
input : 'nir_intrinsics_h.py',
|
|
|
|
output : 'nir_intrinsics.h',
|
2018-08-09 10:27:26 +02:00
|
|
|
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
2018-03-15 18:42:44 -04:00
|
|
|
capture : false,
|
|
|
|
depend_files : files('nir_intrinsics.py'),
|
|
|
|
)
|
|
|
|
|
2020-11-24 12:51:59 +00:00
|
|
|
nir_intrinsics_indices_h = custom_target(
|
|
|
|
'nir_intrinsics_indices.h',
|
|
|
|
input : 'nir_intrinsics_indices_h.py',
|
|
|
|
output : 'nir_intrinsics_indices.h',
|
|
|
|
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
|
|
|
capture : false,
|
|
|
|
depend_files : files('nir_intrinsics.py'),
|
|
|
|
)
|
|
|
|
|
2018-03-15 18:42:44 -04:00
|
|
|
nir_intrinsics_c = custom_target(
|
|
|
|
'nir_intrinsic.c',
|
|
|
|
input : 'nir_intrinsics_c.py',
|
|
|
|
output : 'nir_intrinsics.c',
|
2018-08-09 10:27:26 +02:00
|
|
|
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
2018-03-15 18:42:44 -04:00
|
|
|
capture: false,
|
|
|
|
depend_files : files('nir_intrinsics.py'),
|
|
|
|
)
|
|
|
|
|
2017-09-14 17:57:17 -07:00
|
|
|
files_libnir = files(
|
|
|
|
'nir.c',
|
|
|
|
'nir.h',
|
|
|
|
'nir_builder.h',
|
2018-04-25 18:19:23 +02:00
|
|
|
'nir_builtin_builder.c',
|
|
|
|
'nir_builtin_builder.h',
|
2020-09-30 14:11:46 -05:00
|
|
|
'nir_conversion_builder.h',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_clone.c',
|
|
|
|
'nir_constant_expressions.h',
|
|
|
|
'nir_control_flow.c',
|
|
|
|
'nir_control_flow.h',
|
|
|
|
'nir_control_flow_private.h',
|
2020-04-10 08:34:53 -04:00
|
|
|
'nir_convert_ycbcr.c',
|
2018-03-16 01:15:47 -07:00
|
|
|
'nir_deref.c',
|
2018-03-20 11:11:25 -07:00
|
|
|
'nir_deref.h',
|
2019-05-20 14:58:23 +02:00
|
|
|
'nir_divergence_analysis.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_dominance.c',
|
2017-10-20 09:35:48 -07:00
|
|
|
'nir_format_convert.h',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_from_ssa.c',
|
|
|
|
'nir_gather_info.c',
|
2019-01-05 09:13:44 -06:00
|
|
|
'nir_gather_ssa_types.c',
|
2018-10-05 09:13:25 -05:00
|
|
|
'nir_gather_xfb_info.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_gs_count_vertices.c',
|
|
|
|
'nir_inline_functions.c',
|
2020-09-29 17:34:28 -04:00
|
|
|
'nir_inline_uniforms.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_instr_set.c',
|
|
|
|
'nir_instr_set.h',
|
2017-10-04 16:50:50 -07:00
|
|
|
'nir_linking_helpers.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_liveness.c',
|
|
|
|
'nir_loop_analyze.c',
|
|
|
|
'nir_loop_analyze.h',
|
2018-05-08 11:24:40 -07:00
|
|
|
'nir_lower_alu.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_alu_to_scalar.c',
|
2017-02-22 16:53:18 -08:00
|
|
|
'nir_lower_alpha_test.c',
|
2019-09-27 10:15:02 -07:00
|
|
|
'nir_lower_amul.c',
|
2019-03-11 18:47:39 -05:00
|
|
|
'nir_lower_array_deref_of_vec.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_atomics_to_ssbo.c',
|
|
|
|
'nir_lower_bitmap.c',
|
2021-05-04 14:11:12 -04:00
|
|
|
'nir_lower_blend.c',
|
2018-10-24 09:25:29 +02:00
|
|
|
'nir_lower_bool_to_bitsize.c',
|
2018-10-22 16:44:59 -05:00
|
|
|
'nir_lower_bool_to_float.c',
|
2018-10-18 12:04:09 -05:00
|
|
|
'nir_lower_bool_to_int32.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_clamp_color_outputs.c',
|
|
|
|
'nir_lower_clip.c',
|
|
|
|
'nir_lower_clip_cull_distance_arrays.c',
|
2020-06-17 09:35:46 -04:00
|
|
|
'nir_lower_clip_disable.c',
|
2019-12-15 18:03:49 +01:00
|
|
|
'nir_lower_clip_halfz.c',
|
2020-09-30 16:15:02 -05:00
|
|
|
'nir_lower_convert_alu_types.c',
|
2020-02-07 14:18:49 -06:00
|
|
|
'nir_lower_variable_initializers.c',
|
2020-09-21 21:16:02 -04:00
|
|
|
'nir_lower_discard_or_demote.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_double_ops.c',
|
|
|
|
'nir_lower_drawpixels.c',
|
2019-04-26 10:05:08 -07:00
|
|
|
'nir_lower_fb_read.c',
|
2019-01-24 13:07:42 +10:00
|
|
|
'nir_lower_flatshade.c',
|
2018-08-18 11:46:46 -07:00
|
|
|
'nir_lower_flrp.c',
|
2020-12-29 12:43:11 +10:00
|
|
|
'nir_lower_fp16_conv.c',
|
2019-04-26 15:01:43 +02:00
|
|
|
'nir_lower_fragcoord_wtrans.c',
|
2020-07-06 08:56:16 -04:00
|
|
|
'nir_lower_fragcolor.c',
|
2019-03-22 09:24:57 +01:00
|
|
|
'nir_lower_frexp.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_global_vars_to_local.c',
|
2020-04-06 12:52:06 +02:00
|
|
|
'nir_lower_goto_ifs.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_gs_intrinsics.c',
|
|
|
|
'nir_lower_load_const_to_scalar.c',
|
|
|
|
'nir_lower_locals_to_regs.c',
|
|
|
|
'nir_lower_idiv.c',
|
2021-07-15 01:14:17 -07:00
|
|
|
'nir_lower_image.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_indirect_derefs.c',
|
2019-04-03 17:29:20 +02:00
|
|
|
'nir_lower_input_attachments.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_int64.c',
|
2019-04-03 19:29:36 -04:00
|
|
|
'nir_lower_interpolation.c',
|
2019-04-30 22:25:05 -07:00
|
|
|
'nir_lower_int_to_float.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_io.c',
|
2017-10-23 15:51:29 +11:00
|
|
|
'nir_lower_io_arrays_to_elements.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_io_to_temporaries.c',
|
|
|
|
'nir_lower_io_to_scalar.c',
|
2019-03-06 15:21:51 -06:00
|
|
|
'nir_lower_io_to_vector.c',
|
2021-03-05 19:58:25 +02:00
|
|
|
'nir_lower_is_helper_invocation.c',
|
2020-07-06 15:25:03 +02:00
|
|
|
'nir_lower_multiview.c',
|
2021-02-07 21:10:08 -05:00
|
|
|
'nir_lower_mediump.c',
|
2020-09-14 15:20:37 -05:00
|
|
|
'nir_lower_memcpy.c',
|
2020-05-01 14:32:31 +01:00
|
|
|
'nir_lower_memory_model.c',
|
2019-02-27 14:36:44 -06:00
|
|
|
'nir_lower_non_uniform_access.c',
|
2018-04-27 09:28:48 +02:00
|
|
|
'nir_lower_packing.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_passthrough_edgeflags.c',
|
|
|
|
'nir_lower_patch_vertices.c',
|
|
|
|
'nir_lower_phis_to_scalar.c',
|
2020-12-22 14:37:45 +02:00
|
|
|
'nir_lower_pntc_ytransform.c',
|
2019-07-31 09:47:08 +02:00
|
|
|
'nir_lower_point_size.c',
|
2019-10-03 16:44:29 -04:00
|
|
|
'nir_lower_point_size_mov.c',
|
2020-08-13 17:21:18 -07:00
|
|
|
'nir_lower_printf.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_regs_to_ssa.c',
|
2021-04-20 07:43:18 -07:00
|
|
|
'nir_lower_readonly_images_to_tex.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_returns.c',
|
2019-08-28 22:34:14 +02:00
|
|
|
'nir_lower_samplers.c',
|
2016-12-02 11:36:42 -08:00
|
|
|
'nir_lower_scratch.c',
|
2021-02-16 02:37:40 +01:00
|
|
|
'nir_lower_shader_calls.c',
|
2019-11-04 17:27:18 -05:00
|
|
|
'nir_lower_ssbo.c',
|
2017-08-22 13:23:59 -07:00
|
|
|
'nir_lower_subgroups.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_system_values.c',
|
|
|
|
'nir_lower_tex.c',
|
2020-08-27 13:25:15 +02:00
|
|
|
'nir_lower_texcoord_replace.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_to_source_mods.c',
|
|
|
|
'nir_lower_two_sided_color.c',
|
2020-06-02 08:30:35 -07:00
|
|
|
'nir_lower_undef_to_zero.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_vars_to_ssa.c',
|
|
|
|
'nir_lower_var_copies.c',
|
|
|
|
'nir_lower_vec_to_movs.c',
|
2020-09-25 17:43:33 -05:00
|
|
|
'nir_lower_vec3_to_vec4.c',
|
2019-04-14 15:43:13 +00:00
|
|
|
'nir_lower_viewport_transform.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_lower_wpos_center.c',
|
|
|
|
'nir_lower_wpos_ytransform.c',
|
2020-05-06 14:20:09 -07:00
|
|
|
'nir_lower_wrmasks.c',
|
2018-04-26 10:02:04 +02:00
|
|
|
'nir_lower_bit_size.c',
|
2020-08-18 11:38:41 -07:00
|
|
|
'nir_lower_ubo_vec4.c',
|
2019-02-08 22:36:37 +01:00
|
|
|
'nir_lower_uniforms_to_ubo.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_metadata.c',
|
|
|
|
'nir_move_vec_src_uses_to_dest.c',
|
|
|
|
'nir_normalize_cubemap_coords.c',
|
2019-09-27 16:43:31 -04:00
|
|
|
'nir_opt_access.c',
|
2020-02-21 10:53:05 -08:00
|
|
|
'nir_opt_barriers.c',
|
2019-03-08 10:08:20 -08:00
|
|
|
'nir_opt_combine_stores.c',
|
2018-05-22 18:19:16 -07:00
|
|
|
'nir_opt_comparison_pre.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'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',
|
2018-07-27 13:56:35 -07:00
|
|
|
'nir_opt_dead_write_vars.c',
|
2018-07-23 19:16:56 -07:00
|
|
|
'nir_opt_find_array_copies.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_opt_gcm.c',
|
2017-12-28 13:06:28 -08:00
|
|
|
'nir_opt_idiv_const.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_opt_if.c',
|
|
|
|
'nir_opt_intrinsics.c',
|
2018-06-28 19:16:58 -07:00
|
|
|
'nir_opt_large_constants.c',
|
2019-03-19 20:55:30 +00:00
|
|
|
'nir_opt_load_store_vectorize.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_opt_loop_unroll.c',
|
2020-09-25 13:02:25 -05:00
|
|
|
'nir_opt_memcpy.c',
|
2019-07-24 19:23:21 +01:00
|
|
|
'nir_opt_move.c',
|
2018-07-03 17:39:15 -07:00
|
|
|
'nir_opt_move_discards_to_top.c',
|
2021-03-11 12:45:31 +01:00
|
|
|
'nir_opt_offsets.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_opt_peephole_select.c',
|
2021-06-21 14:19:51 -07:00
|
|
|
'nir_opt_phi_precision.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',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_opt_remove_phis.c',
|
2020-07-22 16:57:22 -07:00
|
|
|
'nir_opt_shrink_vectors.c',
|
2019-05-22 20:23:03 +01:00
|
|
|
'nir_opt_sink.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_opt_trivial_continues.c',
|
|
|
|
'nir_opt_undef.c',
|
2020-09-01 16:31:37 +01:00
|
|
|
'nir_opt_uniform_atomics.c',
|
2015-11-14 20:26:47 -05:00
|
|
|
'nir_opt_vectorize.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_phi_builder.c',
|
|
|
|
'nir_phi_builder.h',
|
|
|
|
'nir_print.c',
|
|
|
|
'nir_propagate_invariant.c',
|
2018-01-23 09:48:43 +08:00
|
|
|
'nir_range_analysis.c',
|
|
|
|
'nir_range_analysis.h',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_remove_dead_variables.c',
|
|
|
|
'nir_repair_ssa.c',
|
2019-02-19 09:30:52 -08:00
|
|
|
'nir_schedule.c',
|
2020-07-17 09:08:47 +02:00
|
|
|
'nir_schedule.h',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_search.c',
|
|
|
|
'nir_search.h',
|
|
|
|
'nir_search_helpers.h',
|
2017-09-12 23:17:51 -04:00
|
|
|
'nir_serialize.c',
|
|
|
|
'nir_serialize.h',
|
2018-03-21 16:48:35 -07:00
|
|
|
'nir_split_per_member_structs.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_split_var_copies.c',
|
2018-07-24 10:08:06 -07:00
|
|
|
'nir_split_vars.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_sweep.c',
|
|
|
|
'nir_to_lcssa.c',
|
|
|
|
'nir_validate.c',
|
|
|
|
'nir_vla.h',
|
2020-04-10 08:34:53 -04:00
|
|
|
'nir_vulkan.h',
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir_worklist.c',
|
|
|
|
'nir_worklist.h',
|
2018-10-05 09:13:25 -05:00
|
|
|
'nir_xfb_info.h',
|
2018-03-19 13:08:32 +01:00
|
|
|
'../spirv/GLSL.ext.AMD.h',
|
2017-09-14 17:57:17 -07:00
|
|
|
'../spirv/GLSL.std.450.h',
|
2018-01-18 12:31:52 +01:00
|
|
|
'../spirv/gl_spirv.c',
|
2020-10-06 11:26:07 -05:00
|
|
|
'../spirv/nir_load_libclc.c',
|
2020-10-06 22:14:59 -05:00
|
|
|
'../spirv/nir_lower_libclc.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'../spirv/nir_spirv.h',
|
2018-07-12 15:02:27 +02:00
|
|
|
'../spirv/OpenCL.std.h',
|
2017-09-14 17:57:17 -07:00
|
|
|
'../spirv/spirv.h',
|
|
|
|
'../spirv/spirv_info.h',
|
|
|
|
'../spirv/spirv_to_nir.c',
|
|
|
|
'../spirv/vtn_alu.c',
|
2018-02-23 13:54:59 +01:00
|
|
|
'../spirv/vtn_amd.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'../spirv/vtn_cfg.c',
|
|
|
|
'../spirv/vtn_glsl450.c',
|
2018-07-12 15:02:27 +02:00
|
|
|
'../spirv/vtn_opencl.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'../spirv/vtn_private.h',
|
2017-04-28 04:45:50 -07:00
|
|
|
'../spirv/vtn_subgroup.c',
|
2017-09-14 17:57:17 -07:00
|
|
|
'../spirv/vtn_variables.c',
|
|
|
|
)
|
|
|
|
|
2020-10-06 11:26:07 -05:00
|
|
|
_libnir_args = []
|
|
|
|
if dep_clc.found()
|
|
|
|
_basedir = dep_clc.get_variable(pkgconfig : 'libexecdir')
|
|
|
|
|
|
|
|
_static_libclc = get_option('static-libclc')
|
|
|
|
if _static_libclc.length() > 0
|
|
|
|
if _static_libclc.contains('all')
|
|
|
|
_static_libclc = ['spirv', 'spirv64']
|
|
|
|
endif
|
|
|
|
|
|
|
|
prog_zstd = find_program('zstd', required : false)
|
|
|
|
_zstd_static_libclc = dep_zstd.found() and prog_zstd.found()
|
|
|
|
if _zstd_static_libclc
|
|
|
|
_libnir_args += '-DHAVE_STATIC_LIBCLC_ZSTD'
|
|
|
|
endif
|
|
|
|
|
|
|
|
foreach s : _static_libclc
|
|
|
|
_libnir_args += '-DHAVE_STATIC_LIBCLC_@0@'.format(s.to_upper())
|
|
|
|
f = '@0@-mesa3d-.spv'.format(s)
|
|
|
|
_libclc_file = _basedir / f
|
|
|
|
|
|
|
|
if _zstd_static_libclc
|
|
|
|
_libclc_file = custom_target(
|
|
|
|
'@0@.zstd'.format(f),
|
|
|
|
command : [prog_zstd, '-f', '@INPUT@', '-o', '@OUTPUT@'],
|
|
|
|
input : [_libclc_file],
|
|
|
|
output : '@0@.zstd'.format(f),
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
files_libnir += custom_target(
|
|
|
|
'@0@.h'.format(f),
|
|
|
|
command : [
|
|
|
|
prog_python, files_xxd, '-b', '@INPUT@', '@OUTPUT@',
|
|
|
|
'-n', 'libclc_@0@_mesa3d_spv'.format(s),
|
|
|
|
],
|
|
|
|
input : [_libclc_file],
|
|
|
|
output : '@0@.h'.format(f),
|
|
|
|
depend_files : files_xxd,
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
else
|
|
|
|
_libnir_args += ['-DDYNAMIC_LIBCLC_PATH="@0@/"'.format(_basedir)]
|
|
|
|
if not cc.has_function('mmap')
|
|
|
|
error('mmap required for dynamic libCLC loading')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-09-25 00:44:21 +01:00
|
|
|
_libnir = static_library(
|
2017-09-14 17:57:17 -07:00
|
|
|
'nir',
|
|
|
|
[files_libnir, spirv_info_c, nir_opt_algebraic_c, nir_opcodes_c,
|
2017-12-05 22:31:02 -08:00
|
|
|
nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h,
|
2020-11-24 12:51:59 +00:00
|
|
|
vtn_gather_types_c, nir_intrinsics_c, nir_intrinsics_h, nir_intrinsics_indices_h, vtn_generator_ids_h],
|
2019-03-05 16:21:47 +00:00
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_compiler, include_directories('../spirv')],
|
2020-10-06 11:26:07 -05:00
|
|
|
c_args : [c_msvc_compat_args, no_override_init_args, _libnir_args],
|
2020-04-24 13:10:41 -07:00
|
|
|
gnu_symbol_visibility : 'hidden',
|
2020-11-17 11:29:52 -08:00
|
|
|
dependencies : dep_valgrind,
|
2017-09-14 17:57:17 -07:00
|
|
|
link_with : libcompiler,
|
|
|
|
build_by_default : false,
|
|
|
|
)
|
|
|
|
|
2017-12-12 12:22:56 -08:00
|
|
|
# Headers-only dependency
|
|
|
|
idep_nir_headers = declare_dependency(
|
2020-11-24 12:51:59 +00:00
|
|
|
sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h, nir_intrinsics_indices_h],
|
2017-12-12 12:22:56 -08:00
|
|
|
include_directories : include_directories('.'),
|
|
|
|
)
|
|
|
|
|
|
|
|
# Also link with nir
|
|
|
|
idep_nir = declare_dependency(
|
2020-11-17 11:29:52 -08:00
|
|
|
dependencies : [idep_nir_headers, idep_mesautil],
|
2019-09-25 00:44:21 +01:00
|
|
|
link_with : _libnir,
|
2017-12-12 12:22:56 -08:00
|
|
|
)
|
|
|
|
|
2017-10-24 11:07:52 -04:00
|
|
|
nir_algebraic_py = files('nir_algebraic.py')
|
|
|
|
|
2017-09-14 17:57:17 -07:00
|
|
|
if with_tests
|
2019-11-08 19:24:05 -06:00
|
|
|
test(
|
|
|
|
'nir_builder',
|
|
|
|
executable(
|
|
|
|
'nir_builder_test',
|
|
|
|
files('tests/builder_tests.cpp'),
|
2020-04-24 13:10:41 -07:00
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-05 16:21:47 +00:00
|
|
|
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'],
|
|
|
|
)
|
|
|
|
|
2017-12-11 16:13:31 -08:00
|
|
|
test(
|
|
|
|
'nir_control_flow',
|
|
|
|
executable(
|
|
|
|
'nir_control_flow_test',
|
2017-12-12 12:22:56 -08:00
|
|
|
files('tests/control_flow_tests.cpp'),
|
2020-04-24 13:10:41 -07:00
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-05 16:21:47 +00:00
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
2019-07-22 14:50:15 +01:00
|
|
|
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
|
2019-05-08 10:26:49 -04:00
|
|
|
),
|
2018-11-19 13:44:15 -08:00
|
|
|
suite : ['compiler', 'nir'],
|
2017-09-14 17:57:17 -07:00
|
|
|
)
|
2018-11-19 13:44:15 -08:00
|
|
|
|
2021-06-25 16:53:55 -07:00
|
|
|
test(
|
|
|
|
'nir_core',
|
|
|
|
executable(
|
|
|
|
'nir_core_test',
|
|
|
|
files('tests/core_tests.cpp'),
|
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
|
|
|
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'],
|
|
|
|
)
|
|
|
|
|
2018-08-29 16:30:09 -07:00
|
|
|
test(
|
|
|
|
'nir_vars',
|
|
|
|
executable(
|
|
|
|
'nir_vars_test',
|
|
|
|
files('tests/vars_tests.cpp'),
|
2020-04-24 13:10:41 -07:00
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-05 16:21:47 +00:00
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
2019-07-22 14:50:15 +01:00
|
|
|
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
|
2018-11-19 13:44:15 -08:00
|
|
|
),
|
|
|
|
suite : ['compiler', 'nir'],
|
2018-08-29 16:30:09 -07:00
|
|
|
)
|
2019-07-20 00:42:13 +01:00
|
|
|
|
2018-11-29 17:46:59 +01:00
|
|
|
test(
|
|
|
|
'nir_algebraic_parser',
|
|
|
|
prog_python,
|
|
|
|
args : [
|
|
|
|
join_paths(meson.current_source_dir(), 'tests/algebraic_parser_test.py')
|
|
|
|
],
|
2018-12-07 09:15:27 -08:00
|
|
|
suite : ['compiler', 'nir'],
|
2018-11-29 17:46:59 +01:00
|
|
|
)
|
2018-05-24 11:37:51 -07:00
|
|
|
|
|
|
|
test(
|
|
|
|
'negative_equal',
|
|
|
|
executable(
|
|
|
|
'negative_equal',
|
|
|
|
files('tests/negative_equal_tests.cpp'),
|
2020-04-24 13:10:41 -07:00
|
|
|
c_args : [c_msvc_compat_args, no_override_init_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-05 16:21:47 +00:00
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
2019-07-22 14:50:15 +01:00
|
|
|
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
|
2019-07-20 00:42:13 +01:00
|
|
|
),
|
|
|
|
suite : ['compiler', 'nir'],
|
2018-05-24 11:37:51 -07:00
|
|
|
)
|
2019-06-17 16:27:37 -07:00
|
|
|
|
|
|
|
test(
|
|
|
|
'comparison_pre',
|
|
|
|
executable(
|
|
|
|
'comparison_pre',
|
|
|
|
files('tests/comparison_pre_tests.cpp'),
|
2020-04-24 13:10:41 -07:00
|
|
|
c_args : [c_msvc_compat_args, no_override_init_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-05 16:21:47 +00:00
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
2019-07-22 14:50:15 +01:00
|
|
|
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
|
2019-07-20 00:42:13 +01:00
|
|
|
),
|
|
|
|
suite : ['compiler', 'nir'],
|
2019-06-17 16:27:37 -07:00
|
|
|
)
|
2019-09-02 16:09:24 +01:00
|
|
|
|
|
|
|
test(
|
|
|
|
'load_store_vectorizer',
|
|
|
|
executable(
|
|
|
|
'load_store_vectorizer',
|
|
|
|
files('tests/load_store_vectorizer_tests.cpp'),
|
2020-04-24 13:10:41 -07:00
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-05 16:21:47 +00:00
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
2019-09-02 16:09:24 +01:00
|
|
|
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
|
|
|
|
),
|
|
|
|
suite : ['compiler', 'nir'],
|
2020-01-30 18:21:15 +01:00
|
|
|
should_fail : meson.get_cross_property('xfail', '').contains('load_store_vectorizer'),
|
2019-09-02 16:09:24 +01:00
|
|
|
)
|
2019-12-02 22:41:33 +01:00
|
|
|
|
|
|
|
test(
|
|
|
|
'nir_serialize_test',
|
|
|
|
executable(
|
|
|
|
'nir_serialize_test',
|
|
|
|
files('tests/serialize_tests.cpp'),
|
2020-04-24 13:10:41 -07:00
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
2019-03-05 16:21:47 +00:00
|
|
|
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
2019-12-02 22:41:33 +01:00
|
|
|
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
|
|
|
|
),
|
|
|
|
suite : ['compiler', 'nir'],
|
|
|
|
)
|
2020-07-21 15:51:55 +03:00
|
|
|
|
|
|
|
test(
|
|
|
|
'nir_opt_if',
|
|
|
|
executable(
|
|
|
|
'nir_opt_if_tests',
|
|
|
|
files('tests/opt_if_tests.cpp'),
|
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
|
|
|
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'],
|
|
|
|
)
|
2020-08-04 18:12:47 +03:00
|
|
|
|
|
|
|
test(
|
|
|
|
'nir_lower_returns',
|
|
|
|
executable(
|
|
|
|
'nir_lower_returns_tests',
|
|
|
|
files('tests/lower_returns_tests.cpp'),
|
|
|
|
cpp_args : [cpp_msvc_compat_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
|
|
|
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'],
|
|
|
|
)
|
2021-02-17 19:40:07 -08:00
|
|
|
|
|
|
|
test(
|
|
|
|
'ssa_def_bits_used',
|
|
|
|
executable(
|
|
|
|
'ssa_def_bits_used',
|
|
|
|
files('tests/ssa_def_bits_used_tests.cpp'),
|
|
|
|
c_args : [c_msvc_compat_args, no_override_init_args],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
|
|
|
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'],
|
|
|
|
)
|
2017-09-14 17:57:17 -07:00
|
|
|
endif
|