From 45fa34284fd46a48d99f1f62bbbef0b5c1326fcb Mon Sep 17 00:00:00 2001 From: Yogesh Mohan Marimuthu Date: Sun, 12 May 2024 12:21:05 +0530 Subject: [PATCH] winsys/amdgpu: don't add fence dependency of other queues for userq MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case of userq, there will be only 1 userq per process. So all the jobs for that process goes into single queue. Hence there is no need to add fence of other queues even if info num_queues is > 1. Reviewed-by: Marek Olšák Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp index ff4bf421a82..8bb9d848ed6 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp @@ -1620,8 +1620,17 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index) struct amdgpu_fence *prev_fence = (struct amdgpu_fence*)queue->fences[prev_seq_no % AMDGPU_FENCE_RING_SIZE]; - if (prev_fence && (aws->info.ip[acs->ip_type].num_queues > 1 || queue->last_ctx != acs->ctx)) - add_seq_no_to_list(aws, &seq_no_dependencies, queue_index, prev_seq_no); + /* Add a dependency on a previous fence, unless we can determine that + * it's useless because the execution order is guaranteed. + */ + if (prev_fence) { + bool same_ctx = queue->last_ctx == acs->ctx; + /* userqueue submission mode uses a single queue per process. */ + bool same_queue = aws->info.ip[acs->ip_type].num_queues > 1 && + queue_type != USERQ; + if (!same_ctx || !same_queue) + add_seq_no_to_list(aws, &seq_no_dependencies, queue_index, prev_seq_no); + } } /* Since the kernel driver doesn't synchronize execution between different