ac/gpu_info: add cp_dma_use_L2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32971>
This commit is contained in:
Samuel Pitoiset
2025-01-10 05:03:11 -08:00
committed by Marge Bot
parent 02f8b22a1a
commit 603541f1a2
3 changed files with 6 additions and 9 deletions

View File

@@ -1086,6 +1086,7 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,
!util_is_power_of_two_or_zero(info->num_tcc_blocks) &&
info->num_rb != info->num_tcc_blocks;
info->cp_sdma_ge_use_system_memory_scope = info->gfx_level == GFX12;
info->cp_dma_use_L2 = info->gfx_level >= GFX7 && !info->cp_sdma_ge_use_system_memory_scope;
if (info->drm_minor >= 52) {
info->sqc_inst_cache_size = device_info.sqc_inst_cache_size * 1024;

View File

@@ -176,6 +176,7 @@ struct radeon_info {
uint32_t tcc_cache_line_size;
bool tcc_rb_non_coherent; /* whether L2 inv is needed for render->texture transitions */
bool cp_sdma_ge_use_system_memory_scope;
bool cp_dma_use_L2;
unsigned pc_lines;
uint32_t lds_size_per_workgroup;
uint32_t lds_alloc_granularity;

View File

@@ -18,11 +18,6 @@
#define CP_DMA_RAW_WAIT (1 << 1)
#define CP_DMA_CLEAR (1 << 2)
static bool cp_dma_use_L2(struct si_context *sctx)
{
return sctx->gfx_level >= GFX7 && !sctx->screen->info.cp_sdma_ge_use_system_memory_scope;
}
/* The max number of bytes that can be copied per packet. */
static inline unsigned cp_dma_max_byte_count(struct si_context *sctx)
{
@@ -65,12 +60,12 @@ static void si_emit_cp_dma(struct si_context *sctx, struct radeon_cmdbuf *cs, ui
command |= S_415_RAW_WAIT(1);
/* Src and dst flags. */
if (cp_dma_use_L2(sctx))
if (sctx->screen->info.cp_dma_use_L2)
header |= S_501_DST_SEL(V_501_DST_ADDR_TC_L2);
if (flags & CP_DMA_CLEAR) {
header |= S_411_SRC_SEL(V_411_DATA);
} else if (cp_dma_use_L2(sctx)) {
} else if (sctx->screen->info.cp_dma_use_L2) {
header |= S_501_SRC_SEL(V_501_SRC_ADDR_TC_L2);
}
@@ -150,7 +145,7 @@ void si_cp_dma_clear_buffer(struct si_context *sctx, struct radeon_cmdbuf *cs,
assert(!sctx->screen->info.cp_sdma_ge_use_system_memory_scope);
assert(size && size % 4 == 0);
if (!cp_dma_use_L2(sctx)) {
if (!sctx->screen->info.cp_dma_use_L2) {
sctx->barrier_flags |= SI_BARRIER_INV_L2;
si_mark_atom_dirty(sctx, &sctx->atoms.s.barrier);
}
@@ -233,7 +228,7 @@ void si_cp_dma_copy_buffer(struct si_context *sctx, struct pipe_resource *dst,
assert(size);
assert(dst && src);
if (!cp_dma_use_L2(sctx)) {
if (!sctx->screen->info.cp_dma_use_L2) {
sctx->barrier_flags |= SI_BARRIER_INV_L2;
si_mark_atom_dirty(sctx, &sctx->atoms.s.barrier);
}