From: Marek Olšák Date: Fri, 12 Jul 2019 21:32:18 +0000 (-0400) Subject: ac: create the LLVM module for Wave32 or Wave64 in ac_llvm_context_init X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb54b8c222e6ac7d81a3efde1dfed58b33c6a601;p=mesa.git ac: create the LLVM module for Wave32 or Wave64 in ac_llvm_context_init Reviewed-by: Samuel Pitoiset --- diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 1551df07959..4465acbd0ad 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -58,6 +58,7 @@ struct ac_llvm_flow { */ void ac_llvm_context_init(struct ac_llvm_context *ctx, + struct ac_llvm_compiler *compiler, enum chip_class chip_class, enum radeon_family family, unsigned wave_size) { @@ -68,7 +69,9 @@ ac_llvm_context_init(struct ac_llvm_context *ctx, ctx->chip_class = chip_class; ctx->family = family; ctx->wave_size = wave_size; - ctx->module = NULL; + ctx->module = ac_create_module(wave_size == 32 ? compiler->tm_wave32 + : compiler->tm, + ctx->context); ctx->builder = NULL; ctx->voidt = LLVMVoidTypeInContext(ctx->context); diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 588ef242c20..9efd755b90b 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -48,6 +48,7 @@ enum { #define AC_WAIT_VSTORE (1 << 2) /* VMEM store instructions */ struct ac_llvm_flow; +struct ac_llvm_compiler; struct ac_llvm_context { LLVMContextRef context; @@ -110,6 +111,7 @@ struct ac_llvm_context { void ac_llvm_context_init(struct ac_llvm_context *ctx, + struct ac_llvm_compiler *compiler, enum chip_class chip_class, enum radeon_family family, unsigned wave_size); diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index a18718ef081..0c739e1ebd9 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -4319,9 +4319,8 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, ctx.options = options; ctx.shader_info = shader_info; - ac_llvm_context_init(&ctx.ac, options->chip_class, options->family, 64); + ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, options->family, 64); ctx.context = ctx.ac.context; - ctx.ac.module = ac_create_module(ac_llvm->tm, ctx.context); enum ac_float_mode float_mode = options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH : @@ -4838,9 +4837,8 @@ radv_compile_gs_copy_shader(struct ac_llvm_compiler *ac_llvm, ctx.options = options; ctx.shader_info = shader_info; - ac_llvm_context_init(&ctx.ac, options->chip_class, options->family, 64); + ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, options->family, 64); ctx.context = ctx.ac.context; - ctx.ac.module = ac_create_module(ac_llvm->tm, ctx.context); ctx.is_gs_copy_shader = true; diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index 9a9f3d63cc6..3de720c27b8 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -962,8 +962,8 @@ void si_llvm_context_init(struct si_shader_context *ctx, ctx->screen = sscreen; ctx->compiler = compiler; - ac_llvm_context_init(&ctx->ac, sscreen->info.chip_class, sscreen->info.family, 64); - ctx->ac.module = ac_create_module(compiler->tm, ctx->ac.context); + ac_llvm_context_init(&ctx->ac, compiler, sscreen->info.chip_class, + sscreen->info.family, 64); enum ac_float_mode float_mode = sscreen->debug_flags & DBG(UNSAFE_MATH) ?