Skip to contentSkip to conversation

drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii

PATCH In review Zhao, Yong 2 participants 5 messages Apr 17, 2019 4 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Zhao, Yong

author
#0 lore raw

PATCH 1/1 drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii

The packet manager is only needed for HWS mode, as well as Hawaii in non HWS mode. So only initialize it under those scenarios. This is useful especially for emulation environment when things are slow.

Change-Id Iedfa07c94241e3252463e1e5ea537543c2ccef03
---
 .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +11 -2
index 1d6b15788ebf..ec83914d9867 100644
@@ -911,13 +911,22 @@ static void uninitialize(struct device_queue_manager *dqm)
 
 static int start_nocpsch(struct device_queue_manager *dqm)
 {
+	int ret = 0;
 	init_interrupts(dqm);
-	return pm_init(&dqm->packets, dqm);
+	/* Cache flushing on Hawaii in non HWS mode is done through packet
+	 * manager (PM), so we need to initialize PM for Hawaii.
+	 */
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		ret = pm_init(&dqm->packets, dqm);
+
+	return ret;
 }
 
 static int stop_nocpsch(struct device_queue_manager *dqm)
 {
-	pm_uninit(&dqm->packets);
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		pm_uninit(&dqm->packets);
+
 	return 0;
 }
 
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): [email protected]

#2 lore raw
Quoted 3 lines · Yong

The packet manager is only needed for HWS mode, as well as Hawaii in non HWS mode. So only initialize it under those scenarios. This is useful especially for emulation environment when things are slow.

I never thought of packet manager initialization as something expensive. Why does this matter? In emulation, the GPU is slow, but the CPU should be OK. Packet manager initialization doesn't do any waiting for the GPU, so I don't see how this would have any measurable impact.

Anyway, see one cosmetic comment inline.

Quoted 12 lines
Change-Id Iedfa07c94241e3252463e1e5ea537543c2ccef03
---
  .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
index 1d6b15788ebf..ec83914d9867 100644

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 914

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -0
@@ -911,13 +911,22 @@ static void uninitialize(struct device_queue_manager *dqm)
 
  static int start_nocpsch(struct device_queue_manager *dqm)
  {
+	int ret = 0;

checkpatch.pl would complain that there should be an empty line after variable declarations.

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +7 -1
  	init_interrupts(dqm);
-	return pm_init(&dqm->packets, dqm);
+	/* Cache flushing on Hawaii in non HWS mode is done through packet
+	 * manager (PM), so we need to initialize PM for Hawaii.
+	 */
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		ret = pm_init(&dqm->packets, dqm);
+
+	return ret;
  }

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 932

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -1
 
  static int stop_nocpsch(struct device_queue_manager *dqm)
  {
-	pm_uninit(&dqm->packets);
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		pm_uninit(&dqm->packets);
+
  	return 0;
  }
 

_______________________________________________
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): a1713067-fd8f-87b5-cfe5-82ed45ed8f23-5C7GfCeVMHo@public.gmane.org

author
#4 lore raw

I can fix that cosmetic line. I did not measure the difference, but driver initialization usually takes a longer time, that's why I am trying to reduce it. Also, it means one less thing to worry about during non HWS mode bringup, because we don't need to deal with HIQ any more. With that, what do you think now?

Regards,

Yong

Quoted 42 lines · Felix
Quoted 3 lines · Yong

The packet manager is only needed for HWS mode, as well as Hawaii in non HWS mode. So only initialize it under those scenarios. This is useful especially for emulation environment when things are slow.

I never thought of packet manager initialization as something expensive. Why does this matter? In emulation, the GPU is slow, but the CPU should be OK. Packet manager initialization doesn't do any waiting for the GPU, so I don't see how this would have any measurable impact.

Anyway, see one cosmetic comment inline.

Quoted 11 lines
Change-Id Iedfa07c94241e3252463e1e5ea537543c2ccef03
---
   .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
   1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
index 1d6b15788ebf..ec83914d9867 100644

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 914

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -0
@@ -911,13 +911,22 @@ static void uninitialize(struct device_queue_manager *dqm)
 
   static int start_nocpsch(struct device_queue_manager *dqm)
   {
+	int ret = 0;

checkpatch.pl would complain that there should be an empty line after variable declarations.

Quoted 11 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +7 -1
   	init_interrupts(dqm);
-	return pm_init(&dqm->packets, dqm);
+	/* Cache flushing on Hawaii in non HWS mode is done through packet
+	 * manager (PM), so we need to initialize PM for Hawaii.
+	 */
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		ret = pm_init(&dqm->packets, dqm);
+
+	return ret;
   }
 
Quoted 9 lines

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 932

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -1
   static int stop_nocpsch(struct device_queue_manager *dqm)
   {
-	pm_uninit(&dqm->packets);
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		pm_uninit(&dqm->packets);
+
   	return 0;
   }
 

_______________________________________________
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): f22f11aa-ff44-1130-b058-1f125e957c97-5C7GfCeVMHo@public.gmane.org

