[PATCH 12/23] drm/amdkfd: Setup current_logical_xcc_id in MQD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mukul Joshi <mukul.joshi@xxxxxxx>

Setup rolling current_logical_xcc_id in MQD for GFX9.4.3
to ensure each queue starts at a different place and prevent
hotspotting issues. Also, remove updating current_logical_xcc_id
during queue update.

Suggested-by: Joseph Greathouse <Joseph.Greathouse@xxxxxxx>
Signed-off-by: Mukul Joshi <mukul.joshi@xxxxxxx>
Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h   |  3 +++
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c     | 13 +++++--------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
index b11c474d4067..cd4383bb207f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
@@ -256,6 +256,9 @@ struct device_queue_manager {
 	struct work_struct	hw_exception_work;
 	struct kfd_mem_obj	hiq_sdma_mqd;
 	bool			sched_running;
+
+	/* used for GFX 9.4.3 only */
+	uint32_t		current_logical_xcc_start;
 };
 
 void device_queue_manager_init_cik(
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
index 2085054be3be..ac978141ebea 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
@@ -32,6 +32,7 @@
 #include "gc/gc_9_0_sh_mask.h"
 #include "sdma0/sdma0_4_0_sh_mask.h"
 #include "amdgpu_amdkfd.h"
+#include "kfd_device_queue_manager.h"
 
 static void update_mqd(struct mqd_manager *mm, void *mqd,
 		       struct queue_properties *q,
@@ -568,6 +569,7 @@ static void init_mqd_v9_4_3(struct mqd_manager *mm, void **mqd,
 	uint64_t xcc_gart_addr = 0;
 	uint64_t xcc_ctx_save_restore_area_address;
 	uint64_t offset = mm->mqd_stride(mm, q);
+	uint32_t local_xcc_start = mm->dev->dqm->current_logical_xcc_start++;
 
 	memset(&xcc_mqd_mem_obj, 0x0, sizeof(struct kfd_mem_obj));
 	for (xcc = 0; xcc < mm->dev->num_xcc_per_node; xcc++) {
@@ -595,18 +597,17 @@ static void init_mqd_v9_4_3(struct mqd_manager *mm, void **mqd,
 
 		if (q->format == KFD_QUEUE_FORMAT_AQL) {
 			m->compute_tg_chunk_size = 1;
+			m->compute_current_logic_xcc_id =
+					(local_xcc_start + xcc) %
+					mm->dev->num_xcc_per_node;
 
 			switch (xcc) {
 			case 0:
 				/* Master XCC */
 				m->cp_hqd_pq_control &=
 					~CP_HQD_PQ_CONTROL__NO_UPDATE_RPTR_MASK;
-				m->compute_current_logic_xcc_id =
-					mm->dev->num_xcc_per_node - 1;
 				break;
 			default:
-				m->compute_current_logic_xcc_id =
-					xcc - 1;
 				break;
 			}
 		} else {
@@ -641,12 +642,8 @@ static void update_mqd_v9_4_3(struct mqd_manager *mm, void *mqd,
 				/* Master XCC */
 				m->cp_hqd_pq_control &=
 					~CP_HQD_PQ_CONTROL__NO_UPDATE_RPTR_MASK;
-				m->compute_current_logic_xcc_id =
-					mm->dev->num_xcc_per_node - 1;
 				break;
 			default:
-				m->compute_current_logic_xcc_id =
-					xcc - 1;
 				break;
 			}
 			m->compute_tg_chunk_size = 1;
-- 
2.39.2




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux