1*61046927SAndroid Build Coastguard Worker /* -*- c++ -*- */
2*61046927SAndroid Build Coastguard Worker /*
3*61046927SAndroid Build Coastguard Worker * Copyright © 2021 Intel Corporation
4*61046927SAndroid Build Coastguard Worker *
5*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a
6*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the "Software"),
7*61046927SAndroid Build Coastguard Worker * to deal in the Software without restriction, including without limitation
8*61046927SAndroid Build Coastguard Worker * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9*61046927SAndroid Build Coastguard Worker * and/or sell copies of the Software, and to permit persons to whom the
10*61046927SAndroid Build Coastguard Worker * Software is furnished to do so, subject to the following conditions:
11*61046927SAndroid Build Coastguard Worker *
12*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice (including the next
13*61046927SAndroid Build Coastguard Worker * paragraph) shall be included in all copies or substantial portions of the
14*61046927SAndroid Build Coastguard Worker * Software.
15*61046927SAndroid Build Coastguard Worker *
16*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*61046927SAndroid Build Coastguard Worker * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19*61046927SAndroid Build Coastguard Worker * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*61046927SAndroid Build Coastguard Worker * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21*61046927SAndroid Build Coastguard Worker * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22*61046927SAndroid Build Coastguard Worker * IN THE SOFTWARE.
23*61046927SAndroid Build Coastguard Worker */
24*61046927SAndroid Build Coastguard Worker
25*61046927SAndroid Build Coastguard Worker #ifndef BRW_PRIVATE_H
26*61046927SAndroid Build Coastguard Worker #define BRW_PRIVATE_H
27*61046927SAndroid Build Coastguard Worker
28*61046927SAndroid Build Coastguard Worker #include "brw_compiler.h"
29*61046927SAndroid Build Coastguard Worker
30*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
31*61046927SAndroid Build Coastguard Worker extern "C" {
32*61046927SAndroid Build Coastguard Worker #endif
33*61046927SAndroid Build Coastguard Worker
34*61046927SAndroid Build Coastguard Worker /* brw_fs_reg_allocate.cpp */
35*61046927SAndroid Build Coastguard Worker void brw_fs_alloc_reg_sets(struct brw_compiler *compiler);
36*61046927SAndroid Build Coastguard Worker
37*61046927SAndroid Build Coastguard Worker /* brw_disasm.c */
38*61046927SAndroid Build Coastguard Worker extern const char *const conditional_modifier[16];
39*61046927SAndroid Build Coastguard Worker extern const char *const pred_ctrl_align16[16];
40*61046927SAndroid Build Coastguard Worker
41*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
42*61046927SAndroid Build Coastguard Worker }
43*61046927SAndroid Build Coastguard Worker #endif
44*61046927SAndroid Build Coastguard Worker
45*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
46*61046927SAndroid Build Coastguard Worker
47*61046927SAndroid Build Coastguard Worker #include <variant>
48*61046927SAndroid Build Coastguard Worker
49*61046927SAndroid Build Coastguard Worker unsigned brw_required_dispatch_width(const struct shader_info *info);
50*61046927SAndroid Build Coastguard Worker
51*61046927SAndroid Build Coastguard Worker static constexpr int SIMD_COUNT = 3;
52*61046927SAndroid Build Coastguard Worker
53*61046927SAndroid Build Coastguard Worker struct brw_simd_selection_state {
54*61046927SAndroid Build Coastguard Worker const struct intel_device_info *devinfo;
55*61046927SAndroid Build Coastguard Worker
56*61046927SAndroid Build Coastguard Worker std::variant<struct brw_cs_prog_data *,
57*61046927SAndroid Build Coastguard Worker struct brw_bs_prog_data *> prog_data;
58*61046927SAndroid Build Coastguard Worker
59*61046927SAndroid Build Coastguard Worker unsigned required_width;
60*61046927SAndroid Build Coastguard Worker
61*61046927SAndroid Build Coastguard Worker const char *error[SIMD_COUNT];
62*61046927SAndroid Build Coastguard Worker
63*61046927SAndroid Build Coastguard Worker bool compiled[SIMD_COUNT];
64*61046927SAndroid Build Coastguard Worker bool spilled[SIMD_COUNT];
65*61046927SAndroid Build Coastguard Worker };
66*61046927SAndroid Build Coastguard Worker
brw_simd_first_compiled(const brw_simd_selection_state & state)67*61046927SAndroid Build Coastguard Worker inline int brw_simd_first_compiled(const brw_simd_selection_state &state)
68*61046927SAndroid Build Coastguard Worker {
69*61046927SAndroid Build Coastguard Worker for (int i = 0; i < SIMD_COUNT; i++) {
70*61046927SAndroid Build Coastguard Worker if (state.compiled[i])
71*61046927SAndroid Build Coastguard Worker return i;
72*61046927SAndroid Build Coastguard Worker }
73*61046927SAndroid Build Coastguard Worker return -1;
74*61046927SAndroid Build Coastguard Worker }
75*61046927SAndroid Build Coastguard Worker
brw_simd_any_compiled(const brw_simd_selection_state & state)76*61046927SAndroid Build Coastguard Worker inline bool brw_simd_any_compiled(const brw_simd_selection_state &state)
77*61046927SAndroid Build Coastguard Worker {
78*61046927SAndroid Build Coastguard Worker return brw_simd_first_compiled(state) >= 0;
79*61046927SAndroid Build Coastguard Worker }
80*61046927SAndroid Build Coastguard Worker
81*61046927SAndroid Build Coastguard Worker unsigned brw_geometry_stage_dispatch_width(const struct intel_device_info *devinfo);
82*61046927SAndroid Build Coastguard Worker
83*61046927SAndroid Build Coastguard Worker bool brw_simd_should_compile(brw_simd_selection_state &state, unsigned simd);
84*61046927SAndroid Build Coastguard Worker
85*61046927SAndroid Build Coastguard Worker void brw_simd_mark_compiled(brw_simd_selection_state &state, unsigned simd, bool spilled);
86*61046927SAndroid Build Coastguard Worker
87*61046927SAndroid Build Coastguard Worker int brw_simd_select(const brw_simd_selection_state &state);
88*61046927SAndroid Build Coastguard Worker
89*61046927SAndroid Build Coastguard Worker int brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo,
90*61046927SAndroid Build Coastguard Worker const struct brw_cs_prog_data *prog_data,
91*61046927SAndroid Build Coastguard Worker const unsigned *sizes);
92*61046927SAndroid Build Coastguard Worker
93*61046927SAndroid Build Coastguard Worker bool brw_should_print_shader(const nir_shader *shader, uint64_t debug_flag);
94*61046927SAndroid Build Coastguard Worker
95*61046927SAndroid Build Coastguard Worker #endif // __cplusplus
96*61046927SAndroid Build Coastguard Worker
97*61046927SAndroid Build Coastguard Worker #endif // BRW_PRIVATE_H
98