Skip to contentSkip to conversation

KFD upstreaming

PATCH In review Kuehling, Felix 2 participants 7 messages May 28, 2019 – Jun 4, 2019 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover KFD upstreaming

New feature: queue priorities

The eviction state logic change is preparation for some debugger support we're working on but haven't settled on the final ABI yet.

Felix Kuehling (1):
drm/amdkfd: Simplify eviction state logic

Jay Cornwall (1):
drm/amdkfd: Implement queue priority controls for gfx9

ozeng (1):
drm/amdkfd: CP queue priority controls

 .../drm/amd/amdkfd/kfd_device_queue_manager.c | 84 ++++++++++---------
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c  | 20 +++++
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h  |  2 +-
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c  | 27 +++---
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c   | 20 ++---
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c   | 22 ++---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h         | 16 ++++
 7 files changed, 113 insertions(+), 78 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190528223811.13947-1-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/3 drm/amdkfd: Simplify eviction state logic

Always mark evicted queues with q->properties.is_evicted = true, even queues that are inactive for other reason. This simplifies maintaining the eviction state as it doesn't require updating is_evicted when other queue activation conditions change.

On the other hand, we now need to check those other queue activation conditions whenever an evicted queues is restored. To minimize code duplication, move the queue activation check into a macro so it can be maintained in one central place.

---
 .../drm/amd/amdkfd/kfd_device_queue_manager.c | 84 ++++++++++---------
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c  | 15 +---
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c   | 10 +--
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c   | 10 +--
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h         |  5 ++
 5 files changed, 56 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +44 -40
index ece35c7a77b5..c18355d4cb95 100644
@@ -289,13 +289,11 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
 	}
 	q->properties.vmid = qpd->vmid;
 	/*
-	 * Eviction state logic: we only mark active queues as evicted
-	 * to avoid the overhead of restoring inactive queues later
+	 * Eviction state logic: mark all queues as evicted, even ones
+	 * not currently active. Restoring inactive queues later only
+	 * updates the is_evicted flag but is a no-op otherwise.
 	 */
-	if (qpd->evicted)
-		q->properties.is_evicted = (q->properties.queue_size > 0 &&
-					    q->properties.queue_percent > 0 &&
-					    q->properties.queue_address != 0);
+	q->properties.is_evicted = !!qpd->evicted;
 
 	q->properties.tba_addr = qpd->tba_addr;
 	q->properties.tma_addr = qpd->tma_addr;
@@ -518,14 +516,6 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
 	}
 	mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
 			q->properties.type)];
-	/*
-	 * Eviction state logic: we only mark active queues as evicted
-	 * to avoid the overhead of restoring inactive queues later
-	 */
-	if (pdd->qpd.evicted)
-		q->properties.is_evicted = (q->properties.queue_size > 0 &&
-					    q->properties.queue_percent > 0 &&
-					    q->properties.queue_address != 0);
 
 	/* Save previous activity state for counters */
 	prev_active = q->properties.is_active;
@@ -590,7 +580,7 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm,
 	struct queue *q;
 	struct mqd_manager *mqd_mgr;
 	struct kfd_process_device *pdd;
-	int retval = 0;
+	int retval, ret = 0;
 
 	dqm_lock(dqm);
 	if (qpd->evicted++ > 0) /* already evicted, do nothing */
@@ -600,25 +590,31 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm,
 	pr_info_ratelimited("Evicting PASID %u queues\n",
 			    pdd->process->pasid);
 
-	/* unactivate all active queues on the qpd */
+	/* Mark all queues as evicted. Deactivate all active queues on
+	 * the qpd.
+	 */
 	list_for_each_entry(q, &qpd->queues_list, list) {
+		q->properties.is_evicted = true;
 		if (!q->properties.is_active)
 			continue;
+
 		mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
 				q->properties.type)];
-		q->properties.is_evicted = true;
 		q->properties.is_active = false;
 		retval = mqd_mgr->destroy_mqd(mqd_mgr, q->mqd,
 				KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN,
 				KFD_UNMAP_LATENCY_MS, q->pipe, q->queue);
