radeonsi/gfx10: don't declare any LDS for NGG if it's not used

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
Marek Olšák 2019-12-16 19:00:00 -05:00
parent 65e5c1942a
commit 17164d4e27
2 changed files with 21 additions and 6 deletions

View file

@ -6141,16 +6141,19 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
* Add an extra dword per vertex to ensure an odd stride, which
* avoids bank conflicts for SoA accesses.
*/
declare_esgs_ring(ctx);
if (!gfx10_is_ngg_passthrough(shader))
declare_esgs_ring(ctx);
/* This is really only needed when streamout and / or vertex
* compaction is enabled.
*/
LLVMTypeRef asi32 = LLVMArrayType(ctx->i32, 8);
ctx->gs_ngg_scratch = LLVMAddGlobalInAddressSpace(ctx->ac.module,
asi32, "ngg_scratch", AC_ADDR_SPACE_LDS);
LLVMSetInitializer(ctx->gs_ngg_scratch, LLVMGetUndef(asi32));
LLVMSetAlignment(ctx->gs_ngg_scratch, 4);
if (sel->so.num_outputs && !ctx->gs_ngg_scratch) {
LLVMTypeRef asi32 = LLVMArrayType(ctx->i32, 8);
ctx->gs_ngg_scratch = LLVMAddGlobalInAddressSpace(ctx->ac.module,
asi32, "ngg_scratch", AC_ADDR_SPACE_LDS);
LLVMSetInitializer(ctx->gs_ngg_scratch, LLVMGetUndef(asi32));
LLVMSetAlignment(ctx->gs_ngg_scratch, 4);
}
}
/* For GFX9 merged shaders:

View file

@ -785,6 +785,18 @@ si_get_main_shader_part(struct si_shader_selector *sel,
return &sel->main_shader_part;
}
static inline bool
gfx10_is_ngg_passthrough(struct si_shader *shader)
{
struct si_shader_selector *sel = shader->selector;
return sel->type != PIPE_SHADER_GEOMETRY &&
!sel->so.num_outputs &&
!sel->info.writes_edgeflag &&
(sel->type != PIPE_SHADER_VERTEX ||
!shader->key.mono.u.vs_export_prim_id);
}
static inline bool
si_shader_uses_bindless_samplers(struct si_shader_selector *selector)
{