Skip to contentSkip to conversation

drm/amdgpu: fix mec queue policy on single MEC asics

PATCH In review Alex Deucher 4 participants 11 messages Jun 7, 2017 6 messages not in the archive

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

PATCH 1/3 drm/amdgpu: fix mec queue policy on single MEC asics

Fixes hangs on single MEC asics.

Fixes 2ed286fb434 (drm/amdgpu: new queue policy, take first 2 queues of each pipe v2)
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 12 +++++++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 +++++++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++++---
 3 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +9 -3
index 4c04e9d..862bc72 100644
@@ -2825,9 +2825,15 @@ static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)
 		if (mec >= adev->gfx.mec.num_mec)
 			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
 	}
 
 	/* update the number of active compute rings */
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +9 -3
index ad2e0bb..1370b39 100644
@@ -1464,9 +1464,15 @@ static void gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)
 		if (mec >= adev->gfx.mec.num_mec)
 			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
 	}
 
 	/* update the number of active compute rings */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -3
index cf15a350..9d675b3 100644
@@ -873,9 +873,15 @@ static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)
 		if (mec >= adev->gfx.mec.num_mec)
 			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
 	}
 
 	/* update the number of active compute rings */
Signature · 6 lines
2.5.5

_______________________________________________
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): 1496848229-12761-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/3 drm/amdgpu: move gfx_v*_0_compute_queue_acquire to common code

Same function was duplicated in all gfx IP files.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 37 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 39 +--------------------------------
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 39 +--------------------------------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 +--------------------------------
 5 files changed, 42 insertions(+), 114 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +37 -0
index 1994335..51a9708 100644
@@ -108,3 +108,40 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s
 		p = next + 1;
 	}
 }
+
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)
+{
+	int i, queue, pipe, mec;
+
+	/* policy for amdgpu compute queue ownership */
+	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
+		queue = i % adev->gfx.mec.num_queue_per_pipe;
+		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
+			% adev->gfx.mec.num_pipe_per_mec;
+		mec = (i / adev->gfx.mec.num_queue_per_pipe)
+			/ adev->gfx.mec.num_pipe_per_mec;
+
+		/* we've run out of HW */
+		if (mec >= adev->gfx.mec.num_mec)
+			break;
+
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
+	}
+
+	/* update the number of active compute rings */
+	adev->gfx.num_compute_rings =
+		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
+
+	/* If you hit this case and edited the policy, you probably just
+	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
+	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
+		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
index 2d846ef..9b9ea6e 100644
@@ -30,6 +30,8 @@ void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);
 void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se,
 		unsigned max_sh);
 
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev);
+
 /**
  * amdgpu_gfx_create_bitmask - create a bitmask
  *
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -38
index 862bc72..6ffb2da 100644
@@ -2809,43 +2809,6 @@ static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)
 	}
 }
 
-static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
 static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
 {
 	int r;
@@ -2870,7 +2833,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
 	adev->gfx.mec.num_queue_per_pipe = 8;
 
 	/* take ownership of the relevant compute queues */
-	gfx_v7_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
 	/* allocate space for ALL pipes (even the ones we don't own) */
 	mec_hpd_size = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -38
index 1370b39..cfa37f1 100644
@@ -1448,43 +1448,6 @@ static void gfx_v8_0_kiq_free_ring(struct amdgpu_ring *ring,
 	amdgpu_ring_fini(ring);
 }
 
-static void gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
 static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
 {
 	int r;
@@ -1513,7 +1476,7 @@ static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
 	adev->gfx.mec.num_queue_per_pipe = 8;
 
 	/* take ownership of the relevant compute queues */
-	gfx_v8_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
 	mec_hpd_size = adev->gfx.num_compute_rings * GFX8_MEC_HPD_SIZE;
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -38
index 9d675b3..3ea0e71 100644
@@ -857,43 +857,6 @@ static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
 	}
 }
 
