From eb54b8c222e6ac7d81a3efde1dfed58b33c6a601 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 12 Jul 2019 17:32:18 -0400 Subject: [PATCH] ac: create the LLVM module for Wave32 or Wave64 in ac_llvm_context_init Reviewed-by: Samuel Pitoiset --- src/amd/common/ac_llvm_build.c | 5 ++++- src/amd/common/ac_llvm_build.h | 2 ++ src/amd/vulkan/radv_nir_to_llvm.c | 6 ++---- src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 1551df0..4465acb 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 588ef24..9efd755 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 a18718e..0c739e1 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 9a9f3d6..3de720c 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) ? -- 2.7.4