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_builder.cpp', 25 'brw_builder.h', 26 'brw_cfg.cpp', 27 'brw_cfg.h', 28 'brw_compile_bs.cpp', 29 'brw_compile_cs.cpp', 30 'brw_compile_fs.cpp', 31 'brw_compile_gs.cpp', 32 'brw_compile_mesh.cpp', 33 'brw_compile_tcs.cpp', 34 'brw_compile_tes.cpp', 35 'brw_compile_vs.cpp', 36 'brw_compiler.c', 37 'brw_compiler.h', 38 'brw_debug_recompile.c', 39 'brw_def_analysis.cpp', 40 'brw_disasm.c', 41 'brw_disasm_info.cpp', 42 'brw_disasm_info.h', 43 'brw_eu.c', 44 'brw_eu_compact.c', 45 'brw_eu_defines.h', 46 'brw_eu_emit.c', 47 'brw_eu_inst.h', 48 'brw_eu.h', 49 'brw_eu_validate.c', 50 'brw_fs.cpp', 51 'brw_fs.h', 52 'brw_fs_live_variables.cpp', 53 'brw_fs_live_variables.h', 54 'brw_fs_nir.cpp', 55 'brw_fs_thread_payload.cpp', 56 'brw_fs_visitor.cpp', 57 'brw_generator.cpp', 58 'brw_generator.h', 59 'brw_ir.h', 60 'brw_ir_allocator.h', 61 'brw_ir_analysis.h', 62 'brw_ir_fs.h', 63 'brw_ir_performance.h', 64 'brw_ir_performance.cpp', 65 'brw_isa_info.h', 66 'brw_lower.cpp', 67 'brw_lower_dpas.cpp', 68 'brw_lower_integer_multiplication.cpp', 69 'brw_lower_logical_sends.cpp', 70 'brw_lower_pack.cpp', 71 'brw_lower_regioning.cpp', 72 'brw_lower_scoreboard.cpp', 73 'brw_lower_simd_width.cpp', 74 'brw_lower_subgroup_ops.cpp', 75 'brw_nir.h', 76 'brw_nir.c', 77 'brw_nir_analyze_ubo_ranges.c', 78 'brw_nir_lower_cooperative_matrix.c', 79 'brw_nir_lower_cs_intrinsics.c', 80 'brw_nir_lower_alpha_to_coverage.c', 81 'brw_nir_lower_intersection_shader.c', 82 'brw_nir_lower_ray_queries.c', 83 'brw_nir_lower_rt_intrinsics.c', 84 'brw_nir_lower_shader_calls.c', 85 'brw_nir_lower_storage_image.c', 86 'brw_nir_opt_fsat.c', 87 'brw_nir_rt.h', 88 'brw_nir_rt.c', 89 'brw_nir_rt_builder.h', 90 'brw_opt.cpp', 91 'brw_opt_address_reg_load.cpp', 92 'brw_opt_algebraic.cpp', 93 'brw_opt_bank_conflicts.cpp', 94 'brw_opt_cmod_propagation.cpp', 95 'brw_opt_combine_constants.cpp', 96 'brw_opt_copy_propagation.cpp', 97 'brw_opt_cse.cpp', 98 'brw_opt_dead_code_eliminate.cpp', 99 'brw_opt_register_coalesce.cpp', 100 'brw_opt_saturate_propagation.cpp', 101 'brw_opt_txf_combiner.cpp', 102 'brw_opt_virtual_grfs.cpp', 103 'brw_packed_float.c', 104 'brw_print.cpp', 105 'brw_prim.h', 106 'brw_private.h', 107 'brw_reg.cpp', 108 'brw_reg.h', 109 'brw_reg_allocate.cpp', 110 'brw_reg_type.c', 111 'brw_reg_type.h', 112 'brw_rt.h', 113 'brw_schedule_instructions.cpp', 114 'brw_shader.cpp', 115 'brw_simd_selection.cpp', 116 'brw_spirv.c', 117 'brw_validate.cpp', 118 'brw_vue_map.c', 119 'brw_workaround.cpp', 120) 121 122brw_device_sha1_gen_src = custom_target('brw_device_sha1_gen.c', 123 input : ['brw_device_sha1_gen_c.py', '../dev/intel_device_info.py'], 124 output : ['brw_device_sha1_gen.c'], 125 command : [prog_python, '@INPUT0@', '--outdir', meson.current_build_dir()]) 126 127 128brw_nir_lower_fsign = custom_target( 129 'brw_nir_lower_fsign.c', 130 input : 'brw_nir_lower_fsign.py', 131 output : 'brw_nir_lower_fsign.c', 132 command : [ 133 prog_python, '@INPUT@', '-p', dir_compiler_nir, 134 ], 135 depend_files : nir_algebraic_depends, 136 capture : true, 137) 138 139brw_nir_trig = custom_target( 140 'brw_nir_trig_workarounds.c', 141 input : 'brw_nir_trig_workarounds.py', 142 output : 'brw_nir_trig_workarounds.c', 143 command : [ 144 prog_python, '@INPUT@', '-p', dir_compiler_nir, 145 ], 146 depend_files : nir_algebraic_depends, 147 capture : true, 148) 149 150libintel_compiler_brw = static_library( 151 'intel_compiler', 152 [libintel_compiler_brw_files, intel_nir_files, brw_nir_lower_fsign, brw_nir_trig, ir_expression_operation_h, [brw_device_sha1_gen_src]], 153 include_directories : [inc_include, inc_src, inc_intel], 154 c_args : [no_override_init_args], 155 gnu_symbol_visibility : 'hidden', 156 dependencies : [idep_nir_headers, idep_mesautil, idep_intel_dev], 157 build_by_default : false, 158) 159 160idep_intel_compiler_brw = declare_dependency( 161 link_with : [libintel_compiler_brw], 162 dependencies : [ 163 idep_nir, 164 idep_mesautil, 165 idep_vtn, 166 ], 167) 168 169# For now this tool is only going to be used by Anv 170if with_intel_bvh_grl 171 if get_option('intel-clc') == 'system' or get_option('precomp-compiler') == 'system' 172 prog_intel_clc = find_program('intel_clc', native : true) 173 dep_prog_intel_clc = [] 174 elif with_intel_clc 175 prog_intel_clc = executable( 176 'intel_clc', 177 [ 178 'intel_clc.c', 179 'brw_kernel.c', 180 181 # Use just the nir_options part of ELK instead of fully linking. 182 'elk/elk_nir_options.h', 183 'elk/elk_nir_options.c', 184 'elk/elk_spirv.c', 185 ], 186 link_with : [libisl], 187 include_directories : [inc_include, inc_src, inc_intel], 188 c_args : [pre_args, no_override_init_args], 189 link_args : [ld_args_build_id], 190 dependencies : [idep_nir, idep_mesaclc, idep_mesautil, idep_intel_dev, 191 idep_intel_compiler_brw], 192 # If we can run host binaries directly, just build intel_clc for the host. 193 # Most commonly this happens when doing a cross compile from an x86_64 build 194 # machine to an x86 host 195 native : not meson.can_run_host_binaries(), 196 install : get_option('install-intel-clc') or get_option('install-precomp-compiler'), 197 ) 198 dep_prog_intel_clc = [prog_intel_clc] 199 endif 200else 201 dep_prog_intel_clc = [] 202endif 203 204if with_tests 205 test( 206 'intel_compiler_brw_tests', 207 executable( 208 'intel_compiler_brw_tests', 209 files( 210 'test_eu_compact.cpp', 211 'test_eu_validate.cpp', 212 'test_lower_scoreboard.cpp', 213 'test_opt_cmod_propagation.cpp', 214 'test_opt_combine_constants.cpp', 215 'test_opt_copy_propagation.cpp', 216 'test_opt_cse.cpp', 217 'test_opt_saturate_propagation.cpp', 218 'test_simd_selection.cpp', 219 'test_vf_float_conversions.cpp', 220 ), 221 ir_expression_operation_h, 222 include_directories : [inc_include, inc_src, inc_intel], 223 link_with : libisl, 224 dependencies : [idep_gtest, idep_nir, idep_mesautil, idep_intel_dev, 225 idep_intel_compiler_brw], 226 ), 227 suite : ['intel'], 228 protocol : 'gtest', 229 ) 230endif 231 232if with_intel_tools 233 234bison_command = [] 235if yacc_is_bison 236 bison_command = [ 237 prog_bison, '@INPUT@', '--defines=@OUTPUT1@', 238 '--output=@OUTPUT0@' 239 ] 240else 241 bison_command = [ 242 prog_bison, '-H', '@OUTPUT1@', 243 '-o', '@OUTPUT0@', '@INPUT@' 244 ] 245endif 246 247brw_gram_tab = custom_target( 248 'brw_gram.tab.[ch]', 249 input : 'brw_gram.y', 250 output : ['brw_gram.tab.c', 'brw_gram.tab.h'], 251 command : bison_command 252) 253 254brw_lex_yy_c = custom_target( 255 'brw_lex.yy.c', 256 input : 'brw_lex.l', 257 output : 'brw_lex.yy.c', 258 command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'] 259) 260 261brw_asm_deps = [ 262 dep_thread, 263 idep_intel_compiler_brw, 264 idep_intel_dev, 265 idep_mesautil, 266] 267 268brw_asm = static_library( 269 'brw_asm', 270 ['brw_asm.c', brw_gram_tab[0], brw_gram_tab[1], brw_lex_yy_c], 271 dependencies : brw_asm_deps, 272 include_directories : [inc_include, inc_src, inc_intel], 273 c_args : [no_override_init_args], 274 gnu_symbol_visibility : 'hidden', 275 build_by_default : false, 276) 277 278idep_brw_asm = declare_dependency( 279 link_with : brw_asm, 280 dependencies : brw_asm_deps, 281) 282 283brw_asm_tool = executable( 284 'brw_asm', 285 ['brw_asm_tool.c'], 286 dependencies : idep_brw_asm, 287 include_directories : [inc_include, inc_src, inc_intel], 288 c_args : [no_override_init_args], 289 gnu_symbol_visibility : 'hidden', 290 install : true 291) 292 293asm_testcases = [ 294 ['skl', 'gfx9'], 295 ['icl', 'gfx11'], 296 ['tgl', 'gfx12'], 297 ['dg2', 'gfx12.5'], 298] 299 300test_runner = find_program('tests/run-test.py') 301foreach testcase : asm_testcases 302 _gen_name = testcase[0] 303 _gen_num = testcase[1] 304 _gen_folder = join_paths(meson.current_source_dir(), 'tests', 305 _gen_num.replace('gfx', 'gen')) 306 test( 307 'brw_asm_' + _gen_num, test_runner, 308 args : [ 309 '--brw_asm', brw_asm_tool, 310 '--gen_name', _gen_name, 311 '--gen_folder', _gen_folder, 312 ], 313 suite : 'intel', 314 ) 315endforeach 316 317brw_disasm_tool = executable( 318 'brw_disasm', 319 files('brw_disasm_tool.c'), 320 dependencies : [idep_mesautil, dep_thread, idep_intel_dev, 321 idep_intel_compiler_brw], 322 include_directories : [inc_include, inc_src, inc_intel], 323 c_args : [no_override_init_args], 324 gnu_symbol_visibility : 'hidden', 325 install : true 326) 327 328endif 329 330if with_intel_elk 331 subdir('elk') 332else 333 idep_intel_compiler_elk = null_dep 334endif 335