• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2018 Google
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef ACO_INTERFACE_H
26 #define ACO_INTERFACE_H
27 
28 #include "aco_shader_info.h"
29 
30 #include "nir.h"
31 
32 #include "amd_family.h"
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /* Special launch size to indicate this dispatch is a 1D dispatch converted into a 2D one */
38 #define ACO_RT_CONVERTED_2D_LAUNCH_SIZE -1u
39 
40 struct ac_shader_config;
41 struct aco_shader_info;
42 struct aco_vs_prolog_info;
43 struct aco_ps_epilog_info;
44 struct radeon_info;
45 
46 struct aco_compiler_statistic_info {
47    char name[32];
48    char desc[64];
49 };
50 
51 typedef void(aco_callback)(void** priv_ptr, const struct ac_shader_config* config,
52                            const char* llvm_ir_str, unsigned llvm_ir_size, const char* disasm_str,
53                            unsigned disasm_size, uint32_t* statistics, uint32_t stats_size,
54                            uint32_t exec_size, const uint32_t* code, uint32_t code_dw,
55                            const struct aco_symbol* symbols, unsigned num_symbols);
56 
57 typedef void(aco_shader_part_callback)(void** priv_ptr, uint32_t num_sgprs, uint32_t num_vgprs,
58                                        const uint32_t* code, uint32_t code_size,
59                                        const char* disasm_str, uint32_t disasm_size);
60 
61 extern const struct aco_compiler_statistic_info* aco_statistic_infos;
62 
63 void aco_compile_shader(const struct aco_compiler_options* options,
64                         const struct aco_shader_info* info, unsigned shader_count,
65                         struct nir_shader* const* shaders, const struct ac_shader_args* args,
66                         aco_callback* build_binary, void** binary);
67 
68 void aco_compile_rt_prolog(const struct aco_compiler_options* options,
69                            const struct aco_shader_info* info, const struct ac_shader_args* in_args,
70                            const struct ac_shader_args* out_args, aco_callback* build_prolog,
71                            void** binary);
72 
73 void aco_compile_vs_prolog(const struct aco_compiler_options* options,
74                            const struct aco_shader_info* info,
75                            const struct aco_vs_prolog_info* prolog_info,
76                            const struct ac_shader_args* args,
77                            aco_shader_part_callback* build_prolog, void** binary);
78 
79 void aco_compile_ps_epilog(const struct aco_compiler_options* options,
80                            const struct aco_shader_info* info,
81                            const struct aco_ps_epilog_info* epilog_info,
82                            const struct ac_shader_args* args,
83                            aco_shader_part_callback* build_epilog, void** binary);
84 
85 void aco_compile_tcs_epilog(const struct aco_compiler_options* options,
86                             const struct aco_shader_info* info,
87                             const struct aco_tcs_epilog_info* epilog_info,
88                             const struct ac_shader_args* args,
89                             aco_shader_part_callback* build_epilog, void** binary);
90 
91 void aco_compile_ps_prolog(const struct aco_compiler_options* options,
92                            const struct aco_shader_info* info,
93                            const struct aco_ps_prolog_info* pinfo,
94                            const struct ac_shader_args* args,
95                            aco_shader_part_callback* build_prolog, void** binary);
96 
97 uint64_t aco_get_codegen_flags();
98 
99 bool aco_is_gpu_supported(const struct radeon_info* info);
100 
101 bool aco_nir_op_supports_packed_math_16bit(const nir_alu_instr* alu);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif
108