radeonsi: use an explicit symbol for the LSHS LDS memory

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle 2019-05-04 12:34:52 +02:00 committed by Marek Olšák
parent 174fad7075
commit 33be5ad8a3
2 changed files with 20 additions and 2 deletions

View file

@ -4925,8 +4925,21 @@ static void create_function(struct si_shader_context *ctx)
assert(shader->info.num_input_vgprs >= num_prolog_vgprs);
shader->info.num_input_vgprs -= num_prolog_vgprs;
if (shader->key.as_ls || ctx->type == PIPE_SHADER_TESS_CTRL)
ac_declare_lds_as_pointer(&ctx->ac);
if (shader->key.as_ls || ctx->type == PIPE_SHADER_TESS_CTRL) {
if (USE_LDS_SYMBOLS && HAVE_LLVM >= 0x0900) {
/* The LSHS size is not known until draw time, so we append it
* at the end of whatever LDS use there may be in the rest of
* the shader (currently none, unless LLVM decides to do its
* own LDS-based lowering).
*/
ctx->ac.lds = LLVMAddGlobalInAddressSpace(
ctx->ac.module, LLVMArrayType(ctx->i32, 0),
"__lds_end", AC_ADDR_SPACE_LDS);
LLVMSetAlignment(ctx->ac.lds, 256);
} else {
ac_declare_lds_as_pointer(&ctx->ac);
}
}
}
/**

View file

@ -252,6 +252,11 @@ static void si_emit_derived_tess_state(struct si_context *sctx,
C_VS_STATE_LS_OUT_VERTEX_SIZE;
sctx->current_vs_state |= tcs_in_layout;
/* We should be able to support in-shader LDS use with LLVM >= 9
* by just adding the lds_sizes together, but it has never
* been tested. */
assert(ls_current->config.lds_size == 0);
if (sctx->chip_class >= GFX9) {
unsigned hs_rsrc2 = ls_current->config.rsrc2 |
S_00B42C_LDS_SIZE(lds_size);