#6 lore raw

If you want to optimize driver init time, you should check what actually takes the most time. Randomly micro-optimizing things that may not even matter only increases complexity for no benefit.

Typically the things that make initialization slow are points where we synchronize with the GPU or random sleeps or delays to allow the hardware to complete something. A few lines of code that only run on the CPU will not make an appreciable difference.

Regards,
  Felix

Quoted 53 lines · Yong

I can fix that cosmetic line. I did not measure the difference, but driver initialization usually takes a longer time, that's why I am trying to reduce it. Also, it means one less thing to worry about during non HWS mode bringup, because we don't need to deal with HIQ any more. With that, what do you think now?

Regards,

Yong

Quoted 42 lines · Felix
Quoted 3 lines · Yong

The packet manager is only needed for HWS mode, as well as Hawaii in non HWS mode. So only initialize it under those scenarios. This is useful especially for emulation environment when things are slow.

I never thought of packet manager initialization as something expensive. Why does this matter? In emulation, the GPU is slow, but the CPU should be OK. Packet manager initialization doesn't do any waiting for the GPU, so I don't see how this would have any measurable impact.

Anyway, see one cosmetic comment inline.

Quoted 11 lines
Change-Id Iedfa07c94241e3252463e1e5ea537543c2ccef03
---
    .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
    1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
index 1d6b15788ebf..ec83914d9867 100644

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 914

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -0
@@ -911,13 +911,22 @@ static void uninitialize(struct device_queue_manager *dqm)
 
    static int start_nocpsch(struct device_queue_manager *dqm)
    {
+	int ret = 0;

checkpatch.pl would complain that there should be an empty line after variable declarations.

Quoted 11 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +7 -1
    	init_interrupts(dqm);
-	return pm_init(&dqm->packets, dqm);
+	/* Cache flushing on Hawaii in non HWS mode is done through packet
+	 * manager (PM), so we need to initialize PM for Hawaii.
+	 */
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		ret = pm_init(&dqm->packets, dqm);
+
+	return ret;
    }
 
Quoted 13 lines
Quoted 9 lines

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 932

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -1
    static int stop_nocpsch(struct device_queue_manager *dqm)
    {
-	pm_uninit(&dqm->packets);
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		pm_uninit(&dqm->packets);
+
    	return 0;
    }
 

_______________________________________________
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): 08aaa252-4aba-295f-f9d0-022635121efc-5C7GfCeVMHo@public.gmane.org

author
#8 lore raw

Okay, I will abandon it.

Yong

Quoted 9 lines · Felix

If you want to optimize driver init time, you should check what actually takes the most time. Randomly micro-optimizing things that may not even matter only increases complexity for no benefit.

Typically the things that make initialization slow are points where we synchronize with the GPU or random sleeps or delays to allow the hardware to complete something. A few lines of code that only run on the CPU will not make an appreciable difference.

Quoted 70 lines

Regards,
  Felix

Quoted 66 lines · Yong

I can fix that cosmetic line. I did not measure the difference, but driver initialization usually takes a longer time, that's why I am trying to reduce it. Also, it means one less thing to worry about during non HWS mode bringup, because we don't need to deal with HIQ any more. With that, what do you think now?

Regards,

Yong

Quoted 42 lines · Felix
Quoted 3 lines · Yong

The packet manager is only needed for HWS mode, as well as Hawaii in non HWS mode. So only initialize it under those scenarios. This is useful especially for emulation environment when things are slow.

I never thought of packet manager initialization as something expensive. Why does this matter? In emulation, the GPU is slow, but the CPU should be OK. Packet manager initialization doesn't do any waiting for the GPU, so I don't see how this would have any measurable impact.

Anyway, see one cosmetic comment inline.

Quoted 11 lines
Change-Id Iedfa07c94241e3252463e1e5ea537543c2ccef03
---
     .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
     1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
index 1d6b15788ebf..ec83914d9867 100644

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 914

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -0
@@ -911,13 +911,22 @@ static void uninitialize(struct device_queue_manager *dqm)
 
     static int start_nocpsch(struct device_queue_manager *dqm)
     {
+	int ret = 0;

checkpatch.pl would complain that there should be an empty line after variable declarations.

Quoted 11 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +7 -1
     	init_interrupts(dqm);
-	return pm_init(&dqm->packets, dqm);
+	/* Cache flushing on Hawaii in non HWS mode is done through packet
+	 * manager (PM), so we need to initialize PM for Hawaii.
+	 */
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		ret = pm_init(&dqm->packets, dqm);
+
+	return ret;
     }
 
Quoted 9 lines

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static void uninitialize(struct device_queue_manager *dqm) · line 932

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -1
     static int stop_nocpsch(struct device_queue_manager *dqm)
     {
-	pm_uninit(&dqm->packets);
+	if (dqm->dev->device_info->asic_family == CHIP_HAWAII)
+		pm_uninit(&dqm->packets);
+
     	return 0;
     }
 

_______________________________________________
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