[PATCH] drm/amdkfd: Optimize svm range map to GPU with XNACK on
Felix Kuehling
felix.kuehling at amd.com
Thu Apr 27 16:35:59 UTC 2023
On 2023-04-24 14:38, Philip Yang wrote:
> With XNACK on if svm_range_set_attr set the range access or
> access_in_place attribute, we don't call svm_range_validate_and_map to
> update GPU mapping. This avoids prefaulting the range pages on system
> memory if the range is not prefetch to VRAM and not mapped to GPUs.
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 129ef44f41e9..af7594b1b4c6 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -734,7 +734,9 @@ svm_range_apply_attrs(struct kfd_process *p, struct svm_range *prange,
> case KFD_IOCTL_SVM_ATTR_ACCESS:
> case KFD_IOCTL_SVM_ATTR_ACCESS_IN_PLACE:
> case KFD_IOCTL_SVM_ATTR_NO_ACCESS:
> - *update_mapping = true;
> + if (!p->xnack_enabled)
> + *update_mapping = true;
> +
For NO_ACCESS we need to update the mapping to ensure that the PTEs are
invalidated. For ACCESS or ACCESS_IN_PLACE we can leave it for a page fault.
Regards,
Felix
> gpuidx = kfd_process_gpuidx_from_gpuid(p,
> attrs[i].value);
> if (attrs[i].type == KFD_IOCTL_SVM_ATTR_NO_ACCESS) {
More information about the amd-gfx
mailing list