• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2017 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21intel_nir_files = files(
22  'intel_nir.h',
23  'intel_nir.c',
24
25  'intel_nir_blockify_uniform_loads.c',
26  'intel_nir_clamp_image_1d_2d_array_sizes.c',
27  'intel_nir_clamp_per_vertex_loads.c',
28  'intel_nir_lower_conversions.c',
29  'intel_nir_lower_non_uniform_barycentric_at_sample.c',
30  'intel_nir_lower_non_uniform_resource_intel.c',
31  'intel_nir_lower_shading_rate_output.c',
32  'intel_nir_lower_sparse.c',
33  'intel_nir_lower_texture.c',
34  'intel_nir_opt_peephole_ffma.c',
35  'intel_nir_opt_peephole_imul32x16.c',
36  'intel_nir_tcs_workarounds.c',
37)
38
39libintel_compiler_brw_files = files(
40  'brw_cfg.cpp',
41  'brw_cfg.h',
42  'brw_compile_gs.cpp',
43  'brw_compile_tcs.cpp',
44  'brw_compile_vs.cpp',
45  'brw_compiler.c',
46  'brw_compiler.h',
47  'brw_dead_control_flow.cpp',
48  'brw_dead_control_flow.h',
49  'brw_debug_recompile.c',
50  'brw_disasm.c',
51  'brw_disasm_info.c',
52  'brw_disasm_info.h',
53  'brw_eu.c',
54  'brw_eu_compact.c',
55  'brw_eu_defines.h',
56  'brw_eu_emit.c',
57  'brw_eu.h',
58  'brw_eu_util.c',
59  'brw_eu_validate.c',
60  'brw_fs_bank_conflicts.cpp',
61  'brw_fs_builder.h',
62  'brw_fs_cmod_propagation.cpp',
63  'brw_fs_combine_constants.cpp',
64  'brw_fs_copy_propagation.cpp',
65  'brw_fs.cpp',
66  'brw_fs_cse.cpp',
67  'brw_fs_dead_code_eliminate.cpp',
68  'brw_fs_generator.cpp',
69  'brw_fs.h',
70  'brw_fs_live_variables.cpp',
71  'brw_fs_live_variables.h',
72  'brw_fs_lower.cpp',
73  'brw_fs_lower_dpas.cpp',
74  'brw_fs_lower_integer_multiplication.cpp',
75  'brw_fs_lower_pack.cpp',
76  'brw_fs_lower_regioning.cpp',
77  'brw_fs_lower_simd_width.cpp',
78  'brw_fs_nir.cpp',
79  'brw_fs_opt.cpp',
80  'brw_fs_opt_algebraic.cpp',
81  'brw_fs_opt_virtual_grfs.cpp',
82  'brw_fs_reg_allocate.cpp',
83  'brw_fs_register_coalesce.cpp',
84  'brw_fs_saturate_propagation.cpp',
85  'brw_fs_scoreboard.cpp',
86  'brw_fs_sel_peephole.cpp',
87  'brw_fs_thread_payload.cpp',
88  'brw_fs_validate.cpp',
89  'brw_fs_visitor.cpp',
90  'brw_fs_workaround.cpp',
91  'brw_inst.h',
92  'brw_ir.h',
93  'brw_ir_allocator.h',
94  'brw_ir_analysis.h',
95  'brw_ir_fs.h',
96  'brw_ir_performance.h',
97  'brw_ir_performance.cpp',
98  'brw_isa_info.h',
99  'brw_lower_logical_sends.cpp',
100  'brw_mesh.cpp',
101  'brw_nir.h',
102  'brw_nir.c',
103  'brw_nir_analyze_ubo_ranges.c',
104  'brw_nir_lower_cooperative_matrix.c',
105  'brw_nir_lower_cs_intrinsics.c',
106  'brw_nir_lower_alpha_to_coverage.c',
107  'brw_nir_lower_intersection_shader.c',
108  'brw_nir_lower_ray_queries.c',
109  'brw_nir_lower_rt_intrinsics.c',
110  'brw_nir_lower_shader_calls.c',
111  'brw_nir_lower_storage_image.c',
112  'brw_nir_rt.h',
113  'brw_nir_rt.c',
114  'brw_nir_rt_builder.h',
115  'brw_packed_float.c',
116  'brw_predicated_break.cpp',
117  'brw_prim.h',
118  'brw_private.h',
119  'brw_reg.h',
120  'brw_reg_type.c',
121  'brw_reg_type.h',
122  'brw_rt.h',
123  'brw_schedule_instructions.cpp',
124  'brw_shader.cpp',
125  'brw_shader.h',
126  'brw_simd_selection.cpp',
127  'brw_vue_map.c',
128)
129
130brw_device_sha1_gen_src = custom_target('brw_device_sha1_gen.c',
131                                        input : ['brw_device_sha1_gen_c.py', '../dev/intel_device_info.py'],
132                                        output : ['brw_device_sha1_gen.c'],
133                                        command : [prog_python, '@INPUT0@', '--outdir', meson.current_build_dir()])
134
135
136brw_nir_trig = custom_target(
137  'brw_nir_trig_workarounds.c',
138  input : 'brw_nir_trig_workarounds.py',
139  output : 'brw_nir_trig_workarounds.c',
140  command : [
141    prog_python, '@INPUT@', '-p', dir_compiler_nir,
142  ],
143  depend_files : nir_algebraic_depends,
144  capture : true,
145)
146
147libintel_compiler_brw = static_library(
148  'intel_compiler',
149  [libintel_compiler_brw_files, intel_nir_files, brw_nir_trig, ir_expression_operation_h, [brw_device_sha1_gen_src]],
150  include_directories : [inc_include, inc_src, inc_intel],
151  c_args : [no_override_init_args],
152  gnu_symbol_visibility : 'hidden',
153  dependencies : [idep_nir_headers, idep_mesautil, idep_intel_dev],
154  build_by_default : false,
155)
156
157# For now this tool is only going to be used by Anv
158if get_option('intel-clc') == 'system'
159  prog_intel_clc = find_program('intel_clc', native : true)
160  dep_prog_intel_clc = []
161elif with_intel_clc
162  prog_intel_clc = executable(
163    'intel_clc',
164    [
165      'intel_clc.c',
166      'brw_kernel.c',
167
168      # Use just the nir_options part of ELK instead of fully linking.
169      'elk/elk_nir_options.h',
170      'elk/elk_nir_options.c',
171    ],
172    link_with : [
173      libintel_compiler_brw, libintel_common,libisl,
174    ],
175    include_directories : [inc_include, inc_src, inc_intel],
176    c_args : [pre_args, no_override_init_args],
177    link_args : [ld_args_build_id],
178    dependencies : [idep_nir, idep_vtn, idep_mesaclc, idep_mesautil, idep_intel_dev],
179    native : true,
180    install : get_option('install-intel-clc'),
181  )
182  dep_prog_intel_clc = [prog_intel_clc]
183endif
184
185if with_tests
186  test(
187    'intel_compiler_brw_tests',
188    executable(
189      'intel_compiler_brw_tests',
190      files(
191        'test_predicated_break.cpp',
192        'test_eu_compact.cpp',
193        'test_eu_validate.cpp',
194        'test_fs_cmod_propagation.cpp',
195        'test_fs_combine_constants.cpp',
196        'test_fs_copy_propagation.cpp',
197        'test_fs_saturate_propagation.cpp',
198        'test_fs_scoreboard.cpp',
199        'test_simd_selection.cpp',
200        'test_vf_float_conversions.cpp',
201      ),
202      ir_expression_operation_h,
203      include_directories : [inc_include, inc_src, inc_intel],
204      link_with : [
205        libintel_compiler_brw, libintel_common, libisl
206      ],
207      dependencies : [idep_gtest, idep_nir, idep_mesautil, idep_intel_dev],
208    ),
209    suite : ['intel'],
210    protocol : 'gtest',
211  )
212endif
213
214if with_intel_tools
215
216bison_command = []
217if yacc_is_bison
218  bison_command = [
219    prog_bison, '@INPUT@', '--defines=@OUTPUT1@',
220    '--output=@OUTPUT0@'
221  ]
222else
223  bison_command = [
224    prog_bison, '-H', '@OUTPUT1@',
225    '-o', '@OUTPUT0@', '@INPUT@'
226  ]
227endif
228
229brw_gram_tab = custom_target(
230  'brw_gram.tab.[ch]',
231  input : 'brw_gram.y',
232  output : ['brw_gram.tab.c', 'brw_gram.tab.h'],
233  command : bison_command
234)
235
236brw_lex_yy_c = custom_target(
237  'brw_lex.yy.c',
238  input : 'brw_lex.l',
239  output : 'brw_lex.yy.c',
240  command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@']
241)
242
243brw_asm_tool = executable(
244  'brw_asm',
245  ['brw_asm_tool.c', brw_gram_tab[0], brw_gram_tab[1], brw_lex_yy_c],
246  dependencies : [idep_mesautil, dep_thread, idep_intel_dev],
247  include_directories : [inc_include, inc_src, inc_intel],
248  link_with : [libintel_common, libintel_compiler_brw],
249  c_args : [no_override_init_args],
250  gnu_symbol_visibility : 'hidden',
251  install : true
252)
253
254asm_testcases = [
255  ['skl', 'gfx9'],
256  ['icl', 'gfx11'],
257  ['tgl', 'gfx12'],
258  ['dg2', 'gfx12.5'],
259]
260
261test_runner = find_program('tests/run-test.py')
262foreach testcase : asm_testcases
263  _gen_name = testcase[0]
264  _gen_num = testcase[1]
265  _gen_folder = join_paths(meson.current_source_dir(), 'tests',
266                           _gen_num.replace('gfx', 'gen'))
267  test(
268    'brw_asm_' + _gen_num, test_runner,
269    args : [
270      '--brw_asm', brw_asm_tool,
271      '--gen_name', _gen_name,
272      '--gen_folder', _gen_folder,
273    ],
274    suite : 'intel',
275  )
276endforeach
277
278brw_disasm_tool = executable(
279  'brw_disasm',
280  files('brw_disasm_tool.c'),
281  dependencies : [idep_mesautil, dep_thread, idep_intel_dev],
282  include_directories : [inc_include, inc_src, inc_intel],
283  link_with : [libintel_common, libintel_compiler_brw],
284  c_args : [no_override_init_args],
285  gnu_symbol_visibility : 'hidden',
286  install : true
287)
288
289endif
290
291subdir('elk')
292