-static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
 static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
 {
 	int r;
@@ -920,7 +883,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
 	adev->gfx.mec.num_queue_per_pipe = 8;
 
 	/* take ownership of the relevant compute queues */
-	gfx_v9_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 	mec_hpd_size = adev->gfx.num_compute_rings * GFX9_MEC_HPD_SIZE;
 
 	if (adev->gfx.mec.hpd_eop_obj == NULL) {
Signature · 6 lines
2.5.5

_______________________________________________
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): 1496848229-12761-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/3] drm/amdgpu: move gfx_v*_0_compute_queue_acquire to common code

Hi Alex,

This failed to apply on top of amd-staging-4.11... Am I trying the wrong branch?

Cheers,
Tom

Quoted 233 lines · Alex Deucher

Same function was duplicated in all gfx IP files.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 37 +++++++++++++++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 ++
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 39 +--------------------------------
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 39 +--------------------------------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 +--------------------------------
  5 files changed, 42 insertions(+), 114 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +37 -0
index 1994335..51a9708 100644
@@ -108,3 +108,40 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s
  		p = next + 1;
  	}
  }
+
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)
+{
+	int i, queue, pipe, mec;
+
+	/* policy for amdgpu compute queue ownership */
+	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
+		queue = i % adev->gfx.mec.num_queue_per_pipe;
+		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
+			% adev->gfx.mec.num_pipe_per_mec;
+		mec = (i / adev->gfx.mec.num_queue_per_pipe)
+			/ adev->gfx.mec.num_pipe_per_mec;
+
+		/* we've run out of HW */
+		if (mec >= adev->gfx.mec.num_mec)
+			break;
+
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
+	}
+
+	/* update the number of active compute rings */
+	adev->gfx.num_compute_rings =
+		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
+
+	/* If you hit this case and edited the policy, you probably just
+	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
+	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
+		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
index 2d846ef..9b9ea6e 100644
@@ -30,6 +30,8 @@ void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);
  void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se,
  		unsigned max_sh);
 
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev);
+
  /**
   * amdgpu_gfx_create_bitmask - create a bitmask
   *
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -38
index 862bc72..6ffb2da 100644
@@ -2809,43 +2809,6 @@ static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)
  	}
  }
 
-static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
  static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;
@@ -2870,7 +2833,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v7_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
  	/* allocate space for ALL pipes (even the ones we don't own) */
  	mec_hpd_size = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -38
index 1370b39..cfa37f1 100644
@@ -1448,43 +1448,6 @@ static void gfx_v8_0_kiq_free_ring(struct amdgpu_ring *ring,
  	amdgpu_ring_fini(ring);
  }
 
-static void gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
  static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;
@@ -1513,7 +1476,7 @@ static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v8_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
  	mec_hpd_size = adev->gfx.num_compute_rings * GFX8_MEC_HPD_SIZE;
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -37
index 9d675b3..3ea0e71 100644
@@ -857,43 +857,6 @@ static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
  	}
  }
 
-static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
  static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_mec_init(struct amdgpu_device *adev) · line 889

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -920,7 +883,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v9_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
  	mec_hpd_size = adev->gfx.num_compute_rings * GFX9_MEC_HPD_SIZE;
 
  	if (adev->gfx.mec.hpd_eop_obj == NULL) {

_______________________________________________
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): 8fe12578-aceb-be31-aee1-569ff30d2d7d-5C7GfCeVMHo@public.gmane.org

#6 lore raw

RE: [PATCH 2/3] drm/amdgpu: move gfx_v*_0_compute_queue_acquire to common code

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Tom St Denis
Sent: Wednesday, June 07, 2017 12:01 PM
To: [email protected]
Subject: Re: [PATCH 2/3] drm/amdgpu: move gfx_v*_0_compute_queue_acquire to common code

Quoted 4 lines

Hi Alex,

This failed to apply on top of amd-staging-4.11... Am I trying the wrong branch?

Sorry, I have this patch in my tree as well which I just pushed to amd-staging-4.11:
https://patchwork.freedesktop.org/patch/160199/

Alex

Quoted 285 lines

Cheers,
Tom

Quoted 5 lines · Alex Deucher

Same function was duplicated in all gfx IP files.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 37

+++++++++++++++++++++++++++++++

