1# Copyright © 2017 Intel Corporation 2# SPDX-License-Identifier: MIT 3 4intel_nir_files = files( 5 'intel_nir.h', 6 'intel_nir.c', 7 8 'intel_nir_blockify_uniform_loads.c', 9 'intel_nir_clamp_image_1d_2d_array_sizes.c', 10 'intel_nir_clamp_per_vertex_loads.c', 11 'intel_nir_lower_conversions.c', 12 'intel_nir_lower_non_uniform_barycentric_at_sample.c', 13 'intel_nir_lower_non_uniform_resource_intel.c', 14 'intel_nir_lower_printf.c', 15 'intel_nir_lower_shading_rate_output.c', 16 'intel_nir_lower_sparse.c', 17 'intel_nir_lower_texture.c', 18 'intel_nir_opt_peephole_ffma.c', 19 'intel_nir_opt_peephole_imul32x16.c', 20 'intel_nir_tcs_workarounds.c', 21) 22 23libintel_compiler_brw_files = files( 24 'brw_cfg.cpp', 25 'brw_cfg.h', 26 'brw_compile_bs.cpp', 27 'brw_compile_cs.cpp', 28 'brw_compile_fs.cpp', 29 'brw_compile_gs.cpp', 30 'brw_compile_mesh.cpp', 31 'brw_compile_tcs.cpp', 32 'brw_compile_tes.cpp', 33 'brw_compile_vs.cpp', 34 'brw_compiler.c', 35 'brw_compiler.h', 36 'brw_debug_recompile.c', 37 'brw_def_analysis.cpp', 38 'brw_disasm.c', 39 'brw_disasm_info.cpp', 40 'brw_disasm_info.h', 41 'brw_eu.c', 42 'brw_eu_compact.c', 43 'brw_eu_defines.h', 44 'brw_eu_emit.c', 45 'brw_eu.h', 46 'brw_eu_validate.c', 47 'brw_fs_bank_conflicts.cpp', 48 'brw_fs_builder.h', 49 'brw_fs_cmod_propagation.cpp', 50 'brw_fs_combine_constants.cpp', 51 'brw_fs_copy_propagation.cpp', 52 'brw_fs.cpp', 53 'brw_fs_cse.cpp', 54 'brw_fs_dead_code_eliminate.cpp', 55 'brw_fs_generator.cpp', 56 'brw_fs.h', 57 'brw_fs_live_variables.cpp', 58 'brw_fs_live_variables.h', 59 'brw_fs_lower.cpp', 60 'brw_fs_lower_dpas.cpp', 61 'brw_fs_lower_integer_multiplication.cpp', 62 'brw_fs_lower_pack.cpp', 63 'brw_fs_lower_regioning.cpp', 64 'brw_fs_lower_simd_width.cpp', 65 'brw_fs_nir.cpp', 66 'brw_fs_opt.cpp', 67 'brw_fs_opt_algebraic.cpp', 68 'brw_fs_opt_virtual_grfs.cpp', 69 'brw_fs_reg_allocate.cpp', 70 'brw_fs_register_coalesce.cpp', 71 'brw_fs_saturate_propagation.cpp', 72 'brw_fs_scoreboard.cpp', 73 'brw_fs_thread_payload.cpp', 74 'brw_fs_validate.cpp', 75 'brw_fs_visitor.cpp', 76 'brw_fs_workaround.cpp', 77 'brw_inst.h', 78 'brw_ir.h', 79 'brw_ir_allocator.h', 80 'brw_ir_analysis.h', 81 'brw_ir_fs.h', 82 'brw_ir_performance.h', 83 'brw_ir_performance.cpp', 84 'brw_isa_info.h', 85 'brw_lower_logical_sends.cpp', 86 'brw_nir.h', 87 'brw_nir.c', 88 'brw_nir_analyze_ubo_ranges.c', 89 'brw_nir_lower_cooperative_matrix.c', 90 'brw_nir_lower_cs_intrinsics.c', 91 'brw_nir_lower_alpha_to_coverage.c', 92 'brw_nir_lower_intersection_shader.c', 93 'brw_nir_lower_ray_queries.c', 94 'brw_nir_lower_rt_intrinsics.c', 95 'brw_nir_lower_shader_calls.c', 96 'brw_nir_lower_storage_image.c', 97 'brw_nir_opt_fsat.c', 98 'brw_nir_rt.h', 99 'brw_nir_rt.c', 100 'brw_nir_rt_builder.h', 101 'brw_packed_float.c', 102 'brw_print.cpp', 103 'brw_prim.h', 104 'brw_private.h', 105 'brw_reg.h', 106 'brw_reg_type.c', 107 'brw_reg_type.h', 108 'brw_rt.h', 109 'brw_schedule_instructions.cpp', 110 'brw_shader.cpp', 111 'brw_simd_selection.cpp', 112 'brw_vue_map.c', 113) 114 115brw_device_sha1_gen_src = custom_target('brw_device_sha1_gen.c', 116 input : ['brw_device_sha1_gen_c.py', '../dev/intel_device_info.py'], 117 output : ['brw_device_sha1_gen.c'], 118 command : [prog_python, '@INPUT0@', '--outdir', meson.current_build_dir()]) 119 120 121brw_nir_lower_fsign = custom_target( 122 'brw_nir_lower_fsign.c', 123 input : 'brw_nir_lower_fsign.py', 124 output : 'brw_nir_lower_fsign.c', 125 command : [ 126 prog_python, '@INPUT@', '-p', dir_compiler_nir, 127 ], 128 depend_files : nir_algebraic_depends, 129 capture : true, 130) 131 132brw_nir_trig = custom_target( 133 'brw_nir_trig_workarounds.c', 134 input : 'brw_nir_trig_workarounds.py', 135 output : 'brw_nir_trig_workarounds.c', 136 command : [ 137 prog_python, '@INPUT@', '-p', dir_compiler_nir, 138 ], 139 depend_files : nir_algebraic_depends, 140 capture : true, 141) 142 143libintel_compiler_brw = static_library( 144 'intel_compiler', 145 [libintel_compiler_brw_files, intel_nir_files, brw_nir_lower_fsign, brw_nir_trig, ir_expression_operation_h, [brw_device_sha1_gen_src]], 146 include_directories : [inc_include, inc_src, inc_intel], 147 c_args : [no_override_init_args], 148 gnu_symbol_visibility : 'hidden', 149 dependencies : [idep_nir_headers, idep_mesautil, idep_intel_dev], 150 build_by_default : false, 151) 152 153idep_intel_compiler_brw = declare_dependency( 154 link_with : [libintel_compiler_brw], 155 dependencies : [ 156 idep_nir, 157 idep_mesautil, 158 ], 159) 160 161# For now this tool is only going to be used by Anv 162if get_option('intel-clc') == 'system' 163 prog_intel_clc = find_program('intel_clc', native : true) 164 dep_prog_intel_clc = [] 165elif with_intel_clc 166 prog_intel_clc = executable( 167 'intel_clc', 168 [ 169 'intel_clc.c', 170 'brw_kernel.c', 171 172 # Use just the nir_options part of ELK instead of fully linking. 173 'elk/elk_nir_options.h', 174 'elk/elk_nir_options.c', 175 ], 176 link_with : [libisl], 177 include_directories : [inc_include, inc_src, inc_intel], 178 c_args : [pre_args, no_override_init_args], 179 link_args : [ld_args_build_id], 180 dependencies : [idep_nir, idep_vtn, idep_mesaclc, idep_mesautil, idep_intel_dev, 181 idep_intel_compiler_brw], 182 # If we can run host binaries directly, just build intel_clc for the host. 183 # Most commonly this happens when doing a cross compile from an x86_64 build 184 # machine to an x86 host 185 native : not meson.can_run_host_binaries(), 186 install : get_option('install-intel-clc'), 187 ) 188 dep_prog_intel_clc = [prog_intel_clc] 189endif 190 191if with_tests 192 test( 193 'intel_compiler_brw_tests', 194 executable( 195 'intel_compiler_brw_tests', 196 files( 197 'test_eu_compact.cpp', 198 'test_eu_validate.cpp', 199 'test_fs_cmod_propagation.cpp', 200 'test_fs_combine_constants.cpp', 201 'test_fs_copy_propagation.cpp', 202 'test_fs_cse.cpp', 203 'test_fs_saturate_propagation.cpp', 204 'test_fs_scoreboard.cpp', 205 'test_simd_selection.cpp', 206 'test_vf_float_conversions.cpp', 207 ), 208 ir_expression_operation_h, 209 include_directories : [inc_include, inc_src, inc_intel], 210 link_with : libisl, 211 dependencies : [idep_gtest, idep_nir, idep_mesautil, idep_intel_dev, 212 idep_intel_compiler_brw], 213 ), 214 suite : ['intel'], 215 protocol : 'gtest', 216 ) 217endif 218 219if with_intel_tools 220 221bison_command = [] 222if yacc_is_bison 223 bison_command = [ 224 prog_bison, '@INPUT@', '--defines=@OUTPUT1@', 225 '--output=@OUTPUT0@' 226 ] 227else 228 bison_command = [ 229 prog_bison, '-H', '@OUTPUT1@', 230 '-o', '@OUTPUT0@', '@INPUT@' 231 ] 232endif 233 234brw_gram_tab = custom_target( 235 'brw_gram.tab.[ch]', 236 input : 'brw_gram.y', 237 output : ['brw_gram.tab.c', 'brw_gram.tab.h'], 238 command : bison_command 239) 240 241brw_lex_yy_c = custom_target( 242 'brw_lex.yy.c', 243 input : 'brw_lex.l', 244 output : 'brw_lex.yy.c', 245 command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'] 246) 247 248brw_asm_deps = [ 249 dep_thread, 250 idep_intel_compiler_brw, 251 idep_intel_dev, 252 idep_mesautil, 253] 254 255brw_asm = static_library( 256 'brw_asm', 257 ['brw_asm.c', brw_gram_tab[0], brw_gram_tab[1], brw_lex_yy_c], 258 dependencies : brw_asm_deps, 259 include_directories : [inc_include, inc_src, inc_intel], 260 c_args : [no_override_init_args], 261 gnu_symbol_visibility : 'hidden', 262 build_by_default : false, 263) 264 265idep_brw_asm = declare_dependency( 266 link_with : brw_asm, 267 dependencies : brw_asm_deps, 268) 269 270brw_asm_tool = executable( 271 'brw_asm', 272 ['brw_asm_tool.c'], 273 dependencies : idep_brw_asm, 274 include_directories : [inc_include, inc_src, inc_intel], 275 c_args : [no_override_init_args], 276 gnu_symbol_visibility : 'hidden', 277 install : true 278) 279 280asm_testcases = [ 281 ['skl', 'gfx9'], 282 ['icl', 'gfx11'], 283 ['tgl', 'gfx12'], 284 ['dg2', 'gfx12.5'], 285] 286 287test_runner = find_program('tests/run-test.py') 288foreach testcase : asm_testcases 289 _gen_name = testcase[0] 290 _gen_num = testcase[1] 291 _gen_folder = join_paths(meson.current_source_dir(), 'tests', 292 _gen_num.replace('gfx', 'gen')) 293 test( 294 'brw_asm_' + _gen_num, test_runner, 295 args : [ 296 '--brw_asm', brw_asm_tool, 297 '--gen_name', _gen_name, 298 '--gen_folder', _gen_folder, 299 ], 300 suite : 'intel', 301 ) 302endforeach 303 304brw_disasm_tool = executable( 305 'brw_disasm', 306 files('brw_disasm_tool.c'), 307 dependencies : [idep_mesautil, dep_thread, idep_intel_dev, 308 idep_intel_compiler_brw], 309 include_directories : [inc_include, inc_src, inc_intel], 310 c_args : [no_override_init_args], 311 gnu_symbol_visibility : 'hidden', 312 install : true 313) 314 315endif 316 317subdir('elk') 318