From 7f6b91c9c36354b5478e86494d3ebae689f1b509 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 1 Mar 2018 22:12:55 +0100 Subject: ac/nir: count the scratch private memory size Signed-off-by: Samuel Pitoiset Reviewed-by: Dave Airlie --- src/amd/common/ac_nir_to_llvm.c | 10 ++++++++-- src/amd/common/ac_nir_to_llvm.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/amd/common') diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 39d92ca0e0a..ea51c3a54a9 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -6800,7 +6800,8 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, struct nir_shader *const *shaders, int shader_count, struct ac_shader_variant_info *shader_info, - const struct ac_nir_compiler_options *options) + const struct ac_nir_compiler_options *options, + bool dump_shader) { struct radv_shader_context ctx = {0}; unsigned i; @@ -6967,6 +6968,11 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, if (shader_count == 1) ac_nir_eliminate_const_vs_outputs(&ctx); + if (dump_shader) { + ctx.shader_info->private_mem_vgprs = + ac_count_scratch_private_memory(ctx.main_function); + } + return ctx.ac.module; } @@ -7160,7 +7166,7 @@ void ac_compile_nir_shader(LLVMTargetMachineRef tm, { LLVMModuleRef llvm_module = ac_translate_nir_to_llvm(tm, nir, nir_count, shader_info, - options); + options, dump_shader); ac_compile_llvm_module(tm, llvm_module, binary, config, shader_info, nir[0]->info.stage, dump_shader, options->supports_spill); for (int i = 0; i < nir_count; ++i) diff --git a/src/amd/common/ac_nir_to_llvm.h b/src/amd/common/ac_nir_to_llvm.h index eea393a9c24..870e7f8988c 100644 --- a/src/amd/common/ac_nir_to_llvm.h +++ b/src/amd/common/ac_nir_to_llvm.h @@ -163,6 +163,7 @@ struct ac_shader_variant_info { unsigned num_user_sgprs; unsigned num_input_sgprs; unsigned num_input_vgprs; + unsigned private_mem_vgprs; bool need_indirect_descriptor_sets; struct { struct { -- cgit v1.2.3