Quoted 2 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 ++
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 39 +-----------------------------

---

Quoted 1 line
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 39 +-----------------------------

---

Quoted 1 line
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 +-----------------------------

---

Review

Quoted 3 lines
  5 files changed, 42 insertions(+), 114 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_parse_disable_cu(unsigned

Quoted 4 lines

index 1994335..51a9708 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -0
@@ -108,3 +108,40 @@ void amdgpu_gfx_parse_disable_cu(unsigned

*mask, unsigned max_se, unsigned max_s

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2 -0
  		p = next + 1;
  	}
  }
+
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device

*adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +7 -0
+{
+	int i, queue, pipe, mec;
+
+	/* policy for amdgpu compute queue ownership */
+	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
+		queue = i % adev->gfx.mec.num_queue_per_pipe;
+		pipe = (i / adev->gfx.mec.num_queue_per_pipe)

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +10 -0
+			% adev->gfx.mec.num_pipe_per_mec;
+		mec = (i / adev->gfx.mec.num_queue_per_pipe)
+			/ adev->gfx.mec.num_pipe_per_mec;
+
+		/* we've run out of HW */
+		if (mec >= adev->gfx.mec.num_mec)
+			break;
+
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the

first MEC */

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +12 -0
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
+	}
+
+	/* update the number of active compute rings */
+	adev->gfx.num_compute_rings =
+		bitmap_weight(adev->gfx.mec.queue_bitmap,

AMDGPU_MAX_COMPUTE_QUEUES);

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +4 -0
+
+	/* If you hit this case and edited the policy, you probably just
+	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
+	if (WARN_ON(adev->gfx.num_compute_rings >

AMDGPU_MAX_COMPUTE_RINGS))

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s · line 140

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1 -0
+		adev->gfx.num_compute_rings =

AMDGPU_MAX_COMPUTE_RINGS;

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1 -0
+}
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h void amdgpu_gfx_scratch_free(struct amdgpu_device

Quoted 4 lines

index 2d846ef..9b9ea6e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
@@ -30,6 +30,8 @@ void amdgpu_gfx_scratch_free(struct amdgpu_device

*adev, uint32_t reg);

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 -0
  void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se,
  		unsigned max_sh);
 
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device

*adev);

Review

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 -0
+
  /**
   * amdgpu_gfx_create_bitmask - create a bitmask
   *
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_mec_fini(struct

Quoted 4 lines

index 862bc72..6ffb2da 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
@@ -2809,43 +2809,6 @@ static void gfx_v7_0_mec_fini(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_mec_fini(struct · line 2812

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
  	}
  }
 
-static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device

*adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -7
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -10
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the

first MEC */

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -12
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap,

AMDGPU_MAX_COMPUTE_QUEUES);

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -4
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings >

