Module: Mesa
Branch: master
Commit: 7f6b91c9c36354b5478e86494d3ebae689f1b509
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f6b91c9c36354b5478e86494d3ebae689f1b509

Author: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Date:   Thu Mar  1 22:12:55 2018 +0100

ac/nir: count the scratch private memory size

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Reviewed-by: Dave Airlie <airl...@redhat.com>

---

 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(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 39d92ca0e0..ea51c3a54a 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 eea393a9c2..870e7f8988 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 {

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to