All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii
@ 2019-04-17 20:54 Zhao, Yong
       [not found] ` <20190417205347.15051-1-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Zhao, Yong @ 2019-04-17 20:54 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Zhao, 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.

Change-Id: Iedfa07c94241e3252463e1e5ea537543c2ccef03
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
---
 .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 1d6b15788ebf..ec83914d9867 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -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;
 }
 
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii
       [not found] ` <20190417205347.15051-1-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
@ 2019-04-17 21:06   ` Kuehling, Felix
       [not found]     ` <a1713067-fd8f-87b5-cfe5-82ed45ed8f23-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Kuehling, Felix @ 2019-04-17 21:06 UTC (permalink / raw)
  To: Zhao, Yong, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2019-04-17 4:54 p.m., Zhao, Yong wrote:
> 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.


>
> Change-Id: Iedfa07c94241e3252463e1e5ea537543c2ccef03
> Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
> ---
>   .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 1d6b15788ebf..ec83914d9867 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -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.


>   	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;
>   }
>   
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii
       [not found]     ` <a1713067-fd8f-87b5-cfe5-82ed45ed8f23-5C7GfCeVMHo@public.gmane.org>
@ 2019-04-17 21:17       ` Zhao, Yong
       [not found]         ` <f22f11aa-ff44-1130-b058-1f125e957c97-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Zhao, Yong @ 2019-04-17 21:17 UTC (permalink / raw)
  To: Kuehling, Felix, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

On 2019-04-17 5:06 p.m., Kuehling, Felix wrote:
> On 2019-04-17 4:54 p.m., Zhao, Yong wrote:
>> 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.
>
>
>> Change-Id: Iedfa07c94241e3252463e1e5ea537543c2ccef03
>> Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
>> ---
>>    .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
>>    1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> index 1d6b15788ebf..ec83914d9867 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>> @@ -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.
>
>
>>    	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;
>>    }
>>    
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii
       [not found]         ` <f22f11aa-ff44-1130-b058-1f125e957c97-5C7GfCeVMHo@public.gmane.org>
@ 2019-04-17 21:44           ` Kuehling, Felix
       [not found]             ` <08aaa252-4aba-295f-f9d0-022635121efc-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Kuehling, Felix @ 2019-04-17 21:44 UTC (permalink / raw)
  To: Zhao, Yong, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

On 2019-04-17 5:17 p.m., Zhao, Yong wrote:
> 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
>
> On 2019-04-17 5:06 p.m., Kuehling, Felix wrote:
>> On 2019-04-17 4:54 p.m., Zhao, Yong wrote:
>>> 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.
>>
>>
>>> Change-Id: Iedfa07c94241e3252463e1e5ea537543c2ccef03
>>> Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
>>> ---
>>>     .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
>>>     1 file changed, 11 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> index 1d6b15788ebf..ec83914d9867 100644
>>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>> @@ -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.
>>
>>
>>>     	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;
>>>     }
>>>     
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii
       [not found]             ` <08aaa252-4aba-295f-f9d0-022635121efc-5C7GfCeVMHo@public.gmane.org>
@ 2019-04-17 22:06               ` Zhao, Yong
  0 siblings, 0 replies; 5+ messages in thread
From: Zhao, Yong @ 2019-04-17 22:06 UTC (permalink / raw)
  To: Kuehling, Felix, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Okay, I will abandon it.

Yong

On 2019-04-17 5:44 p.m., Kuehling, Felix wrote:
> 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
>
> On 2019-04-17 5:17 p.m., Zhao, Yong wrote:
>> 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
>>
>> On 2019-04-17 5:06 p.m., Kuehling, Felix wrote:
>>> On 2019-04-17 4:54 p.m., Zhao, Yong wrote:
>>>> 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.
>>>
>>>
>>>> Change-Id: Iedfa07c94241e3252463e1e5ea537543c2ccef03
>>>> Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
>>>> ---
>>>>      .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c   | 13 +++++++++++--
>>>>      1 file changed, 11 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>>> index 1d6b15788ebf..ec83914d9867 100644
>>>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
>>>> @@ -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.
>>>
>>>
>>>>      	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;
>>>>      }
>>>>      
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-17 22:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 20:54 [PATCH] drm/amdkfd: Disable Packet Manager in non HWS mode except Hawaii Zhao, Yong
     [not found] ` <20190417205347.15051-1-Yong.Zhao-5C7GfCeVMHo@public.gmane.org>
2019-04-17 21:06   ` Kuehling, Felix
     [not found]     ` <a1713067-fd8f-87b5-cfe5-82ed45ed8f23-5C7GfCeVMHo@public.gmane.org>
2019-04-17 21:17       ` Zhao, Yong
     [not found]         ` <f22f11aa-ff44-1130-b058-1f125e957c97-5C7GfCeVMHo@public.gmane.org>
2019-04-17 21:44           ` Kuehling, Felix
     [not found]             ` <08aaa252-4aba-295f-f9d0-022635121efc-5C7GfCeVMHo@public.gmane.org>
2019-04-17 22:06               ` Zhao, Yong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.