AMDGPU_MAX_COMPUTE_RINGS))

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_mec_fini(struct · line 2846

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
-		adev->gfx.num_compute_rings =

AMDGPU_MAX_COMPUTE_RINGS;

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static int gfx_v7_0_mec_init(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -2
-}
-
  static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;
@@ -2870,7 +2833,7 @@ static int gfx_v7_0_mec_init(struct

amdgpu_device *adev)

Review

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -1
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v7_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
  	/* allocate space for ALL pipes (even the ones we don't own) */
  	mec_hpd_size = adev->gfx.mec.num_mec * adev-

gfx.mec.num_pipe_per_mec

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_kiq_free_ring(struct

Quoted 4 lines

index 1370b39..cfa37f1 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -1448,43 +1448,6 @@ static void gfx_v8_0_kiq_free_ring(struct

amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_kiq_free_ring(struct amdgpu_ring *ring,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
  	amdgpu_ring_fini(ring);
  }
 
-static void gfx_v8_0_compute_queue_acquire(struct amdgpu_device

*adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -7
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_kiq_free_ring(struct · line 1468

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -10
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the

first MEC */

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_kiq_free_ring(struct · line 1480

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -12
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap,

AMDGPU_MAX_COMPUTE_QUEUES);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_kiq_free_ring(struct · line 1484

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings >

AMDGPU_MAX_COMPUTE_RINGS))

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_kiq_free_ring(struct · line 1485

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-		adev->gfx.num_compute_rings =

AMDGPU_MAX_COMPUTE_RINGS;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-}
-
  static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;
@@ -1513,7 +1476,7 @@ static int gfx_v8_0_mec_init(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -1
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v8_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
  	mec_hpd_size = adev->gfx.num_compute_rings *

GFX8_MEC_HPD_SIZE;

Review

Quoted 2 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_mec_fini(struct

Quoted 4 lines

index 9d675b3..3ea0e71 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -857,43 +857,6 @@ static void gfx_v9_0_mec_fini(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_mec_fini(struct · line 860

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
  	}
  }
 
-static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device

*adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -7
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_mec_fini(struct · line 877

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -10
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the

first MEC */

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_mec_fini(struct · line 889

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -12
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap,

AMDGPU_MAX_COMPUTE_QUEUES);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_mec_fini(struct · line 893

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -4
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings >

AMDGPU_MAX_COMPUTE_RINGS))

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_mec_fini(struct · line 894

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
-		adev->gfx.num_compute_rings =

AMDGPU_MAX_COMPUTE_RINGS;

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_mec_init(struct amdgpu_device

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
-}
-
  static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;
@@ -920,7 +883,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_mec_init(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v9_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
  	mec_hpd_size = adev->gfx.num_compute_rings *

GFX9_MEC_HPD_SIZE;

Quoted 1 line
Quoted 7 lines
Quoted 2 lines
  	if (adev->gfx.mec.hpd_eop_obj == NULL) {

_______________________________________________
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

Reviewed-by Alex Xie
#7 lore raw

Re: [PATCH 2/3] drm/amdgpu: move gfx_v*_0_compute_queue_acquire to common code

In reply to a message not in the archive
Quoted 232 lines · Alex Deucher

Same function was duplicated in all gfx IP files.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 37 +++++++++++++++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 ++
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 39 +--------------------------------
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 39 +--------------------------------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 +--------------------------------
  5 files changed, 42 insertions(+), 114 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +37 -0
index 1994335..51a9708 100644
@@ -108,3 +108,40 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s
  		p = next + 1;
  	}
  }
+
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)
+{
+	int i, queue, pipe, mec;
+
+	/* policy for amdgpu compute queue ownership */
+	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
+		queue = i % adev->gfx.mec.num_queue_per_pipe;
+		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
+			% adev->gfx.mec.num_pipe_per_mec;
+		mec = (i / adev->gfx.mec.num_queue_per_pipe)
+			/ adev->gfx.mec.num_pipe_per_mec;
+
+		/* we've run out of HW */
+		if (mec >= adev->gfx.mec.num_mec)
+			break;
+
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
+	}
+
+	/* update the number of active compute rings */
+	adev->gfx.num_compute_rings =
+		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
+
+	/* If you hit this case and edited the policy, you probably just
+	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
+	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
+		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
index 2d846ef..9b9ea6e 100644
@@ -30,6 +30,8 @@ void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);
  void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se,
  		unsigned max_sh);
 
+void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev);
+
  /**
   * amdgpu_gfx_create_bitmask - create a bitmask
   *
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -38
index 862bc72..6ffb2da 100644
@@ -2809,43 +2809,6 @@ static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)
  	}
  }
 
-static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
  static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;
@@ -2870,7 +2833,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v7_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
  	/* allocate space for ALL pipes (even the ones we don't own) */
  	mec_hpd_size = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -38
index 1370b39..cfa37f1 100644
@@ -1448,43 +1448,6 @@ static void gfx_v8_0_kiq_free_ring(struct amdgpu_ring *ring,
  	amdgpu_ring_fini(ring);
  }
 
-static void gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
  static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;
@@ -1513,7 +1476,7 @@ static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v8_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
 
  	mec_hpd_size = adev->gfx.num_compute_rings * GFX8_MEC_HPD_SIZE;
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -37
index 9d675b3..3ea0e71 100644
@@ -857,43 +857,6 @@ static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
  	}
  }
 
-static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)
-{
-	int i, queue, pipe, mec;
-
-	/* policy for amdgpu compute queue ownership */
-	for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) {
-		queue = i % adev->gfx.mec.num_queue_per_pipe;
-		pipe = (i / adev->gfx.mec.num_queue_per_pipe)
-			% adev->gfx.mec.num_pipe_per_mec;
-		mec = (i / adev->gfx.mec.num_queue_per_pipe)
-			/ adev->gfx.mec.num_pipe_per_mec;
-
-		/* we've run out of HW */
-		if (mec >= adev->gfx.mec.num_mec)
-			break;
-
-		if (adev->gfx.mec.num_mec > 1) {
-			/* policy: amdgpu owns the first two queues of the first MEC */
-			if (mec == 0 && queue < 2)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		} else {
-			/* policy: amdgpu owns all queues in the first pipe */
-			if (mec == 0 && pipe == 0)
-				set_bit(i, adev->gfx.mec.queue_bitmap);
-		}
-	}
-
-	/* update the number of active compute rings */
-	adev->gfx.num_compute_rings =
-		bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES);
-
-	/* If you hit this case and edited the policy, you probably just
-	 * need to increase AMDGPU_MAX_COMPUTE_RINGS */
-	if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS))
-		adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
-}
-
  static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
  {
  	int r;

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_mec_init(struct amdgpu_device *adev) · line 889

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -920,7 +883,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
  	adev->gfx.mec.num_queue_per_pipe = 8;
 
  	/* take ownership of the relevant compute queues */
-	gfx_v9_0_compute_queue_acquire(adev);
+	amdgpu_gfx_compute_queue_acquire(adev);
  	mec_hpd_size = adev->gfx.num_compute_rings * GFX9_MEC_HPD_SIZE;
 
  	if (adev->gfx.mec.hpd_eop_obj == NULL) {

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

#8 lore raw

PATCH 3/3 drm/amdgpu/gfx9: Raven has two MECs

In reply to a message not in the archive

This was missed when Andres' queue patches were rebased.

Fixes 42794b27 (drm/amdgpu: take ownership of per-pipe configuration v3)
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
index 3ea0e71..e0193e4 100644
@@ -872,6 +872,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
 
 	switch (adev->asic_type) {
 	case CHIP_VEGA10:
+	case CHIP_RAVEN:
 		adev->gfx.mec.num_mec = 2;
 		break;
 	default:
Signature · 6 lines
2.5.5

_______________________________________________
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): 1496848229-12761-3-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

Reviewed-by Alex Xie
#10 lore raw

Re: [PATCH 3/3] drm/amdgpu/gfx9: Raven has two MECs

Quoted 13 lines · Alex Deucher

This was missed when Andres' queue patches were rebased.

Fixes 42794b27 (drm/amdgpu: take ownership of per-pipe configuration v3)
---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 3ea0e71..e0193e4 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_mec_init(struct amdgpu_device *adev) · line 878

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
@@ -872,6 +872,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
 
  	switch (adev->asic_type) {
  	case CHIP_VEGA10:
+	case CHIP_RAVEN:
  		adev->gfx.mec.num_mec = 2;
  		break;
  	default:

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

#11 lore raw
In reply to a message not in the archive

Hi Alex,

In closed source driver, we assign compute queues to all 4 pipes always. There is no hangs.

May I know which ASIC?

Assign all queues in first pipe first mec can slow things down.

Thanks,

Alex Bin Xie

Quoted 69 lines · Alex Deucher

Fixes hangs on single MEC asics.

Fixes 2ed286fb434 (drm/amdgpu: new queue policy, take first 2 queues of each pipe v2)
---
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++++---
  3 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +9 -3
index 4c04e9d..862bc72 100644
@@ -2825,9 +2825,15 @@ static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +9 -3
index ad2e0bb..1370b39 100644
@@ -1464,9 +1464,15 @@ static void gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -3
index cf15a350..9d675b3 100644
@@ -873,9 +873,15 @@ static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev) · line 887

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -0
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */

_______________________________________________
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): d1b73074-136d-ccb0-a026-c795362d797b-5C7GfCeVMHo@public.gmane.org

#13 lore raw
Quoted 8 lines

-----Original Message-----
From: Xie, AlexBin
Sent: Wednesday, June 07, 2017 12:31 PM
To: Alex Deucher; [email protected]
Cc: Deucher, Alexander
Subject: Re: [PATCH 1/3] drm/amdgpu: fix mec queue policy on single MEC asics

Quoted 6 lines

Hi Alex,

In closed source driver, we assign compute queues to all 4 pipes always. There is no hangs.

May I know which ASIC?

It was reported on Stoney.

Alex

Quoted 101 lines

Assign all queues in first pipe first mec can slow things down.

Thanks,

Alex Bin Xie

Quoted 3 lines · Alex Deucher

Fixes hangs on single MEC asics.

Fixes 2ed286fb434 (drm/amdgpu: new queue policy, take first 2 queues of

each pipe v2)

Review

Quoted 8 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++++---
  3 files changed, 27 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void

Quoted 4 lines

index 4c04e9d..862bc72 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
@@ -2825,9 +2825,15 @@ static void

gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC

*/

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -2
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the

first MEC */

Review

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +7 -0
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void

Quoted 4 lines

index ad2e0bb..1370b39 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -1464,9 +1464,15 @@ static void

gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 1467

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC

*/

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 1468

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the

first MEC */

Review

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -0
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void

Quoted 4 lines

index cf15a350..9d675b3 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -873,9 +873,15 @@ static void

gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 876

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC

*/

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 877

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the

first MEC */

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -0
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void · line 887

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
  	/* update the number of active compute rings */

_______________________________________________
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): BN6PR12MB1652FFCD2FC9C923271C1475F7C80-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#15 lore raw

