diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index 208b8845bf4..d8f8afb6a4e 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -24,7 +24,7 @@ struct radv_shader_context { struct ac_llvm_context ac; const struct nir_shader *shader; struct ac_shader_abi abi; - const struct radv_nir_compiler_options *options; + const struct radv_llvm_compiler_options *options; const struct radv_shader_info *shader_info; const struct radv_shader_args *args; @@ -44,7 +44,7 @@ radv_shader_context_from_abi(struct ac_shader_abi *abi) static struct ac_llvm_pointer create_llvm_function(struct ac_llvm_context *ctx, LLVMModuleRef module, LLVMBuilderRef builder, const struct ac_shader_args *args, enum ac_llvm_calling_convention convention, - unsigned max_workgroup_size, const struct radv_nir_compiler_options *options) + unsigned max_workgroup_size, const struct radv_llvm_compiler_options *options) { struct ac_llvm_pointer main_function = ac_build_main(args, ctx, convention, "main", ctx->voidt, module); @@ -181,7 +181,7 @@ ac_llvm_finalize_module(struct radv_shader_context *ctx, struct ac_midend_optimi } static LLVMModuleRef -ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, const struct radv_nir_compiler_options *options, +ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, const struct radv_llvm_compiler_options *options, const struct radv_shader_info *info, struct nir_shader *const *shaders, int shader_count, const struct radv_shader_args *args) { @@ -237,7 +237,7 @@ ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, const struct radv_nir ctx.abi.load_ssbo = radv_load_ssbo; ctx.abi.load_sampler_desc = radv_get_sampler_desc; ctx.abi.clamp_shadow_reference = false; - ctx.abi.robust_buffer_access = options->robust_buffer_access_llvm; + ctx.abi.robust_buffer_access = options->robust_buffer_access; bool is_ngg = is_pre_gs_stage(shaders[0]->info.stage) && info->is_ngg; if (shader_count >= 2 || is_ngg) @@ -351,7 +351,7 @@ radv_llvm_compile(LLVMModuleRef M, char **pelf_buffer, size_t *pelf_size, struct static void ac_compile_llvm_module(struct ac_llvm_compiler *ac_llvm, LLVMModuleRef llvm_module, struct radv_shader_binary **rbinary, - const char *name, const struct radv_nir_compiler_options *options) + const char *name, const struct radv_llvm_compiler_options *options) { char *elf_buffer = NULL; size_t elf_size = 0; @@ -397,7 +397,7 @@ ac_compile_llvm_module(struct ac_llvm_compiler *ac_llvm, LLVMModuleRef llvm_modu } static void -radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm, const struct radv_nir_compiler_options *options, +radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm, const struct radv_llvm_compiler_options *options, const struct radv_shader_info *info, struct radv_shader_binary **rbinary, const struct radv_shader_args *args, struct nir_shader *const *nir, int nir_count) { @@ -411,7 +411,7 @@ radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm, const struct radv_nir_ } void -llvm_compile_shader(const struct radv_nir_compiler_options *options, const struct radv_shader_info *info, +llvm_compile_shader(const struct radv_llvm_compiler_options *options, const struct radv_shader_info *info, unsigned shader_count, struct nir_shader *const *shaders, struct radv_shader_binary **binary, const struct radv_shader_args *args) { diff --git a/src/amd/vulkan/radv_nir_to_llvm.h b/src/amd/vulkan/radv_nir_to_llvm.h index 8397f11f305..997b9dde44d 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.h +++ b/src/amd/vulkan/radv_nir_to_llvm.h @@ -11,13 +11,13 @@ #ifndef RADV_NIR_TO_LLVM_H #define RADV_NIR_TO_LLVM_H -struct radv_nir_compiler_options; +struct radv_llvm_compiler_options; struct radv_shader_info; struct nir_shader; struct radv_shader_binary; struct radv_shader_args; -void llvm_compile_shader(const struct radv_nir_compiler_options *options, const struct radv_shader_info *info, +void llvm_compile_shader(const struct radv_llvm_compiler_options *options, const struct radv_shader_info *info, unsigned shader_count, struct nir_shader *const *shaders, struct radv_shader_binary **binary, const struct radv_shader_args *args); diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 65982c7c439..efcbd15efeb 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -3273,26 +3273,20 @@ radv_aco_build_shader_binary(void **bin, const struct ac_shader_config *config, } static void -radv_fill_nir_compiler_options(const struct radv_compiler_info *compiler_info, - struct radv_nir_compiler_options *options, - const struct radv_graphics_state_key *gfx_state, bool should_use_wgp, - bool can_dump_shader, bool keep_shader_info, bool keep_statistic_info) +radv_fill_llvm_compiler_options(struct radv_llvm_compiler_options *options, + const struct radv_compiler_info *compiler_info, bool should_use_wgp, + bool can_dump_shader, bool keep_shader_info) { options->compiler_info = compiler_info->ac; - options->gfx_level = compiler_info->ac->gfx_level; options->family = compiler_info->hw.family; options->address32_hi = compiler_info->hw.address32_hi; /* robust_buffer_access_llvm here used by LLVM only, pipeline robustness is not exposed there. */ - options->robust_buffer_access_llvm = compiler_info->key.robust_buffer_access; + options->robust_buffer_access = compiler_info->key.robust_buffer_access; options->wgp_mode = should_use_wgp; options->dump_shader = can_dump_shader; - options->dump_ir = options->dump_shader && compiler_info->debug.dump_backend_ir; options->dump_preoptir = options->dump_shader && compiler_info->debug.dump_preopt_ir; - options->record_asm = keep_shader_info || options->dump_shader; options->record_ir = keep_shader_info; - options->record_stats = keep_statistic_info; options->check_ir = compiler_info->debug.check_ir; - options->enable_mrt_output_nan_fixup = gfx_state ? gfx_state->ps.epilog.enable_mrt_output_nan_fixup : false; } static inline void @@ -3350,9 +3344,8 @@ radv_shader_nir_to_asm(const struct radv_compiler_info *compiler_info, struct ra ac_init_llvm_once(); if (compiler_info->key.use_llvm) { - struct radv_nir_compiler_options options = {0}; - radv_fill_nir_compiler_options(compiler_info, &options, gfx_state, wgp_mode, dump_shader, keep_shader_info, - keep_statistic_info); + struct radv_llvm_compiler_options options = {0}; + radv_fill_llvm_compiler_options(&options, compiler_info, wgp_mode, dump_shader, keep_shader_info); llvm_compile_shader(&options, info, shader_count, shaders, &binary, args); #else diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index a7fb4ae8a7e..bd9355675eb 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -190,26 +190,16 @@ struct radv_graphics_pipeline_key { struct radv_shader_stage_key stage_info[MESA_VULKAN_SHADER_STAGES]; }; -struct radv_nir_compiler_options { +struct radv_llvm_compiler_options { const struct ac_compiler_info *compiler_info; - enum amd_gfx_level gfx_level; enum radeon_family family; uint32_t address32_hi; - bool robust_buffer_access_llvm; + bool robust_buffer_access; bool dump_shader; - bool dump_ir; bool dump_preoptir; - bool record_asm; bool record_ir; - bool record_stats; bool check_ir; - uint8_t enable_mrt_output_nan_fixup; bool wgp_mode; - - struct { - void (*func)(void *private_data, enum aco_compiler_debug_level level, const char *message); - void *private_data; - } debug; }; #define SET_SGPR_FIELD(field, value) (((unsigned)(value) & field##__MASK) << field##__SHIFT)