diff options
Diffstat (limited to 'src/compiler/nir/meson.build')
-rw-r--r-- | src/compiler/nir/meson.build | 345 |
1 files changed, 111 insertions, 234 deletions
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build index 339b37200e2..42ff91799df 100644 --- a/src/compiler/nir/meson.build +++ b/src/compiler/nir/meson.build @@ -20,6 +20,8 @@ nir_depends = files('nir_opcodes.py', 'nir_intrinsics.py') +nir_algebraic_depends = files('nir_opcodes.py', 'nir_algebraic.py') + nir_builder_opcodes_h = custom_target( 'nir_builder_opcodes.h', input : 'nir_builder_opcodes_h.py', @@ -62,7 +64,7 @@ nir_opt_algebraic_c = custom_target( output : 'nir_opt_algebraic.c', command : [prog_python, '@INPUT@'], capture : true, - depend_files : files('nir_algebraic.py'), + depend_files : nir_algebraic_depends, ) nir_intrinsics_h = custom_target( @@ -95,6 +97,7 @@ nir_intrinsics_c = custom_target( files_libnir = files( 'nir.c', 'nir.h', + 'nir_builder.c', 'nir_builder.h', 'nir_builtin_builder.c', 'nir_builtin_builder.h', @@ -104,27 +107,29 @@ files_libnir = files( 'nir_control_flow.c', 'nir_control_flow.h', 'nir_control_flow_private.h', - 'nir_convert_ycbcr.c', 'nir_deref.c', 'nir_deref.h', 'nir_divergence_analysis.c', 'nir_dominance.c', 'nir_format_convert.h', 'nir_from_ssa.c', + 'nir_functions.c', 'nir_gather_info.c', - 'nir_gather_ssa_types.c', + 'nir_gather_types.c', 'nir_gather_xfb_info.c', + 'nir_group_loads.c', 'nir_gs_count_vertices.c', - 'nir_inline_functions.c', 'nir_inline_uniforms.c', 'nir_instr_set.c', 'nir_instr_set.h', + 'nir_legacy.c', + 'nir_legacy.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_alu_width.c', 'nir_lower_alpha_test.c', 'nir_lower_amul.c', 'nir_lower_array_deref_of_vec.c', @@ -134,13 +139,17 @@ files_libnir = files( 'nir_lower_bool_to_bitsize.c', 'nir_lower_bool_to_float.c', 'nir_lower_bool_to_int32.c', + 'nir_lower_cl_images.c', 'nir_lower_clamp_color_outputs.c', 'nir_lower_clip.c', 'nir_lower_clip_cull_distance_arrays.c', 'nir_lower_clip_disable.c', 'nir_lower_clip_halfz.c', + 'nir_lower_const_arrays_to_uniforms.c', + 'nir_lower_continue_constructs.c', 'nir_lower_convert_alu_types.c', 'nir_lower_variable_initializers.c', + 'nir_lower_discard_if.c', 'nir_lower_discard_or_demote.c', 'nir_lower_double_ops.c', 'nir_lower_drawpixels.c', @@ -149,15 +158,18 @@ files_libnir = files( 'nir_lower_flrp.c', 'nir_lower_fp16_conv.c', 'nir_lower_fragcoord_wtrans.c', + 'nir_lower_frag_coord_to_pixel_coord.c', 'nir_lower_fragcolor.c', 'nir_lower_frexp.c', 'nir_lower_global_vars_to_local.c', 'nir_lower_goto_ifs.c', 'nir_lower_gs_intrinsics.c', + 'nir_lower_helper_writes.c', 'nir_lower_load_const_to_scalar.c', 'nir_lower_locals_to_regs.c', 'nir_lower_idiv.c', 'nir_lower_image.c', + 'nir_lower_image_atomics_to_global.c', 'nir_lower_indirect_derefs.c', 'nir_lower_input_attachments.c', 'nir_lower_int64.c', @@ -171,6 +183,7 @@ files_libnir = files( 'nir_lower_is_helper_invocation.c', 'nir_lower_multiview.c', 'nir_lower_mediump.c', + 'nir_lower_mem_access_bit_sizes.c', 'nir_lower_memcpy.c', 'nir_lower_memory_model.c', 'nir_lower_non_uniform_access.c', @@ -181,24 +194,32 @@ files_libnir = files( 'nir_lower_pntc_ytransform.c', 'nir_lower_point_size.c', 'nir_lower_point_size_mov.c', + 'nir_lower_point_smooth.c', + 'nir_lower_poly_line_smooth.c', 'nir_lower_printf.c', - 'nir_lower_regs_to_ssa.c', + 'nir_lower_reg_intrinsics_to_ssa.c', 'nir_lower_readonly_images_to_tex.c', 'nir_lower_returns.c', + 'nir_lower_robust_access.c', 'nir_lower_samplers.c', 'nir_lower_scratch.c', 'nir_lower_shader_calls.c', + 'nir_lower_single_sampled.c', 'nir_lower_ssbo.c', 'nir_lower_subgroups.c', 'nir_lower_system_values.c', + 'nir_lower_task_shader.c', + 'nir_lower_terminate_to_demote.c', + 'nir_lower_tess_coord_z.c', + 'nir_lower_tex_shadow.c', 'nir_lower_tex.c', 'nir_lower_texcoord_replace.c', - 'nir_lower_to_source_mods.c', + 'nir_lower_texcoord_replace_late.c', 'nir_lower_two_sided_color.c', 'nir_lower_undef_to_zero.c', 'nir_lower_vars_to_ssa.c', 'nir_lower_var_copies.c', - 'nir_lower_vec_to_movs.c', + 'nir_lower_vec_to_regs.c', 'nir_lower_vec3_to_vec4.c', 'nir_lower_viewport_transform.c', 'nir_lower_wpos_center.c', @@ -207,7 +228,9 @@ files_libnir = files( 'nir_lower_bit_size.c', 'nir_lower_ubo_vec4.c', 'nir_lower_uniforms_to_ubo.c', + 'nir_lower_sysvals_to_varyings.c', 'nir_metadata.c', + 'nir_mod_analysis.c', 'nir_move_vec_src_uses_to_dest.c', 'nir_normalize_cubemap_coords.c', 'nir_opt_access.c', @@ -230,21 +253,32 @@ files_libnir = files( 'nir_opt_intrinsics.c', 'nir_opt_large_constants.c', 'nir_opt_load_store_vectorize.c', + 'nir_opt_loop.c', 'nir_opt_loop_unroll.c', 'nir_opt_memcpy.c', 'nir_opt_move.c', 'nir_opt_move_discards_to_top.c', + 'nir_opt_mqsad.c', + 'nir_opt_non_uniform_access.c', 'nir_opt_offsets.c', 'nir_opt_peephole_select.c', 'nir_opt_phi_precision.c', + 'nir_opt_preamble.c', + 'nir_opt_ray_queries.c', + 'nir_opt_reassociate_bfi.c', 'nir_opt_rematerialize_compares.c', 'nir_opt_remove_phis.c', + 'nir_opt_reuse_constants.c', + 'nir_opt_shrink_stores.c', 'nir_opt_shrink_vectors.c', 'nir_opt_sink.c', - 'nir_opt_trivial_continues.c', 'nir_opt_undef.c', 'nir_opt_uniform_atomics.c', + 'nir_opt_uniform_subgroup.c', + 'nir_opt_varyings.c', 'nir_opt_vectorize.c', + 'nir_passthrough_gs.c', + 'nir_passthrough_tcs.c', 'nir_phi_builder.c', 'nir_phi_builder.h', 'nir_print.c', @@ -252,7 +286,9 @@ files_libnir = files( 'nir_range_analysis.c', 'nir_range_analysis.h', 'nir_remove_dead_variables.c', + 'nir_remove_tex_shadow.c', 'nir_repair_ssa.c', + 'nir_scale_fdiv.c', 'nir_schedule.c', 'nir_schedule.h', 'nir_search.c', @@ -260,277 +296,118 @@ files_libnir = files( 'nir_search_helpers.h', 'nir_serialize.c', 'nir_serialize.h', + 'nir_split_64bit_vec3_and_vec4.c', 'nir_split_per_member_structs.c', 'nir_split_var_copies.c', 'nir_split_vars.c', 'nir_sweep.c', 'nir_to_lcssa.c', + 'nir_trivialize_registers.c', + 'nir_use_dominance.c', 'nir_validate.c', 'nir_vla.h', - 'nir_vulkan.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_load_libclc.c', - '../spirv/nir_lower_libclc.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_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 +# When a file is too large, -Wmisleading-indentation will give a note about +# not being able to process it, however that is not suppressable by a #pragma +# in GCC. This happens with the generated code in nir_opt_algebraic.c. +# +# As a workaround, drop the warning for GCC. Clang builds should cover this. +no_misleading_indentation = [] +if cc.get_id() == 'gcc' + no_misleading_indentation += cc.get_supported_arguments('-Wno-misleading-indentation') endif _libnir = static_library( 'nir', - [files_libnir, spirv_info_c, nir_opt_algebraic_c, nir_opcodes_c, + [files_libnir, 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, nir_intrinsics_indices_h, vtn_generator_ids_h], - include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_compiler, include_directories('../spirv')], - c_args : [c_msvc_compat_args, no_override_init_args, _libnir_args], + nir_intrinsics_c, nir_intrinsics_h, nir_intrinsics_indices_h], + include_directories : [inc_include, inc_src], + c_args : [c_msvc_compat_args, no_override_init_args, no_misleading_indentation], gnu_symbol_visibility : 'hidden', - dependencies : dep_valgrind, - link_with : libcompiler, + dependencies : [idep_compiler, dep_valgrind], build_by_default : false, ) +inc_nir = include_directories('.') + # Headers-only dependency idep_nir_headers = declare_dependency( - sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h, nir_intrinsics_indices_h], - include_directories : include_directories('.'), + sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h, nir_intrinsics_indices_h, + ir_expression_operation_h, builtin_types_h], + include_directories : [inc_nir, inc_compiler], ) # Also link with nir idep_nir = declare_dependency( - dependencies : [idep_nir_headers, idep_mesautil], + dependencies : [idep_nir_headers, idep_mesautil, idep_compiler], link_with : _libnir, ) -nir_algebraic_py = files('nir_algebraic.py') - if with_tests - test( - 'nir_builder', - executable( - 'nir_builder_test', - files('tests/builder_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'], - ) - - test( - 'nir_control_flow', - executable( - 'nir_control_flow_test', - files('tests/control_flow_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'], - ) + if cc.get_id() == 'msvc' and cc.version().version_compare('< 19.29') + msvc_designated_initializer = 'cpp_std=c++latest' + else + msvc_designated_initializer = 'cpp_std=c++20' + endif - 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'], - ) + msvc_bigobj = [] + if cc.get_id() == 'msvc' + msvc_bigobj = '/bigobj' + endif test( - 'nir_vars', + 'nir_tests', executable( - 'nir_vars_test', - files('tests/vars_tests.cpp'), - cpp_args : [cpp_msvc_compat_args], + 'nir_tests', + files( + 'tests/algebraic_tests.cpp', + 'tests/builder_tests.cpp', + 'tests/comparison_pre_tests.cpp', + 'tests/control_flow_tests.cpp', + 'tests/core_tests.cpp', + 'tests/dce_tests.cpp', + 'tests/load_store_vectorizer_tests.cpp', + 'tests/loop_analyze_tests.cpp', + 'tests/loop_unroll_tests.cpp', + 'tests/lower_alu_width_tests.cpp', + 'tests/mod_analysis_tests.cpp', + 'tests/negative_equal_tests.cpp', + 'tests/opt_if_tests.cpp', + 'tests/opt_peephole_select.cpp', + 'tests/opt_shrink_vectors_tests.cpp', + 'tests/opt_varyings_tests_bicm_binary_alu.cpp', + 'tests/opt_varyings_tests_dead_input.cpp', + 'tests/opt_varyings_tests_dead_output.cpp', + 'tests/opt_varyings_tests_dedup.cpp', + 'tests/opt_varyings_tests_prop_const.cpp', + 'tests/opt_varyings_tests_prop_ubo.cpp', + 'tests/opt_varyings_tests_prop_uniform.cpp', + 'tests/opt_varyings_tests_prop_uniform_expr.cpp', + 'tests/serialize_tests.cpp', + 'tests/range_analysis_tests.cpp', + 'tests/vars_tests.cpp', + ), + cpp_args : [cpp_msvc_compat_args, msvc_bigobj], + override_options: [msvc_designated_initializer], gnu_symbol_visibility : 'hidden', - include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + include_directories : [inc_include, inc_src], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], ), suite : ['compiler', 'nir'], + protocol : 'gtest', ) test( 'nir_algebraic_parser', prog_python, args : [ - join_paths(meson.current_source_dir(), 'tests/algebraic_parser_test.py') + files('tests/algebraic_parser_test.py') ], suite : ['compiler', 'nir'], ) - - test( - 'negative_equal', - executable( - 'negative_equal', - files('tests/negative_equal_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'], - ) - - test( - 'comparison_pre', - executable( - 'comparison_pre', - files('tests/comparison_pre_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'], - ) - - test( - 'load_store_vectorizer', - executable( - 'load_store_vectorizer', - files('tests/load_store_vectorizer_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'], - 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_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'], - ) - - 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'], - ) - - 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'], - ) - - 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'], - ) - - test( - 'algebraic', - executable( - 'algebraic', - files('tests/algebraic_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'], - ) endif |