Hi Alex,

In Catalyst driver source code, Stoney is listed as supported, I don't know how well it is supported though. I think at least people have run some graphic operations.

What kind of hangs happens in Stoney? Is it a graphic operation hang? Or OpenCL? Or something else? How easily it is reproduced?

Stoney is similar to Carizzo. People has tried computes on Carrizo till Fiji in fglrx.

At least, we need to limit this change for Stoney only unless it is reported in other ASICs too.

This change can affect compute performance a lot. People are evaluating even the AMDGPU PRO OpenCL on FIJI, as far as I know.

Thanks,

Alex Bin

Quoted 116 lines · Alexander
Quoted 8 lines

-----Original Message-----
From: Xie, AlexBin
Sent: Wednesday, June 07, 2017 12:31 PM
To: Alex Deucher; [email protected]
Cc: Deucher, Alexander
Subject: Re: [PATCH 1/3] drm/amdgpu: fix mec queue policy on single MEC asics

Quoted 6 lines

Hi Alex,

In closed source driver, we assign compute queues to all 4 pipes always. There is no hangs.

May I know which ASIC?

It was reported on Stoney.

Alex

Quoted 13 lines

Assign all queues in first pipe first mec can slow things down.

Thanks,

Alex Bin Xie

Quoted 3 lines · Alex Deucher

