radeonsi: remove now unused LLVM LDS logic for NGG

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35529>
This commit is contained in:
Marek Olšák 2025-06-13 16:29:38 -04:00 committed by Marge Bot
parent 65c5ee1628
commit 24260644e8
6 changed files with 3 additions and 93 deletions

View file

@ -2773,9 +2773,6 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
result = ac_build_gather_values(&ctx->ac, values, 3);
break;
}
case nir_intrinsic_load_lds_ngg_gs_out_vertex_base_amd:
result = ctx->abi->intrinsic_load(ctx->abi, instr);
break;
case nir_intrinsic_load_helper_invocation:
case nir_intrinsic_is_helper_invocation:
result = ac_build_load_helper_invocation(&ctx->ac);

View file

@ -50,8 +50,6 @@ struct ac_shader_abi {
LLVMValueRef (*load_sampler_desc)(struct ac_shader_abi *abi, LLVMValueRef index,
enum ac_descriptor_type desc_type);
LLVMValueRef (*intrinsic_load)(struct ac_shader_abi *abi, nir_intrinsic_instr *intrin);
/* Whether to clamp the shadow reference value to [0,1]on GFX8. Radeonsi currently
* uses it due to promoting D16 to D32, but radv needs it off. */
bool clamp_shadow_reference;

View file

@ -188,25 +188,6 @@ static bool si_shader_binary_open(struct si_screen *screen, struct si_shader *sh
#undef add_part
struct ac_rtld_symbol lds_symbols[2];
unsigned num_lds_symbols = 0;
if (sel && screen->info.gfx_level >= GFX9 && !shader->is_gs_copy_shader &&
(sel->stage == MESA_SHADER_GEOMETRY ||
(sel->stage <= MESA_SHADER_GEOMETRY && shader->key.ge.as_ngg))) {
struct ac_rtld_symbol *sym = &lds_symbols[num_lds_symbols++];
sym->name = "esgs_ring";
sym->size = 0;
sym->align = 64 * 1024;
}
if (sel->stage == MESA_SHADER_GEOMETRY && shader->key.ge.as_ngg) {
struct ac_rtld_symbol *sym = &lds_symbols[num_lds_symbols++];
sym->name = "ngg_emit";
sym->size = 0;
sym->align = 4;
}
bool ok = ac_rtld_open(
rtld, (struct ac_rtld_open_info){.info = &screen->info,
.options =
@ -219,9 +200,7 @@ static bool si_shader_binary_open(struct si_screen *screen, struct si_shader *sh
.wave_size = shader->wave_size,
.num_parts = num_parts,
.elf_ptrs = part_elfs,
.elf_sizes = part_sizes,
.num_shared_lds_symbols = num_lds_symbols,
.shared_lds_symbols = lds_symbols});
.elf_sizes = part_sizes});
if (rtld->lds_size > 0) {
unsigned alloc_granularity = get_lds_granularity(screen, sel->stage);

View file

@ -190,7 +190,6 @@ si_aco_resolve_symbols(struct si_shader *shader, uint32_t *code_for_write,
{
const struct aco_symbol *symbols = (struct aco_symbol *)shader->binary.symbols;
const struct si_shader_selector *sel = shader->selector;
const union si_shader_key *key = &shader->key;
for (int i = 0; i < shader->binary.num_symbols; i++) {
uint32_t value = 0;
@ -207,11 +206,6 @@ si_aco_resolve_symbols(struct si_shader *shader, uint32_t *code_for_write,
else
value |= S_008F04_SWIZZLE_ENABLE_GFX6(1);
break;
case aco_symbol_lds_ngg_gs_out_vertex_base:
assert(sel->stage == MESA_SHADER_GEOMETRY && key->ge.as_ngg);
value = (key->ge.as_ngg ? shader->ngg.info.esgs_lds_size
: shader->gs_info.esgs_lds_size) * 4;
break;
case aco_symbol_const_data_addr:
if (!const_offset)
continue;

View file

@ -199,7 +199,8 @@ static void si_llvm_create_main_func(struct si_shader_context *ctx)
if (ctx->stage <= MESA_SHADER_GEOMETRY &&
(shader->key.ge.as_ls || ctx->stage == MESA_SHADER_TESS_CTRL)) {
(shader->key.ge.as_ls || ctx->stage == MESA_SHADER_TESS_CTRL ||
shader->key.ge.as_es || shader->key.ge.as_ngg)) {
/* 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
@ -285,28 +286,6 @@ LLVMValueRef si_prolog_get_internal_binding_slot(struct si_shader_context *ctx,
index);
}
/* Ensure that the esgs ring is declared.
*
* We declare it with 64KB alignment as a hint that the
* pointer value will always be 0.
*/
static void si_llvm_declare_lds_esgs_ring(struct si_shader_context *ctx)
{
if (ctx->ac.lds.value)
return;
assert(!LLVMGetNamedGlobal(ctx->ac.module, "esgs_ring"));
LLVMValueRef esgs_ring =
LLVMAddGlobalInAddressSpace(ctx->ac.module, LLVMArrayType(ctx->ac.i32, 0),
"esgs_ring", AC_ADDR_SPACE_LDS);
LLVMSetLinkage(esgs_ring, LLVMExternalLinkage);
LLVMSetAlignment(esgs_ring, 64 * 1024);
ctx->ac.lds.value = esgs_ring;
ctx->ac.lds.pointee_type = ctx->ac.i32;
}
/**
* Get the value of a shader input parameter and extract a bitfield.
*/
@ -442,19 +421,6 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
LLVMBuildRetVoid(builder);
}
static LLVMValueRef si_llvm_load_intrinsic(struct ac_shader_abi *abi, nir_intrinsic_instr *intrin)
{
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
switch (intrin->intrinsic) {
case nir_intrinsic_load_lds_ngg_gs_out_vertex_base_amd:
return LLVMBuildPtrToInt(ctx->ac.builder, ctx->gs_ngg_emit, ctx->ac.i32, "");
default:
return NULL;
}
}
static LLVMValueRef si_llvm_load_sampler_desc(struct ac_shader_abi *abi, LLVMValueRef index,
enum ac_descriptor_type desc_type)
{
@ -510,7 +476,6 @@ static bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shade
ctx->shader = shader;
ctx->stage = shader->is_gs_copy_shader ? MESA_SHADER_VERTEX : nir->info.stage;
ctx->abi.intrinsic_load = si_llvm_load_intrinsic;
ctx->abi.load_sampler_desc = si_llvm_load_sampler_desc;
si_llvm_create_main_func(ctx);
@ -524,12 +489,6 @@ static bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shade
break;
case MESA_SHADER_GEOMETRY:
if (ctx->shader->key.ge.as_ngg) {
ctx->gs_ngg_emit = LLVMAddGlobalInAddressSpace(
ctx->ac.module, LLVMArrayType(ctx->ac.i32, 0), "ngg_emit", AC_ADDR_SPACE_LDS);
LLVMSetLinkage(ctx->gs_ngg_emit, LLVMExternalLinkage);
LLVMSetAlignment(ctx->gs_ngg_emit, 4);
}
break;
case MESA_SHADER_FRAGMENT: {
@ -551,21 +510,6 @@ static bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shade
break;
}
bool is_merged_esgs_stage =
ctx->screen->info.gfx_level >= GFX9 && ctx->stage <= MESA_SHADER_GEOMETRY &&
(ctx->shader->key.ge.as_es || ctx->stage == MESA_SHADER_GEOMETRY);
bool is_nogs_ngg_stage =
(ctx->stage == MESA_SHADER_VERTEX || ctx->stage == MESA_SHADER_TESS_EVAL) &&
shader->key.ge.as_ngg && !shader->key.ge.as_es;
/* Declare the ESGS ring as an explicit LDS symbol.
* When NGG VS/TES, unconditionally declare for streamout and vertex compaction.
* Whether space is actually allocated is determined during linking / PM4 creation.
*/
if (is_merged_esgs_stage || is_nogs_ngg_stage)
si_llvm_declare_lds_esgs_ring(ctx);
/* For merged shaders (VS-TCS, VS-GS, TES-GS): */
if (ctx->screen->info.gfx_level >= GFX9 && si_is_merged_shader(shader)) {
/* Set EXEC = ~0 before the first shader. For monolithic shaders, the wrapper

View file

@ -29,8 +29,6 @@ struct si_shader_context {
LLVMTypeRef return_type;
struct ac_llvm_compiler *compiler;
LLVMValueRef gs_ngg_emit;
LLVMValueRef return_value;
};