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

Felix Kuehling felix.kuehling at amd.com
Fri Jun 16 18:15:58 UTC 2023


On 2023-06-16 13:59, 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>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_device.c       |  1 +
>   .../amd/amdkfd/kfd_process_queue_manager.c    | 31 ++++++++++++-------
>   2 files changed, 20 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..9a091d8f9aaf 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,20 @@ 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 {
> +		pqn->q->gws = ERR_PTR(-ENOMEM);

I think this needs to be

	pqn->q->gws = gws ? ERR_PTR(-ENOMEM) : NULL;

Regards,
   Felix


> +	}
>   
> -	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 +168,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 +451,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