Fixes hangs on single MEC asics.

Fixes 2ed286fb434 (drm/amdgpu: new queue policy, take first 2

queues of

Quoted 8 lines

each pipe v2)

Quoted 7 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++++---
  3 files changed, 27 insertions(+), 9 deletions(-)
Quoted 11 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void

Quoted 4 lines

index 4c04e9d..862bc72 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
@@ -2825,9 +2825,15 @@ static void

gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
             if (mec >= adev->gfx.mec.num_mec)
                     break;
 
-           /* policy: amdgpu owns the first two queues of the 

first MEC

Quoted 10 lines

*/

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -2
-           if (mec == 0 && queue < 2)
-                   set_bit(i, adev->gfx.mec.queue_bitmap);
+           if (adev->gfx.mec.num_mec > 1) {
+                   /* policy: amdgpu owns the first two queues of the

first MEC */

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -0
+                   if (mec == 0 && queue < 2)
+                           set_bit(i, adev->gfx.mec.queue_bitmap);
+           } else {
+                   /* policy: amdgpu owns all queues in the first 

pipe */

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -0
+                   if (mec == 0 && pipe == 0)
+                           set_bit(i, adev->gfx.mec.queue_bitmap);
+           }
     }
 
Quoted 12 lines

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
     /* update the number of active compute rings */
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void

