radv: stop using LLVM LDS linking logic

Not needed.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35473>
This commit is contained in:
Marek Olšák
2025-06-11 14:01:28 -04:00
committed by Marge Bot
parent 44dd39d121
commit f8918ed6c6
4 changed files with 15 additions and 55 deletions
-29
View File
@@ -190,22 +190,6 @@ ac_llvm_finalize_module(struct radv_shader_context *ctx, struct ac_midend_optimi
ac_llvm_context_dispose(&ctx->ac);
}
/* 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
declare_esgs_ring(struct radv_shader_context *ctx)
{
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);
}
static LLVMModuleRef
ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, const struct radv_nir_compiler_options *options,
const struct radv_shader_info *info, struct nir_shader *const *shaders, int shader_count,
@@ -271,19 +255,6 @@ ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, const struct radv_nir
ac_init_exec_full_mask(&ctx.ac);
if (is_ngg) {
if (!info->is_ngg_passthrough)
declare_esgs_ring(&ctx);
if (ctx.stage == MESA_SHADER_GEOMETRY) {
/* Vertex emit space used by NGG GS for storing all vertex attributes. */
LLVMTypeRef ai32 = LLVMArrayType(ctx.ac.i32, 8);
LLVMValueRef gs_ngg_emit =
LLVMAddGlobalInAddressSpace(ctx.ac.module, LLVMArrayType(ctx.ac.i32, 0), "ngg_emit", AC_ADDR_SPACE_LDS);
LLVMSetInitializer(gs_ngg_emit, LLVMGetUndef(ai32));
LLVMSetLinkage(gs_ngg_emit, LLVMExternalLinkage);
LLVMSetAlignment(gs_ngg_emit, 4);
}
/* GFX10 hang workaround - there needs to be an s_barrier before gs_alloc_req always */
if (ctx.ac.gfx_level == GFX10 && shader_count == 1)
ac_build_s_barrier(&ctx.ac, shaders[0]->info.stage);
+2
View File
@@ -689,6 +689,8 @@ radv_postprocess_nir(struct radv_device *device, const struct radv_graphics_stat
*/
NIR_PASS(_, stage->nir, nir_opt_move, nir_move_comparisons);
}
stage->info.nir_shared_size = stage->nir->info.shared_size;
}
bool
+12 -26
View File
@@ -1396,22 +1396,6 @@ radv_open_rtld_binary(struct radv_device *device, const struct radv_shader_binar
const struct radv_physical_device *pdev = radv_device_physical(device);
const char *elf_data = (const char *)((struct radv_shader_binary_rtld *)binary)->data;
size_t elf_size = ((struct radv_shader_binary_rtld *)binary)->elf_size;
struct ac_rtld_symbol lds_symbols[3];
unsigned num_lds_symbols = 0;
if (pdev->info.gfx_level >= GFX9 && (binary->info.stage == MESA_SHADER_GEOMETRY || binary->info.is_ngg)) {
struct ac_rtld_symbol *sym = &lds_symbols[num_lds_symbols++];
sym->name = "esgs_ring";
sym->size = binary->info.ngg_info.esgs_ring_size;
sym->align = 64 * 1024;
}
if (binary->info.is_ngg && binary->info.stage == MESA_SHADER_GEOMETRY) {
struct ac_rtld_symbol *sym = &lds_symbols[num_lds_symbols++];
sym->name = "ngg_emit";
sym->size = binary->info.ngg_info.ngg_emit_size * 4;
sym->align = 4;
}
struct ac_rtld_open_info open_info = {
.info = &pdev->info,
@@ -1420,8 +1404,6 @@ radv_open_rtld_binary(struct radv_device *device, const struct radv_shader_binar
.num_parts = 1,
.elf_ptrs = &elf_data,
.elf_sizes = &elf_size,
.num_shared_lds_symbols = num_lds_symbols,
.shared_lds_symbols = lds_symbols,
};
return ac_rtld_open(rtld_binary, open_info);
@@ -1966,14 +1948,18 @@ radv_postprocess_binary_config(struct radv_device *device, struct radv_shader_bi
return false;
}
if (rtld_binary.lds_size > 0) {
unsigned encode_granularity = pdev->info.lds_encode_granularity;
config->lds_size = DIV_ROUND_UP(rtld_binary.lds_size, encode_granularity);
}
if (!config->lds_size && binary->info.stage == MESA_SHADER_TESS_CTRL) {
/* This is used for reporting LDS statistics */
config->lds_size = binary->info.tcs.num_lds_blocks;
}
unsigned lds_size = 0;
if (binary->info.is_ngg)
lds_size = binary->info.ngg_info.lds_size;
else if (pdev->info.gfx_level >= GFX9 && binary->info.stage == MESA_SHADER_GEOMETRY)
lds_size = binary->info.gs_ring_info.lds_size;
else if (binary->info.stage == MESA_SHADER_TESS_CTRL)
lds_size = binary->info.tcs.num_lds_blocks * pdev->info.lds_encode_granularity; /* only used by stats */
else
lds_size = binary->info.nir_shared_size;
config->lds_size = DIV_ROUND_UP(lds_size, pdev->info.lds_encode_granularity);
assert(!binary->info.has_ngg_culling || config->lds_size);
ac_rtld_close(&rtld_binary);
+1
View File
@@ -112,6 +112,7 @@ struct radv_shader_info {
bool merged_shader_compiled_separately; /* GFX9+ */
bool force_indirect_desc_sets;
uint64_t gs_inputs_read; /* Mask of GS inputs read (only used by linked ES) */
unsigned nir_shared_size; /* Only used by LLVM. */
struct {
uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];