-		if (retval)
-			goto out;
+		if (retval && !ret)
+			/* Return the first error, but keep going to
+			 * maintain a consistent eviction state
+			 */
+			ret = retval;
 		dqm->queue_count--;
 	}
 
 out:
 	dqm_unlock(dqm);
-	return retval;
+	return ret;
 }
 
 static int evict_process_queues_cpsch(struct device_queue_manager *dqm,
@@ -636,11 +632,14 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm,
 	pr_info_ratelimited("Evicting PASID %u queues\n",
 			    pdd->process->pasid);
 
-	/* unactivate all active queues on the qpd */
+	/* Mark all queues as evicted. Deactivate all active queues on
+	 * the qpd.
+	 */
 	list_for_each_entry(q, &qpd->queues_list, list) {
+		q->properties.is_evicted = true;
 		if (!q->properties.is_active)
 			continue;
-		q->properties.is_evicted = true;
+
 		q->properties.is_active = false;
 		dqm->queue_count--;
 	}
@@ -662,7 +661,7 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,
 	struct mqd_manager *mqd_mgr;
 	struct kfd_process_device *pdd;
 	uint64_t pd_base;
-	int retval = 0;
+	int retval, ret = 0;
 
 	pdd = qpd_to_pdd(qpd);
 	/* Retrieve PD base */
@@ -696,22 +695,28 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,
 	 */
 	mm = get_task_mm(pdd->process->lead_thread);
 	if (!mm) {
-		retval = -EFAULT;
+		ret = -EFAULT;
 		goto out;
 	}
 
-	/* activate all active queues on the qpd */
+	/* Remove the eviction flags. Activate queues that are not
+	 * inactive for other reasons.
+	 */
 	list_for_each_entry(q, &qpd->queues_list, list) {
-		if (!q->properties.is_evicted)
+		q->properties.is_evicted = false;
+		if (!QUEUE_IS_ACTIVE(q->properties))
 			continue;
+
 		mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
 				q->properties.type)];
-		q->properties.is_evicted = false;
 		q->properties.is_active = true;
 		retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe,
 				       q->queue, &q->properties, mm);
-		if (retval)
-			goto out;
+		if (retval && !ret)
+			/* Return the first error, but keep going to
+			 * maintain a consistent eviction state
+			 */
+			ret = retval;
 		dqm->queue_count++;
 	}
 	qpd->evicted = 0;
@@ -719,7 +724,7 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,
 	if (mm)
 		mmput(mm);
 	dqm_unlock(dqm);
-	return retval;
+	return ret;
 }
 
 static int restore_process_queues_cpsch(struct device_queue_manager *dqm,
@@ -751,16 +756,16 @@ static int restore_process_queues_cpsch(struct device_queue_manager *dqm,
 
 	/* activate all active queues on the qpd */
 	list_for_each_entry(q, &qpd->queues_list, list) {
-		if (!q->properties.is_evicted)
-			continue;
 		q->properties.is_evicted = false;
+		if (!QUEUE_IS_ACTIVE(q->properties))
+			continue;
+
 		q->properties.is_active = true;
 		dqm->queue_count++;
 	}
 	retval = execute_queues_cpsch(dqm,
 				KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0);
-	if (!retval)
-		qpd->evicted = 0;
+	qpd->evicted = 0;
 out:
 	dqm_unlock(dqm);
 	return retval;
@@ -1199,13 +1204,12 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
 	mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
 			q->properties.type)];
 	/*
-	 * Eviction state logic: we only mark active queues as evicted
-	 * to avoid the overhead of restoring inactive queues later
+	 * Eviction state logic: mark all queues as evicted, even ones
+	 * not currently active. Restoring inactive queues later only
+	 * updates the is_evicted flag but is a no-op otherwise.
 	 */