Quoted 4 lines

index ad2e0bb..1370b39 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -1464,9 +1464,15 @@ static void

gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
             if (mec >= adev->gfx.mec.num_mec)
                     break;
 
-           /* policy: amdgpu owns the first two queues of the 

first MEC

Quoted 10 lines

*/

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 1468

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
-           if (mec == 0 && queue < 2)
-                   set_bit(i, adev->gfx.mec.queue_bitmap);
+           if (adev->gfx.mec.num_mec > 1) {
+                   /* policy: amdgpu owns the first two queues of the

first MEC */

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+                   if (mec == 0 && queue < 2)
+                           set_bit(i, adev->gfx.mec.queue_bitmap);
+           } else {
+                   /* policy: amdgpu owns all queues in the first 

pipe */

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+                   if (mec == 0 && pipe == 0)
+                           set_bit(i, adev->gfx.mec.queue_bitmap);
+           }
     }
 
Quoted 12 lines

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
     /* update the number of active compute rings */
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void

Quoted 4 lines

index cf15a350..9d675b3 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -873,9 +873,15 @@ static void

gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
             if (mec >= adev->gfx.mec.num_mec)
                     break;
 
-           /* policy: amdgpu owns the first two queues of the 

first MEC

Quoted 5 lines

*/

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
-           if (mec == 0 && queue < 2)
-                   set_bit(i, adev->gfx.mec.queue_bitmap);
+           if (adev->gfx.mec.num_mec > 1) {
+                   /* policy: amdgpu owns the first two queues of the
Quoted 13 lines
Quoted 5 lines

first MEC */

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -0
+                   if (mec == 0 && queue < 2)
+                           set_bit(i, adev->gfx.mec.queue_bitmap);
+           } else {
+                   /* policy: amdgpu owns all queues in the first 

pipe */

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+                   if (mec == 0 && pipe == 0)
+                           set_bit(i, adev->gfx.mec.queue_bitmap);
+           }
     }
 
     /* update the number of active compute rings */

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

Reviewed-by Alex Xie
#16 lore raw
In reply to a message not in the archive

Hi Alex

I agree that we revert the change for single MEC for the time being.

Quoted 69 lines · Alex Deucher

Fixes hangs on single MEC asics.

Fixes 2ed286fb434 (drm/amdgpu: new queue policy, take first 2 queues of each pipe v2)
---
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 +++++++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++++++++---
  3 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +9 -3
index 4c04e9d..862bc72 100644
@@ -2825,9 +2825,15 @@ static void gfx_v7_0_compute_queue_acquire(struct amdgpu_device *adev)
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +9 -3
index ad2e0bb..1370b39 100644
@@ -1464,9 +1464,15 @@ static void gfx_v8_0_compute_queue_acquire(struct amdgpu_device *adev)
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -3
index cf15a350..9d675b3 100644
@@ -873,9 +873,15 @@ static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev)
  		if (mec >= adev->gfx.mec.num_mec)
  			break;
 
-		/* policy: amdgpu owns the first two queues of the first MEC */
-		if (mec == 0 && queue < 2)
-			set_bit(i, adev->gfx.mec.queue_bitmap);
+		if (adev->gfx.mec.num_mec > 1) {
+			/* policy: amdgpu owns the first two queues of the first MEC */

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_compute_queue_acquire(struct amdgpu_device *adev) · line 887

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -0
+			if (mec == 0 && queue < 2)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		} else {
+			/* policy: amdgpu owns all queues in the first pipe */
+			if (mec == 0 && pipe == 0)
+				set_bit(i, adev->gfx.mec.queue_bitmap);
+		}
  	}
 
  	/* update the number of active compute rings */

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