• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2018 Google
3  *
4  * SPDX-License-Identifier: MIT
5  */
6 
7 #ifndef ACO_INTERFACE_H
8 #define ACO_INTERFACE_H
9 
10 #include "aco_shader_info.h"
11 #include "ac_shader_debug_info.h"
12 
13 #include "nir.h"
14 
15 #include "amd_family.h"
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /* Special launch size to indicate this dispatch is a 1D dispatch converted into a 2D one */
21 #define ACO_RT_CONVERTED_2D_LAUNCH_SIZE -1u
22 
23 struct ac_shader_config;
24 struct aco_shader_info;
25 struct aco_vs_prolog_info;
26 struct aco_ps_epilog_info;
27 struct radeon_info;
28 
29 struct aco_compiler_statistic_info {
30    char name[32];
31    char desc[64];
32 };
33 
34 typedef void(aco_callback)(void** priv_ptr, const struct ac_shader_config* config,
35                            const char* llvm_ir_str, unsigned llvm_ir_size, const char* disasm_str,
36                            unsigned disasm_size, uint32_t* statistics, uint32_t stats_size,
37                            uint32_t exec_size, const uint32_t* code, uint32_t code_dw,
38                            const struct aco_symbol* symbols, unsigned num_symbols,
39                            const struct ac_shader_debug_info* debug_info, unsigned debug_info_count);
40 
41 typedef void(aco_shader_part_callback)(void** priv_ptr, uint32_t num_sgprs, uint32_t num_vgprs,
42                                        const uint32_t* code, uint32_t code_size,
43                                        const char* disasm_str, uint32_t disasm_size);
44 
45 extern const struct aco_compiler_statistic_info* aco_statistic_infos;
46 
47 void aco_compile_shader(const struct aco_compiler_options* options,
48                         const struct aco_shader_info* info, unsigned shader_count,
49                         struct nir_shader* const* shaders, const struct ac_shader_args* args,
50                         aco_callback* build_binary, void** binary);
51 
52 void aco_compile_rt_prolog(const struct aco_compiler_options* options,
53                            const struct aco_shader_info* info, const struct ac_shader_args* in_args,
54                            const struct ac_shader_args* out_args, aco_callback* build_prolog,
55                            void** binary);
56 
57 void aco_compile_vs_prolog(const struct aco_compiler_options* options,
58                            const struct aco_shader_info* info,
59                            const struct aco_vs_prolog_info* prolog_info,
60                            const struct ac_shader_args* args,
61                            aco_shader_part_callback* build_prolog, void** binary);
62 
63 void aco_compile_ps_epilog(const struct aco_compiler_options* options,
64                            const struct aco_shader_info* info,
65                            const struct aco_ps_epilog_info* epilog_info,
66                            const struct ac_shader_args* args,
67                            aco_shader_part_callback* build_epilog, void** binary);
68 
69 void aco_compile_ps_prolog(const struct aco_compiler_options* options,
70                            const struct aco_shader_info* info,
71                            const struct aco_ps_prolog_info* pinfo,
72                            const struct ac_shader_args* args,
73                            aco_shader_part_callback* build_prolog, void** binary);
74 
75 void aco_compile_trap_handler(const struct aco_compiler_options* options,
76                               const struct aco_shader_info* info, const struct ac_shader_args* args,
77                               aco_callback* build_binary, void** binary);
78 
79 uint64_t aco_get_codegen_flags();
80 
81 bool aco_is_gpu_supported(const struct radeon_info* info);
82 
83 bool aco_nir_op_supports_packed_math_16bit(const nir_alu_instr* alu);
84 
85 void aco_print_asm(const struct radeon_info *info, unsigned wave_size,
86                    uint32_t *binary, unsigned num_dw);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif
93