[PATCHv2] drm/amdkfd: Enable GWS on GFX9.4.3

Felix Kuehling felix.kuehling at amd.com
Fri Jun 16 22:03:59 UTC 2023


On 2023-06-16 14:44, Mukul Joshi wrote:
> Enable GWS capable queue creation for forward
> progress gaurantee on GFX 9.4.3.
>
> Signed-off-by: Mukul Joshi <mukul.joshi at amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


> ---
> v1->v2:
> - Update the condition for setting pqn->q->gws
>    for GFX 9.4.3.
>   drivers/gpu/drm/amd/amdkfd/kfd_device.c       |  1 +
>   .../amd/amdkfd/kfd_process_queue_manager.c    | 35 ++++++++++++-------
>   2 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index 9d4abfd8b55e..226d2dd7fa49 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -518,6 +518,7 @@ static int kfd_gws_init(struct kfd_node *node)
>   			&& kfd->mec2_fw_version >= 0x30)   ||
>   		(KFD_GC_VERSION(node) == IP_VERSION(9, 4, 2)
>   			&& kfd->mec2_fw_version >= 0x28) ||
> +		(KFD_GC_VERSION(node) == IP_VERSION(9, 4, 3)) ||
>   		(KFD_GC_VERSION(node) >= IP_VERSION(10, 3, 0)
>   			&& KFD_GC_VERSION(node) < IP_VERSION(11, 0, 0)
>   			&& kfd->mec2_fw_version >= 0x6b))))
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index 9ad1a2186a24..ba9d69054119 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -123,16 +123,24 @@ int pqm_set_gws(struct process_queue_manager *pqm, unsigned int qid,
>   	if (!gws && pdd->qpd.num_gws == 0)
>   		return -EINVAL;
>   
> -	if (gws)
> -		ret = amdgpu_amdkfd_add_gws_to_process(pdd->process->kgd_process_info,
> -			gws, &mem);
> -	else
> -		ret = amdgpu_amdkfd_remove_gws_from_process(pdd->process->kgd_process_info,
> -			pqn->q->gws);
> -	if (unlikely(ret))
> -		return ret;
> +	if (KFD_GC_VERSION(dev) != IP_VERSION(9, 4, 3)) {
> +		if (gws)
> +			ret = amdgpu_amdkfd_add_gws_to_process(pdd->process->kgd_process_info,
> +				gws, &mem);
> +		else
> +			ret = amdgpu_amdkfd_remove_gws_from_process(pdd->process->kgd_process_info,
> +				pqn->q->gws);
> +		if (unlikely(ret))
> +			return ret;
> +		pqn->q->gws = mem;
> +	} else {
> +		/*
> +		 * Intentionally set GWS to a non-NULL value
> +		 * for GFX 9.4.3.
> +		 */
> +		pqn->q->gws = gws ? ERR_PTR(-ENOMEM) : NULL;
> +	}
>   
> -	pqn->q->gws = mem;
>   	pdd->qpd.num_gws = gws ? dev->adev->gds.gws_size : 0;
>   
>   	return pqn->q->device->dqm->ops.update_queue(pqn->q->device->dqm,
> @@ -164,7 +172,8 @@ void pqm_uninit(struct process_queue_manager *pqm)
>   	struct process_queue_node *pqn, *next;
>   
>   	list_for_each_entry_safe(pqn, next, &pqm->queues, process_queue_list) {
> -		if (pqn->q && pqn->q->gws)
> +		if (pqn->q && pqn->q->gws &&
> +		    KFD_GC_VERSION(pqn->q->device) != IP_VERSION(9, 4, 3))
>   			amdgpu_amdkfd_remove_gws_from_process(pqm->process->kgd_process_info,
>   				pqn->q->gws);
>   		kfd_procfs_del_queue(pqn->q);
> @@ -446,8 +455,10 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)
>   		}
>   
>   		if (pqn->q->gws) {
> -			amdgpu_amdkfd_remove_gws_from_process(pqm->process->kgd_process_info,
> -				pqn->q->gws);
> +			if (KFD_GC_VERSION(pqn->q->device) != IP_VERSION(9, 4, 3))
> +				amdgpu_amdkfd_remove_gws_from_process(
> +						pqm->process->kgd_process_info,
> +						pqn->q->gws);
>   			pdd->qpd.num_gws = 0;
>   		}
>   


More information about the amd-gfx mailing list