-	if (qpd->evicted)
-		q->properties.is_evicted = (q->properties.queue_size > 0 &&
-					    q->properties.queue_percent > 0 &&
-					    q->properties.queue_address != 0);
+	q->properties.is_evicted = !!qpd->evicted;
+
 	dqm->asic_ops.init_sdma_vm(dqm, q, qpd);
 	q->properties.tba_addr = qpd->tba_addr;
 	q->properties.tma_addr = qpd->tma_addr;
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +3 -12
index 6e8509ec29d9..5370a897526a 100644
@@ -231,10 +231,7 @@ static int __update_mqd(struct mqd_manager *mm, void *mqd,
 
 	update_cu_mask(mm, mqd, q);
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 
 	return 0;
 }
@@ -275,10 +272,7 @@ static int update_mqd_sdma(struct mqd_manager *mm, void *mqd,
 	m->sdma_engine_id = q->sdma_engine_id;
 	m->sdma_queue_id = q->sdma_queue_id;
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 
 	return 0;
 }
@@ -358,10 +352,7 @@ static int update_mqd_hiq(struct mqd_manager *mm, void *mqd,
 
 	m->cp_hqd_vmid = q->vmid;
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +2 -8
index 4750338199b6..a65efca36217 100644
@@ -247,10 +247,7 @@ static int update_mqd(struct mqd_manager *mm, void *mqd,
 
 	update_cu_mask(mm, mqd, q);
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 
 	return 0;
 }
@@ -402,10 +399,7 @@ static int update_mqd_sdma(struct mqd_manager *mm, void *mqd,
 	m->sdma_queue_id = q->sdma_queue_id;
 	m->sdmax_rlcx_dummy_reg = SDMA_RLC_DUMMY_DEFAULT;
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +2 -8
index b550dea9b10a..335aded8855d 100644
@@ -238,10 +238,7 @@ static int __update_mqd(struct mqd_manager *mm, void *mqd,
 
 	update_cu_mask(mm, mqd, q);
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 
 	return 0;
 }
@@ -396,10 +393,7 @@ static int update_mqd_sdma(struct mqd_manager *mm, void *mqd,
 	m->sdma_engine_id = q->sdma_engine_id;
 	m->sdma_queue_id = q->sdma_queue_id;
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +5 -0
index b61dc53f42d2..6d29d589a4a5 100644
@@ -430,6 +430,11 @@ struct queue_properties {
 	uint32_t *cu_mask;
 };
 
+#define QUEUE_IS_ACTIVE(q) ((q).queue_size > 0 &&	\
+			    (q).queue_address != 0 &&	\
+			    (q).queue_percent > 0 &&	\
+			    !(q).is_evicted)
+
 /**
  * struct queue
  *
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 2/3 drm/amdkfd: CP queue priority controls

In reply to a message not in the archive

From: ozeng <[email protected]>

Translate queue priority into pipe priority and write to MQDs. The priority values are used to perform queue and pipe arbitration.

---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c  | 20 +++++++++++++++++++
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h  |  2 +-
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c  | 12 ++++++++---
 .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c   | 12 ++++++++---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h         | 11 ++++++++++
 5 files changed, 50 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +20 -0
index 9307811bc427..cc04b362f510 100644
@@ -25,6 +25,26 @@
 #include "amdgpu_amdkfd.h"
 #include "kfd_device_queue_manager.h"
 
+/* Mapping queue priority to pipe priority, indexed by queue priority */
+int pipe_priority_map[] = {
+	KFD_PIPE_PRIORITY_CS_LOW,
+	KFD_PIPE_PRIORITY_CS_LOW,
+	KFD_PIPE_PRIORITY_CS_LOW,
+	KFD_PIPE_PRIORITY_CS_LOW,
+	KFD_PIPE_PRIORITY_CS_LOW,
+	KFD_PIPE_PRIORITY_CS_LOW,
+	KFD_PIPE_PRIORITY_CS_LOW,
+	KFD_PIPE_PRIORITY_CS_MEDIUM,
+	KFD_PIPE_PRIORITY_CS_MEDIUM,
+	KFD_PIPE_PRIORITY_CS_MEDIUM,
+	KFD_PIPE_PRIORITY_CS_MEDIUM,
+	KFD_PIPE_PRIORITY_CS_HIGH,
+	KFD_PIPE_PRIORITY_CS_HIGH,
+	KFD_PIPE_PRIORITY_CS_HIGH,
+	KFD_PIPE_PRIORITY_CS_HIGH,
+	KFD_PIPE_PRIORITY_CS_HIGH
+};
+
 struct kfd_mem_obj *allocate_hiq_mqd(struct kfd_dev *dev)
 {
 	struct kfd_mem_obj *mqd_mem_obj = NULL;
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h +1 -1
index 56af256a191b..66b8c67e5340 100644
@@ -62,7 +62,7 @@
  * per KFD_MQD_TYPE for each device.
  *
  */
-
+extern int pipe_priority_map[];
 struct mqd_manager {
 	int	(*init_mqd)(struct mqd_manager *mm, void **mqd,
 			struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr,
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +9 -3
index 5370a897526a..e911438d76b3 100644
@@ -66,6 +66,12 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
 		m->compute_static_thread_mgmt_se3);
 }
 
+static void set_priority(struct cik_mqd *m, struct queue_properties *q)
+{
+	m->cp_hqd_pipe_priority = pipe_priority_map[q->priority];
+	m->cp_hqd_queue_priority = q->priority;
+}
+
 static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
 					struct queue_properties *q)
 {
@@ -81,7 +87,6 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
 	return mqd_mem_obj;
 }
 
-
 static int init_mqd(struct mqd_manager *mm, void **mqd,
 		struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr,
 		struct queue_properties *q)
@@ -131,8 +136,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd,
 	 * 1 = CS_MEDIUM (typically between HP3D and GFX
 	 * 2 = CS_HIGH (typically above HP3D)
 	 */
-	m->cp_hqd_pipe_priority = 1;
-	m->cp_hqd_queue_priority = 15;
+	set_priority(m, q);
 
 	if (q->format == KFD_QUEUE_FORMAT_AQL)
 		m->cp_hqd_iq_rptr = AQL_ENABLE;
@@ -230,6 +234,7 @@ static int __update_mqd(struct mqd_manager *mm, void *mqd,
 		m->cp_hqd_pq_control |= NO_UPDATE_RPTR;
 
 	update_cu_mask(mm, mqd, q);
+	set_priority(m, q);
 
 	q->is_active = QUEUE_IS_ACTIVE(*q);
 
@@ -354,6 +359,7 @@ static int update_mqd_hiq(struct mqd_manager *mm, void *mqd,
 
 	q->is_active = QUEUE_IS_ACTIVE(*q);
 
+	set_priority(m, q);
 	return 0;
 }
 
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +9 -3
index 335aded8855d..00e6a5955120 100644
@@ -31,6 +31,7 @@
 #include "gca/gfx_8_0_sh_mask.h"
 #include "gca/gfx_8_0_enum.h"
 #include "oss/oss_3_0_sh_mask.h"
+
 #define CP_MQD_CONTROL__PRIV_STATE__SHIFT 0x8
 
 static inline struct vi_mqd *get_mqd(void *mqd)
@@ -68,6 +69,12 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
 		m->compute_static_thread_mgmt_se3);
 }
 
+static void set_priority(struct vi_mqd *m, struct queue_properties *q)
+{
+	m->cp_hqd_pipe_priority = pipe_priority_map[q->priority];
+	m->cp_hqd_queue_priority = q->priority;
+}
+
 static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
 					struct queue_properties *q)
 {
@@ -121,9 +128,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd,
 			1 << CP_HQD_QUANTUM__QUANTUM_SCALE__SHIFT |
 			10 << CP_HQD_QUANTUM__QUANTUM_DURATION__SHIFT;
 
-	m->cp_hqd_pipe_priority = 1;
-	m->cp_hqd_queue_priority = 15;
-
+	set_priority(m, q);
 	m->cp_hqd_eop_rptr = 1 << CP_HQD_EOP_RPTR__INIT_FETCHER__SHIFT;
 
 	if (q->format == KFD_QUEUE_FORMAT_AQL)
@@ -237,6 +242,7 @@ static int __update_mqd(struct mqd_manager *mm, void *mqd,
 			mtype << CP_HQD_CTX_SAVE_CONTROL__MTYPE__SHIFT;
 
 	update_cu_mask(mm, mqd, q);
+	set_priority(m, q);
 
 	q->is_active = QUEUE_IS_ACTIVE(*q);
 
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +11 -0
index 6d29d589a4a5..da589ee1366c 100644
@@ -348,6 +348,11 @@ enum kfd_queue_format {
 	KFD_QUEUE_FORMAT_AQL
 };
 
+enum KFD_QUEUE_PRIORITY {
+	KFD_QUEUE_PRIORITY_MINIMUM = 0,
+	KFD_QUEUE_PRIORITY_MAXIMUM = 15
+};
+
 /**
  * struct queue_properties
  *
@@ -499,6 +504,12 @@ enum KFD_MQD_TYPE {
 	KFD_MQD_TYPE_MAX
 };
 
+enum KFD_PIPE_PRIORITY {
+	KFD_PIPE_PRIORITY_CS_LOW = 0,
+	KFD_PIPE_PRIORITY_CS_MEDIUM,
+	KFD_PIPE_PRIORITY_CS_HIGH
+};
+
 struct scheduling_resources {
 	unsigned int vmid_mask;
 	enum kfd_queue_type type;
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

PATCH 3/3 drm/amdkfd: Implement queue priority controls for gfx9

In reply to a message not in the archive

From: Jay Cornwall <[email protected]>

Ported from gfx8, no changes in register setup.

---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +7 -3
index a65efca36217..818944b52e11 100644
@@ -67,6 +67,12 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
 		m->compute_static_thread_mgmt_se3);
 }
 
+static void set_priority(struct v9_mqd *m, struct queue_properties *q)
+{
+	m->cp_hqd_pipe_priority = pipe_priority_map[q->priority];
+	m->cp_hqd_queue_priority = q->priority;
+}
+
 static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
 		struct queue_properties *q)
 {
@@ -141,9 +147,6 @@ static int init_mqd(struct mqd_manager *mm, void **mqd,
 			1 << CP_HQD_QUANTUM__QUANTUM_SCALE__SHIFT |
 			10 << CP_HQD_QUANTUM__QUANTUM_DURATION__SHIFT;
 
-	m->cp_hqd_pipe_priority = 1;
-	m->cp_hqd_queue_priority = 15;
-
 	if (q->format == KFD_QUEUE_FORMAT_AQL) {
 		m->cp_hqd_aql_control =
 			1 << CP_HQD_AQL_CONTROL__CONTROL0__SHIFT;
@@ -246,6 +249,7 @@ static int update_mqd(struct mqd_manager *mm, void *mqd,
 		m->cp_hqd_ctx_save_control = 0;
 
 	update_cu_mask(mm, mqd, q);
+	set_priority(m, q);
 
 	q->is_active = QUEUE_IS_ACTIVE(*q);
 
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw
In reply to a message not in the archive

There haven't been any objections to these changes. Does anyone want to add their Acked-by before I submit?

Thanks,
  Felix

Quoted 14 lines · Felix

New feature: queue priorities

The eviction state logic change is preparation for some debugger support we're working on but haven't settled on the final ABI yet.

Felix Kuehling (1):
drm/amdkfd: Simplify eviction state logic

Jay Cornwall (1):
drm/amdkfd: Implement queue priority controls for gfx9

ozeng (1):
drm/amdkfd: CP queue priority controls

Quoted 9 lines
  .../drm/amd/amdkfd/kfd_device_queue_manager.c | 84 ++++++++++---------
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c  | 20 +++++
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h  |  2 +-
  .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c  | 27 +++---
  .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c   | 20 ++---
  .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c   | 22 ++---
  drivers/gpu/drm/amd/amdkfd/kfd_priv.h         | 16 ++++
  7 files changed, 113 insertions(+), 78 deletions(-)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): a16cf042-fcb9-21a7-20e4-20c61174f3ff-5C7GfCeVMHo@public.gmane.org

Acked-by
#7 lore raw
Quoted 3 lines · Felix

There haven't been any objections to these changes. Does anyone want to add their Acked-by before I submit?

Series is:

I wonder if there is a chance to share any code down the road with the context priority stuff in amdgpu.

Alex

Quoted 28 lines

Thanks,
Felix

Quoted 14 lines · Felix

New feature: queue priorities

The eviction state logic change is preparation for some debugger support we're working on but haven't settled on the final ABI yet.

Felix Kuehling (1):
drm/amdkfd: Simplify eviction state logic

Jay Cornwall (1):
drm/amdkfd: Implement queue priority controls for gfx9

ozeng (1):
drm/amdkfd: CP queue priority controls

Quoted 9 lines
  .../drm/amd/amdkfd/kfd_device_queue_manager.c | 84 ++++++++++---------
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c  | 20 +++++
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h  |  2 +-
  .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c  | 27 +++---
  .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c   | 20 ++---
  .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c   | 22 ++---
  drivers/gpu/drm/amd/amdkfd/kfd_priv.h         | 16 ++++
  7 files changed, 113 insertions(+), 78 deletions(-)
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_NKKykmkKp8arYpnim3EEmXWcBHkP9PX0RV4h_waKzSDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#9 lore raw
Quoted 8 lines · Alex Deucher
Quoted 2 lines · Felix

There haven't been any objections to these changes. Does anyone want to add their Acked-by before I submit?

Series is:

I wonder if there is a chance to share any code down the road with the context priority stuff in amdgpu.

KFD sets queue and pipe priorities in MQDs. The register access has to be done by HWS or MEC firmware because it maps our queues dynamically. The priorities in the KFD API map 1:1 to queue priorities (16 levels) but need some translation for pipe priorities (3 levels).

AMDGPU sets the queue and pipe priorities directly to registers rather than updating the MQD and remapping the queue using KIQ. And seems to have only a binary choice between high and low priority. It also does some per-pipe resource reservation that we don't have an equivalent for in KFD.

Just looking at the code now, the compute pipe priority handling in amdgpu seems wrong. The pipe priority is per pipe. AIUI it gets applied to the pipe when the CP switches the active queue. Programming this register from the driver is probably pointless. You should set this in the MQD. But changing the MQD of a mapped queue is not a good idea in my experience. So you'd have to unmap the queue, update the priorities and then remap it (using KIQ).

I don't see a lot of potential for code sharing on current hardware because we have such different ways of scheduling queues. If you change amdgpu to use MQDs and KIQ to update priorities, we could maybe share the code that initializes and updates MQDs.

Regards,
  Felix

Quoted 34 lines

Alex

Quoted 31 lines

Thanks,
Felix

Quoted 14 lines · Felix

New feature: queue priorities

The eviction state logic change is preparation for some debugger support we're working on but haven't settled on the final ABI yet.

Felix Kuehling (1):
drm/amdkfd: Simplify eviction state logic

Jay Cornwall (1):
drm/amdkfd: Implement queue priority controls for gfx9

ozeng (1):
drm/amdkfd: CP queue priority controls

Quoted 9 lines
   .../drm/amd/amdkfd/kfd_device_queue_manager.c | 84 ++++++++++---------
   drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c  | 20 +++++
   drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h  |  2 +-
   .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c  | 27 +++---
   .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c   | 20 ++---
   .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c   | 22 ++---
   drivers/gpu/drm/amd/amdkfd/kfd_priv.h         | 16 ++++
   7 files changed, 113 insertions(+), 78 deletions(-)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx