ac/nir: count the scratch private memory size
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 1 Mar 2018 21:12:55 +0000 (22:12 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 6 Mar 2018 09:38:40 +0000 (10:38 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_nir_to_llvm.h

index 39d92ca0e0a9532e402e1406794bc1c881f1702a..ea51c3a54a9469d2788806e213d0dfeab469c03d 100644 (file)
@@ -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)
index eea393a9c24f9e49bed57514a5dbf7c824476392..870e7f8988cab8086f6e8984fd04192528a7272b 100644 (file)
@@ -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 {