ac: create the LLVM module for Wave32 or Wave64 in ac_llvm_context_init

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
Marek Olšák 2019-07-12 17:32:18 -04:00
parent 921c1d24d5
commit eb54b8c222
4 changed files with 10 additions and 7 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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) ?