ac/rtld: check correct LDS max size
authorMarek Olšák <marek.olsak@amd.com>
Tue, 21 May 2019 23:17:34 +0000 (19:17 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 20 Jun 2019 00:30:32 +0000 (20:30 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/amd/common/ac_rtld.c
src/amd/common/ac_rtld.h
src/gallium/drivers/radeonsi/si_shader.c

index c750dbfa9cbebd370f0daec7d04af69ea3b64d91..18f198f8af2238b81e4047d131c3b25e82fcb40e 100644 (file)
@@ -280,7 +280,13 @@ bool ac_rtld_open(struct ac_rtld_binary *binary,
        util_dynarray_foreach(&binary->lds_symbols, struct ac_rtld_symbol, symbol)
                symbol->part_idx = ~0u;
 
-       unsigned max_lds_size = i.info->chip_class >= GFX7 ? 64 * 1024 : 32 * 1024;
+       unsigned max_lds_size = 64 * 1024;
+
+       if (i.info->chip_class == GFX6 ||
+           (i.shader_type != MESA_SHADER_COMPUTE &&
+            i.shader_type != MESA_SHADER_FRAGMENT))
+               max_lds_size = 32 * 1024;
+
        uint64_t shared_lds_size = 0;
        if (!layout_symbols(binary->lds_symbols.data, i.num_shared_lds_symbols, &shared_lds_size))
                goto fail;
index b13270b181d43c61afa67bb2137b9db29bd8ca22..3f60444f85e12766046e3ea2dba531e93c73bfcb 100644 (file)
@@ -29,6 +29,7 @@
 #include <stddef.h>
 
 #include "util/u_dynarray.h"
+#include "compiler/shader_enums.h"
 
 struct ac_rtld_part;
 struct ac_shader_config;
@@ -84,6 +85,7 @@ typedef bool (*ac_rtld_get_external_symbol_cb)(
 struct ac_rtld_open_info {
        const struct radeon_info *info;
        struct ac_rtld_options options;
+       gl_shader_stage shader_type;
 
        unsigned num_parts;
        const char * const *elf_ptrs; /* in-memory ELF objects of each part */
index 231cb8c1cd180918f3838a939032a244e5b09656..eb75e2a77a41da7a6b2f046000cc3368779aaa0f 100644 (file)
@@ -28,6 +28,7 @@
 #include "tgsi/tgsi_strings.h"
 #include "tgsi/tgsi_util.h"
 #include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_from_mesa.h"
 
 #include "ac_binary.h"
 #include "ac_exp_param.h"
@@ -5098,6 +5099,7 @@ static bool si_shader_binary_open(struct si_screen *screen,
                                  struct ac_rtld_binary *rtld)
 {
        const struct si_shader_selector *sel = shader->selector;
+       enum pipe_shader_type shader_type = sel ? sel->type : PIPE_SHADER_COMPUTE;
        const char *part_elfs[5];
        size_t part_sizes[5];
        unsigned num_parts = 0;
@@ -5136,6 +5138,7 @@ static bool si_shader_binary_open(struct si_screen *screen,
                        .options = {
                                .halt_at_entry = screen->options.halt_shaders,
                        },
+                       .shader_type = tgsi_processor_to_shader_stage(shader_type),
                        .num_parts = num_parts,
                        .elf_ptrs = part_elfs,
                        .elf_sizes = part_sizes,