drm/amdgpu: make VMID assignment more fair
Subsystems (2)
PATCH 1/8 drm/amdgpu: make VMID assignment more fair
To guarantee fairness between processes grab reserved VMID only when there is an idle one.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +7 -5
@@ -268,11 +268,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,int r =0 ;mutex_lock (&id_mgr->lock); -if (vm->reserved_vmid[vmhub]) { - r =amdgpu_vmid_grab_reserved_locked (vm, ring, sync, fence, job); -mutex_unlock (&id_mgr->lock); -return r; - } fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL );if (!fences) {mutex_unlock (&id_mgr->lock);
@@ -319,6 +314,13 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, }kfree (fences); +if (vm->reserved_vmid[vmhub]) { + r =amdgpu_vmid_grab_reserved_locked (vm, ring, sync, + fence, job); +mutex_unlock (&id_mgr->lock); +return r; + } + job->vm_needs_flush = vm->use_cpu_for_update;/* Check if we can use a VMID already assigned to this VM */ list_for_each_entry_reverse (id, &id_mgr->ids_lru, list) {
Signature · 6 lines
2.14.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): 20180131154756.3374-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/8 drm/amdgpu: split finding idle VMID into separate function
No functional change, but makes it easier to maintain the code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 116 +++++++++++++++++++------------- 1 file changed, 69 insertions(+), 47 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +69 -47
@@ -182,6 +182,72 @@ bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev,atomic_read (&adev->gpu_reset_counter); } +/** +* amdgpu_vm_grab_idle - grab idle VMID +* +* @vm: vm to allocate id for +* @ring: ring we want to submit job to +* @sync: sync object where we add dependencies +* @idle: resulting idle VMID +* +* Try to find an idle VMID, if none is idle add a fence to wait to the sync +* object. Returns -ENOMEM when we are out of memory. +*/ +static int amdgpu_vmid_grab_idle (struct amdgpu_vm *vm, +struct amdgpu_ring *ring, +struct amdgpu_sync *sync, +struct amdgpu_vmid **idle) +{ +struct amdgpu_device *adev = ring->adev; +unsigned vmhub = ring->funcs->vmhub; +struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; +struct dma_fence **fences; +unsigned i; +int r; + + fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL ); +if (!fences) +return -ENOMEM ; + +/* Check if we have an idle VMID */ + i =0 ; +list_for_each_entry ((*idle), &id_mgr->ids_lru, list) { + fences[i] =amdgpu_sync_peek_fence (&(*idle)->active, ring); +if (!fences[i]) +break ; + ++i; + } + +/* If we can't find a idle VMID to use, wait till one becomes available */ +if (&(*idle)->list == &id_mgr->ids_lru) { +u64 fence_context = adev->vm_manager.fence_context + ring->idx; +unsigned seqno = ++adev->vm_manager.seqno[ring->idx]; +struct dma_fence_array *array; +unsigned j; + + *idle =NULL ; +for (j =0 ; j < i; ++j) +dma_fence_get (fences[j]); + + array =dma_fence_array_create (i, fences, fence_context, + seqno, true); +if (!array) { +for (j =0 ; j < i; ++j) +dma_fence_put (fences[j]); +kfree (fences); +return -ENOMEM ; + } + + r =amdgpu_sync_fence (adev, sync, &array->base, false); +dma_fence_put (&array->base); +return r; + + } +kfree (fences); + +return 0 ; +} +/* idr_mgr->lock must be held */ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
@@ -263,56 +329,12 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,uint64_t fence_context = adev->fence_context + ring->idx;struct dma_fence *updates = sync->last_vm_update;struct amdgpu_vmid *id, *idle; -struct dma_fence **fences; -unsigned i;int r =0 ;mutex_lock (&id_mgr->lock); - fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL ); -if (!fences) { -mutex_unlock (&id_mgr->lock); -return -ENOMEM ; - } -/* Check if we have an idle VMID */ - i =0 ; -list_for_each_entry (idle, &id_mgr->ids_lru, list) { - fences[i] =amdgpu_sync_peek_fence (&idle->active, ring); -if (!fences[i]) -break ; - ++i; - } - -/* If we can't find a idle VMID to use, wait till one becomes available */ -if (&idle->list == &id_mgr->ids_lru) { -u64 fence_context = adev->vm_manager.fence_context + ring->idx; -unsigned seqno = ++adev->vm_manager.seqno[ring->idx]; -struct dma_fence_array *array; -unsigned j; - -for (j =0 ; j < i; ++j) -dma_fence_get (fences[j]); - - array =dma_fence_array_create (i, fences, fence_context, - seqno, true); -if (!array) { -for (j =0 ; j < i; ++j) -dma_fence_put (fences[j]); -kfree (fences); - r = -ENOMEM ; - goto error; - } - - - r =amdgpu_sync_fence (ring->adev, sync, &array->base, false); -dma_fence_put (&array->base); -if (r) - goto error; - -mutex_unlock (&id_mgr->lock); -return 0 ; - - } -kfree (fences); + r =amdgpu_vmid_grab_idle (vm, ring, sync, &idle); +if (r || !idle) + goto error;if (vm->reserved_vmid[vmhub]) { r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync,
Signature · 6 lines
2.14.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): 20180131154756.3374-2-christian.koenig-5C7GfCeVMHo@public.gmane.org
Chunming Zhou
Reviewed-byRe: [PATCH 2/8] drm/amdgpu: split finding idle VMID into separate function
Quoted 134 lines · Christian König
No functional change, but makes it easier to maintain the code.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 116 +++++++++++++++++++------------- 1 file changed, 69 insertions(+), 47 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +66
-43@@ -182,6 +182,72 @@ bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev,atomic_read (&adev->gpu_reset_counter); } +/** +* amdgpu_vm_grab_idle - grab idle VMID +* +* @vm: vm to allocate id for +* @ring: ring we want to submit job to +* @sync: sync object where we add dependencies +* @idle: resulting idle VMID +* +* Try to find an idle VMID, if none is idle add a fence to wait to the sync +* object. Returns -ENOMEM when we are out of memory. +*/ +static int amdgpu_vmid_grab_idle (struct amdgpu_vm *vm, +struct amdgpu_ring *ring, +struct amdgpu_sync *sync, +struct amdgpu_vmid **idle) +{ +struct amdgpu_device *adev = ring->adev; +unsigned vmhub = ring->funcs->vmhub; +struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; +struct dma_fence **fences; +unsigned i; +int r; + + fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL ); +if (!fences) +return -ENOMEM ; + +/* Check if we have an idle VMID */ + i =0 ; +list_for_each_entry ((*idle), &id_mgr->ids_lru, list) { + fences[i] =amdgpu_sync_peek_fence (&(*idle)->active, ring); +if (!fences[i]) +break ; + ++i; + } + +/* If we can't find a idle VMID to use, wait till one becomes available */ +if (&(*idle)->list == &id_mgr->ids_lru) { +u64 fence_context = adev->vm_manager.fence_context + ring->idx; +unsigned seqno = ++adev->vm_manager.seqno[ring->idx]; +struct dma_fence_array *array; +unsigned j; + + *idle =NULL ; +for (j =0 ; j < i; ++j) +dma_fence_get (fences[j]); + + array =dma_fence_array_create (i, fences, fence_context, + seqno, true); +if (!array) { +for (j =0 ; j < i; ++j) +dma_fence_put (fences[j]); +kfree (fences); +return -ENOMEM ; + } + + r =amdgpu_sync_fence (adev, sync, &array->base, false); +dma_fence_put (&array->base); +return r; + + } +kfree (fences); + +return 0 ; +} +/* idr_mgr->lock must be held */ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, struct amdgpu_ring *ring,@@ -263,56 +329,12 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,uint64_t fence_context = adev->fence_context + ring->idx;struct dma_fence *updates = sync->last_vm_update;struct amdgpu_vmid *id, *idle; -struct dma_fence **fences; -unsigned i;int r =0 ;mutex_lock (&id_mgr->lock); - fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL ); -if (!fences) { -mutex_unlock (&id_mgr->lock); -return -ENOMEM ; - } -/* Check if we have an idle VMID */ - i =0 ; -list_for_each_entry (idle, &id_mgr->ids_lru, list) { - fences[i] =amdgpu_sync_peek_fence (&idle->active, ring); -if (!fences[i]) -break ; - ++i; - } - -/* If we can't find a idle VMID to use, wait till one becomes available */ -if (&idle->list == &id_mgr->ids_lru) { -u64 fence_context = adev->vm_manager.fence_context + ring->idx; -unsigned seqno = ++adev->vm_manager.seqno[ring->idx]; -struct dma_fence_array *array; -unsigned j; - -for (j =0 ; j < i; ++j) -dma_fence_get (fences[j]); - - array =dma_fence_array_create (i, fences, fence_context, - seqno, true); -if (!array) { -for (j =0 ; j < i; ++j) -dma_fence_put (fences[j]); -kfree (fences); - r = -ENOMEM ; - goto error; - } - - - r =amdgpu_sync_fence (ring->adev, sync, &array->base, false); -dma_fence_put (&array->base); -if (r) - goto error; - -mutex_unlock (&id_mgr->lock);
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · line 340
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +3
-4-return 0 ; - - } -kfree (fences); + r =amdgpu_vmid_grab_idle (vm, ring, sync, &idle); +if (r || !idle) + goto error;if (vm->reserved_vmid[vmhub]) { r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/8 drm/amdgpu: make VMID owner none atomic
In reply to a message not in the archiveThe variable is protected by the VMID mutex anyway.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 10 +++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +5 -5
@@ -267,7 +267,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, flushed = id->flushed_updates; if ((amdgpu_vmid_had_gpu_reset(adev, id)) || - (atomic64_read(&id->owner) != vm->entity.fence_context) || + (id->owner != vm->entity.fence_context) || (job->vm_pd_addr != id->pd_gpu_addr) || (updates && (!flushed || updates->context != flushed->context || dma_fence_is_later(updates, flushed))) ||
@@ -296,7 +296,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, id->flushed_updates =dma_fence_get (updates); } id->pd_gpu_addr = job->vm_pd_addr; -atomic64_set (&id->owner, vm->entity.fence_context); + id->owner = vm->entity.fence_context; job->vm_needs_flush = needs_flush;if (needs_flush) {dma_fence_put (id->last_flush);
@@ -353,7 +353,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,if (amdgpu_vmid_had_gpu_reset (adev, id))continue ; -if (atomic64_read (&id->owner) != vm->entity.fence_context) +if (id->owner != vm->entity.fence_context)continue ;if (job->vm_pd_addr != id->pd_gpu_addr)
@@ -402,7 +402,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, id->pd_gpu_addr = job->vm_pd_addr;dma_fence_put (id->flushed_updates); id->flushed_updates =dma_fence_get (updates); -atomic64_set (&id->owner, vm->entity.fence_context); + id->owner = vm->entity.fence_context; needs_flush: job->vm_needs_flush = true;
@@ -482,7 +482,7 @@ void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub,struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];struct amdgpu_vmid *id = &id_mgr->ids[vmid]; -atomic64_set (&id->owner,0 ); + id->owner =0 ; id->gds_base =0 ; id->gds_size =0 ; id->gws_base =0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h +1 -1
@@ -43,7 +43,7 @@ struct amdgpu_vmid {struct list_head list;struct amdgpu_sync active;struct dma_fence *last_flush; -atomic64_t owner; +uint64_t owner;uint64_t pd_gpu_addr;/* last flushed PD/PT update */
Signature · 6 lines
2.14.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): 20180131154756.3374-3-christian.koenig-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 3/8] drm/amdgpu: make VMID owner none atomic
Quoted 49 lines · Christian König
The variable is protected by the VMID mutex anyway.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 10 +++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +4
-4@@ -267,7 +267,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, flushed = id->flushed_updates; if ((amdgpu_vmid_had_gpu_reset(adev, id)) || - (atomic64_read(&id->owner) != vm->entity.fence_context) || + (id->owner != vm->entity.fence_context) || (job->vm_pd_addr != id->pd_gpu_addr) || (updates && (!flushed || updates->context != flushed->context || dma_fence_is_later(updates, flushed))) ||@@ -296,7 +296,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, id->flushed_updates =dma_fence_get (updates); } id->pd_gpu_addr = job->vm_pd_addr; -atomic64_set (&id->owner, vm->entity.fence_context); + id->owner = vm->entity.fence_context; job->vm_needs_flush = needs_flush;if (needs_flush) {dma_fence_put (id->last_flush);@@ -353,7 +353,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,if (amdgpu_vmid_had_gpu_reset (adev, id))continue ; -if (atomic64_read (&id->owner) != vm->entity.fence_context) +if (id->owner != vm->entity.fence_context)continue ;if (job->vm_pd_addr != id->pd_gpu_addr)@@ -402,7 +402,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, id->pd_gpu_addr = job->vm_pd_addr;dma_fence_put (id->flushed_updates); id->flushed_updates =dma_fence_get (updates); -atomic64_set (&id->owner, vm->entity.fence_context); + id->owner = vm->entity.fence_context; needs_flush: job->vm_needs_flush = true;
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub, · line 485
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +1
-1@@ -482,7 +482,7 @@ void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub,struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];struct amdgpu_vmid *id = &id_mgr->ids[vmid]; -atomic64_set (&id->owner,0 ); + id->owner =0 ;
here is not protect by id_mgr mutex, you can make another patch to add mutex for this function.
Regards,
David Zhou
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-0id->gds_base =0 ; id->gds_size =0 ; id->gws_base =0 ;drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h struct amdgpu_vmid { · line 49
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h +1
-1@@ -43,7 +43,7 @@ struct amdgpu_vmid {struct list_head list;struct amdgpu_sync active;struct dma_fence *last_flush; -atomic64_t owner; +uint64_t owner;uint64_t pd_gpu_addr;/* last flushed PD/PT update */
_______________________________________________
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): bcaaf808-e368-b386-946c-e6cbdaad690b-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 3/8] drm/amdgpu: make VMID owner none atomic
Am 01.02.2018 um 06:44 schrieb Chunming Zhou:
Quoted 50 lines · Christian König
Quoted 47 lines
The variable is protected by the VMID mutex anyway.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c| 10 +++++-----drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h| 2 +-2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-0@@ -267,7 +267,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, flushed = id->flushed_updates;if ((
amdgpu_vmid_had_gpu_reset(adev, id)) ||
- (atomic64_read(&id->owner)!=vm->entity.fence_context) ||+ (id->owner != vm->entity.fence_context) || (job->vm_pd_addr != id->pd_gpu_addr) ||(updates && (!flushed ||
updates->context!=flushed->context||dma_fence_is_later(updates, flushed))) ||drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +1
-1@@ -296,7 +296,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, id->flushed_updates = dma_fence_get(updates); } id->pd_gpu_addr = job->vm_pd_addr; - atomic64_set(&id->owner, vm->entity.fence_context); + id->owner = vm->entity.fence_context; job->vm_needs_flush = needs_flush; if (needs_flush) {
dma_fence_put(id->last_flush);drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +2
-1@@ -353,7 +353,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, structamdgpu_ring *ring, if (amdgpu_vmid_had_gpu_reset(adev, id)) continue; - if (atomic64_read(&id->owner) != vm->entity.fence_context) + if (id->owner != vm->entity.fence_context) continue; if (job->vm_pd_addr != id->pd_gpu_addr)@@ -402,7 +402,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, structamdgpu_ring *ring, id->pd_gpu_addr = job->vm_pd_addr; dma_fence_put(id->flushed_updates); id->flushed_updates = dma_fence_get(updates); - atomic64_set(&id->owner, vm->entity.fence_context); + id->owner = vm->entity.fence_context;
needs_flush:
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c void amdgpu_vmid_reset(struct amdgpu_device · line 486
Quoted 7 lines
job->vm_needs_flush= true;drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +1
-0@@ -482,7 +482,7 @@ void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub, struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; struct amdgpu_vmid *id = &id_mgr->ids[vmid]; - atomic64_set(&id->owner, 0); + id->owner = 0;here is not protect by
id_mgrmutex, you can make another patch to add mutex for this function.
That function is only called in case of suspend/resume and GPU reset, but adding the extra mutex here probably won't hurt and is indeed cleaner.
Christian.
Quoted 19 lines
Regards,
David ZhouQuoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-0id->gds_base = 0; id->gds_size = 0;
id->gws_base= 0;drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h struct amdgpu_vmid { · line 48
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h +1
-1@@ -43,7 +43,7 @@ struct amdgpu_vmid { struct list_head list; struct amdgpu_sync active; struct dma_fence *last_flush; - atomic64_t owner; + uint64_t owner; uint64_t pd_gpu_addr; /* last flushed PD/PT update */
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/8 drm/amdgpu: stop checking GPU reset counter during VMID grab
In reply to a message not in the archiveWe do this later on when we flush the VMID anyway.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +1 -5
@@ -266,8 +266,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,bool needs_flush = vm->use_cpu_for_update; flushed = id->flushed_updates; - if ((amdgpu_vmid_had_gpu_reset(adev, id)) || - (id->owner != vm->entity.fence_context) || + if ((id->owner != vm->entity.fence_context) || (job->vm_pd_addr != id->pd_gpu_addr) || (updates && (!flushed || updates->context != flushed->context || dma_fence_is_later(updates, flushed))) ||
@@ -350,9 +349,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,bool needs_flush = vm->use_cpu_for_update;/* Check all the prerequisites to using this VMID */ -if (amdgpu_vmid_had_gpu_reset (adev, id)) -continue ; -if (id->owner != vm->entity.fence_context)continue ;
Signature · 6 lines
2.14.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): 20180131154756.3374-4-christian.koenig-5C7GfCeVMHo@public.gmane.org
Chunming Zhou
Reviewed-byRe: [PATCH 4/8] drm/amdgpu: stop checking GPU reset counter during VMID grab
Quoted 22 lines · Christian König
We do this later on when we flush the VMID anyway.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +1
-2@@ -266,8 +266,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,bool needs_flush = vm->use_cpu_for_update; flushed = id->flushed_updates; - if ((amdgpu_vmid_had_gpu_reset(adev, id)) || - (id->owner != vm->entity.fence_context) || + if ((id->owner != vm->entity.fence_context) || (job->vm_pd_addr != id->pd_gpu_addr) || (updates && (!flushed || updates->context != flushed->context || dma_fence_is_later(updates, flushed))) ||
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · line 354
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-3@@ -350,9 +349,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,bool needs_flush = vm->use_cpu_for_update;/* Check all the prerequisites to using this VMID */ -if (amdgpu_vmid_had_gpu_reset (adev, id)) -continue ; -if (id->owner != vm->entity.fence_context)continue ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/8 drm/amdgpu: cleanup and simplify amdgpu_vmid_grab_reserved
In reply to a message not in the archiveDrop the "_locked" from the name, cleanup and simplify the logic a bit. Add missing comments.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 58 ++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +35 -23
@@ -248,12 +248,22 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm,return 0 ; } -/* idr_mgr->lock must be held */ -static int amdgpu_vmid_grab_reserved_locked (struct amdgpu_vm *vm, -struct amdgpu_ring *ring, -struct amdgpu_sync *sync, -struct dma_fence *fence, -struct amdgpu_job *job) +/** +* amdgpu_vm_grab_reserved - try to assign reserved VMID +* +* @vm: vm to allocate id for +* @ring: ring we want to submit job to +* @sync: sync object where we add dependencies +* @fence: fence protecting ID from reuse +* @job: job who wants to use the VMID +* +* Try to assign a reserved VMID. +*/ +static int amdgpu_vmid_grab_reserved (struct amdgpu_vm *vm, +struct amdgpu_ring *ring, +struct amdgpu_sync *sync, +struct dma_fence *fence, +struct amdgpu_job *job) {struct amdgpu_device *adev = ring->adev;unsigned vmhub = ring->funcs->vmhub;
@@ -261,18 +271,21 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,struct amdgpu_vmid *id = vm->reserved_vmid[vmhub];struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];struct dma_fence *updates = sync->last_vm_update; -int r =0 ; -struct dma_fence *flushed, *tmp;bool needs_flush = vm->use_cpu_for_update; +int r =0 ; + +if (updates && id->flushed_updates && + updates->context == id->flushed_updates->context && + !dma_fence_is_later (updates, id->flushed_updates)) + updates =NULL ; + +if (id->owner != vm->entity.fence_context || + job->vm_pd_addr != id->pd_gpu_addr || + updates || !id->last_flush || + (id->last_flush->context != fence_context && + !dma_fence_is_signaled (id->last_flush))) { +struct dma_fence *tmp; - flushed = id->flushed_updates; -if ((id->owner != vm->entity.fence_context) || - (job->vm_pd_addr != id->pd_gpu_addr) || - (updates && (!flushed || updates->context != flushed->context || -dma_fence_is_later (updates, flushed))) || - (!id->last_flush || (id->last_flush->context != fence_context && - !dma_fence_is_signaled (id->last_flush)))) { - needs_flush = true;/* to prevent one context starved by another context */ id->pd_gpu_addr =0 ; tmp =amdgpu_sync_peek_fence (&id->active, ring);
@@ -280,6 +293,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, r =amdgpu_sync_fence (adev, sync, tmp, false);return r; } + needs_flush = true; }/* Good we can use this VMID. Remember this submission as
@@ -287,10 +301,9 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,*/ r =amdgpu_sync_fence (ring->adev, &id->active, fence, false);if (r) - goto out; +return r; -if (updates && (!flushed || updates->context != flushed->context || -dma_fence_is_later (updates, flushed))) { +if (updates) {dma_fence_put (id->flushed_updates); id->flushed_updates =dma_fence_get (updates); }
@@ -304,8 +317,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, job->vmid = id - id_mgr->ids; job->pasid = vm->pasid;trace_amdgpu_vm_grab_id (vm, ring, job); -out: -return r; +return 0 ; }/**
@@ -315,6 +327,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,* @ring: ring we want to submit job to * @sync: sync object where we add dependencies * @fence: fence protecting ID from reuse +* @job: job who wants to use the VMID * * Allocate an id for the vm, adding fences to the sync obj as necessary. */
@@ -336,8 +349,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, goto error;if (vm->reserved_vmid[vmhub]) { - r =amdgpu_vmid_grab_reserved_locked (vm, ring, sync, - fence, job); + r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job);mutex_unlock (&id_mgr->lock);return r; }
Signature · 6 lines
2.14.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): 20180131154756.3374-5-christian.koenig-5C7GfCeVMHo@public.gmane.org
Chunming Zhou
Reviewed-byRe: [PATCH 5/8] drm/amdgpu: cleanup and simplify amdgpu_vmid_grab_reserved
Quoted 113 lines · Christian König
Drop the "
_locked" from the name, cleanup and simplify the logic a bit. Add missing comments.Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 58 ++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 23 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +34
-21@@ -248,12 +248,22 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm,return 0 ; } -/* idr_mgr->lock must be held */ -static int amdgpu_vmid_grab_reserved_locked (struct amdgpu_vm *vm, -struct amdgpu_ring *ring, -struct amdgpu_sync *sync, -struct dma_fence *fence, -struct amdgpu_job *job) +/** +* amdgpu_vm_grab_reserved - try to assign reserved VMID +* +* @vm: vm to allocate id for +* @ring: ring we want to submit job to +* @sync: sync object where we add dependencies +* @fence: fence protecting ID from reuse +* @job: job who wants to use the VMID +* +* Try to assign a reserved VMID. +*/ +static int amdgpu_vmid_grab_reserved (struct amdgpu_vm *vm, +struct amdgpu_ring *ring, +struct amdgpu_sync *sync, +struct dma_fence *fence, +struct amdgpu_job *job) {struct amdgpu_device *adev = ring->adev;unsigned vmhub = ring->funcs->vmhub;@@ -261,18 +271,21 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,struct amdgpu_vmid *id = vm->reserved_vmid[vmhub];struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];struct dma_fence *updates = sync->last_vm_update; -int r =0 ; -struct dma_fence *flushed, *tmp;bool needs_flush = vm->use_cpu_for_update; +int r =0 ; + +if (updates && id->flushed_updates && + updates->context == id->flushed_updates->context && + !dma_fence_is_later (updates, id->flushed_updates)) + updates =NULL ; + +if (id->owner != vm->entity.fence_context || + job->vm_pd_addr != id->pd_gpu_addr || + updates || !id->last_flush || + (id->last_flush->context != fence_context && + !dma_fence_is_signaled (id->last_flush))) { +struct dma_fence *tmp; - flushed = id->flushed_updates; -if ((id->owner != vm->entity.fence_context) || - (job->vm_pd_addr != id->pd_gpu_addr) || - (updates && (!flushed || updates->context != flushed->context || -dma_fence_is_later (updates, flushed))) || - (!id->last_flush || (id->last_flush->context != fence_context && - !dma_fence_is_signaled (id->last_flush)))) { - needs_flush = true;/* to prevent one context starved by another context */ id->pd_gpu_addr =0 ; tmp =amdgpu_sync_peek_fence (&id->active, ring);@@ -280,6 +293,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, r =amdgpu_sync_fence (adev, sync, tmp, false);return r; } + needs_flush = true; }/* Good we can use this VMID. Remember this submission as @@ -287,10 +301,9 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,*/ r =amdgpu_sync_fence (ring->adev, &id->active, fence, false);if (r) - goto out; +return r; -if (updates && (!flushed || updates->context != flushed->context || -dma_fence_is_later (updates, flushed))) { +if (updates) {dma_fence_put (id->flushed_updates); id->flushed_updates =dma_fence_get (updates); }@@ -304,8 +317,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm, job->vmid = id - id_mgr->ids; job->pasid = vm->pasid;trace_amdgpu_vm_grab_id (vm, ring, job); -out: -return r; +return 0 ; }/** @@ -315,6 +327,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,* @ring: ring we want to submit job to * @sync: sync object where we add dependencies * @fence: fence protecting ID from reuse +* @job: job who wants to use the VMID * * Allocate an id for the vm, adding fences to the sync obj as necessary. */
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · line 355
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +1
-2@@ -336,8 +349,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, goto error;if (vm->reserved_vmid[vmhub]) { - r =amdgpu_vmid_grab_reserved_locked (vm, ring, sync, - fence, job); + r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job);mutex_unlock (&id_mgr->lock);return r; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/8 drm/amdgpu: move reusing VMIDs into separate function
In reply to a message not in the archiveLet's try this once more.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 130 ++++++++++++++++++++------------ 1 file changed, 81 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +81 -49
@@ -321,58 +321,51 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm, }/** -* amdgpu_vm_grab_id - allocate the next free VMID +* amdgpu_vm_grab_used - try to reuse a VMID * * @vm: vm to allocate id for * @ring: ring we want to submit job to * @sync: sync object where we add dependencies * @fence: fence protecting ID from reuse * @job: job who wants to use the VMID +* @id: resulting VMID * -* Allocate an id for the vm, adding fences to the sync obj as necessary. +* Try to reuse a VMID for this submission. */ -int amdgpu_vmid_grab (struct amdgpu_vm *vm,struct amdgpu_ring *ring, -struct amdgpu_sync *sync,struct dma_fence *fence, -struct amdgpu_job *job) +static int amdgpu_vmid_grab_used (struct amdgpu_vm *vm, +struct amdgpu_ring *ring, +struct amdgpu_sync *sync, +struct dma_fence *fence, +struct amdgpu_job *job, +struct amdgpu_vmid **id) {struct amdgpu_device *adev = ring->adev;unsigned vmhub = ring->funcs->vmhub;struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];uint64_t fence_context = adev->fence_context + ring->idx;struct dma_fence *updates = sync->last_vm_update; -struct amdgpu_vmid *id, *idle; -int r =0 ; - -mutex_lock (&id_mgr->lock); - r =amdgpu_vmid_grab_idle (vm, ring, sync, &idle); -if (r || !idle) - goto error; - -if (vm->reserved_vmid[vmhub]) { - r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job); -mutex_unlock (&id_mgr->lock); -return r; - } +int r; job->vm_needs_flush = vm->use_cpu_for_update; +/* Check if we can use a VMID already assigned to this VM */ -list_for_each_entry_reverse (id, &id_mgr->ids_lru, list) { -struct dma_fence *flushed; +list_for_each_entry_reverse ((*id), &id_mgr->ids_lru, list) {bool needs_flush = vm->use_cpu_for_update; +struct dma_fence *flushed;/* Check all the prerequisites to using this VMID */ -if (id->owner != vm->entity.fence_context) +if ((*id)->owner != vm->entity.fence_context)continue ; -if (job->vm_pd_addr != id->pd_gpu_addr) +if ((*id)->pd_gpu_addr != job->vm_pd_addr)continue ; -if (!id->last_flush || - (id->last_flush->context != fence_context && - !dma_fence_is_signaled (id->last_flush))) +if (!(*id)->last_flush || + ((*id)->last_flush->context != fence_context && + !dma_fence_is_signaled ((*id)->last_flush))) needs_flush = true; - flushed = id->flushed_updates; + flushed = (*id)->flushed_updates;if (updates && (!flushed ||dma_fence_is_later (updates, flushed))) needs_flush = true;
@@ -380,44 +373,83 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,if (adev->asic_type <CHIP_VEGA10 && needs_flush)continue ; -/* Good we can use this VMID. Remember this submission as +/* Good, we can use this VMID. Remember this submission as * user of the VMID. */ - r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); + r =amdgpu_sync_fence (ring->adev, &(*id)->active, fence, false);if (r) - goto error; +return r;if (updates && (!flushed ||dma_fence_is_later (updates, flushed))) { -dma_fence_put (id->flushed_updates); - id->flushed_updates =dma_fence_get (updates); +dma_fence_put ((*id)->flushed_updates); + (*id)->flushed_updates =dma_fence_get (updates); } -if (needs_flush) - goto needs_flush; -else - goto no_flush_needed; - + job->vm_needs_flush |= needs_flush; +return 0 ; } -/* Still no ID to use? Then use the idle one found earlier */ - id = idle; + *id =NULL ; +return 0 ; +} -/* Remember this submission as user of the VMID */ - r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); +/** +* amdgpu_vm_grab_id - allocate the next free VMID +* +* @vm: vm to allocate id for +* @ring: ring we want to submit job to +* @sync: sync object where we add dependencies +* @fence: fence protecting ID from reuse +* @job: job who wants to use the VMID +* +* Allocate an id for the vm, adding fences to the sync obj as necessary. +*/ +int amdgpu_vmid_grab (struct amdgpu_vm *vm,struct amdgpu_ring *ring, +struct amdgpu_sync *sync,struct dma_fence *fence, +struct amdgpu_job *job) +{ +struct amdgpu_device *adev = ring->adev; +unsigned vmhub = ring->funcs->vmhub; +struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; +struct dma_fence *updates = sync->last_vm_update; +struct amdgpu_vmid *id, *idle; +int r =0 ; + +mutex_lock (&id_mgr->lock); + r =amdgpu_vmid_grab_idle (vm, ring, sync, &idle); +if (r || !idle) + goto error; + +if (vm->reserved_vmid[vmhub]) { + r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job); +mutex_unlock (&id_mgr->lock); +return r; + } + + r =amdgpu_vmid_grab_used (vm, ring, sync, fence, job, &id);if (r) goto error; - id->pd_gpu_addr = job->vm_pd_addr; -dma_fence_put (id->flushed_updates); - id->flushed_updates =dma_fence_get (updates); - id->owner = vm->entity.fence_context; +if (!id) { +/* Still no ID to use? Then use the idle one found earlier */ + id = idle; -needs_flush: - job->vm_needs_flush = true; -dma_fence_put (id->last_flush); - id->last_flush =NULL ; +/* Remember this submission as user of the VMID */ + r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); +if (r) + goto error; -no_flush_needed: + id->pd_gpu_addr = job->vm_pd_addr; +dma_fence_put (id->flushed_updates); + id->flushed_updates =dma_fence_get (updates); + id->owner = vm->entity.fence_context; + job->vm_needs_flush = true; + } + +if (job->vm_needs_flush) { +dma_fence_put (id->last_flush); + id->last_flush =NULL ; + }list_move_tail (&id->list, &id_mgr->ids_lru); job->vmid = id - id_mgr->ids;
Signature · 6 lines
2.14.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): 20180131154756.3374-6-christian.koenig-5C7GfCeVMHo@public.gmane.org
Chunming Zhou
Reviewed-byRe: [PATCH 6/8] drm/amdgpu: move reusing VMIDs into separate function
Quoted 186 lines · Christian König
Let's try this once more.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 130 ++++++++++++++++++++------------ 1 file changed, 81 insertions(+), 49 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +74
-49@@ -321,58 +321,51 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm, }/** -* amdgpu_vm_grab_id - allocate the next free VMID +* amdgpu_vm_grab_used - try to reuse a VMID * * @vm: vm to allocate id for * @ring: ring we want to submit job to * @sync: sync object where we add dependencies * @fence: fence protecting ID from reuse * @job: job who wants to use the VMID +* @id: resulting VMID * -* Allocate an id for the vm, adding fences to the sync obj as necessary. +* Try to reuse a VMID for this submission. */ -int amdgpu_vmid_grab (struct amdgpu_vm *vm,struct amdgpu_ring *ring, -struct amdgpu_sync *sync,struct dma_fence *fence, -struct amdgpu_job *job) +static int amdgpu_vmid_grab_used (struct amdgpu_vm *vm, +struct amdgpu_ring *ring, +struct amdgpu_sync *sync, +struct dma_fence *fence, +struct amdgpu_job *job, +struct amdgpu_vmid **id) {struct amdgpu_device *adev = ring->adev;unsigned vmhub = ring->funcs->vmhub;struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];uint64_t fence_context = adev->fence_context + ring->idx;struct dma_fence *updates = sync->last_vm_update; -struct amdgpu_vmid *id, *idle; -int r =0 ; - -mutex_lock (&id_mgr->lock); - r =amdgpu_vmid_grab_idle (vm, ring, sync, &idle); -if (r || !idle) - goto error; - -if (vm->reserved_vmid[vmhub]) { - r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job); -mutex_unlock (&id_mgr->lock); -return r; - } +int r; job->vm_needs_flush = vm->use_cpu_for_update; +/* Check if we can use a VMID already assigned to this VM */ -list_for_each_entry_reverse (id, &id_mgr->ids_lru, list) { -struct dma_fence *flushed; +list_for_each_entry_reverse ((*id), &id_mgr->ids_lru, list) {bool needs_flush = vm->use_cpu_for_update; +struct dma_fence *flushed;/* Check all the prerequisites to using this VMID */ -if (id->owner != vm->entity.fence_context) +if ((*id)->owner != vm->entity.fence_context)continue ; -if (job->vm_pd_addr != id->pd_gpu_addr) +if ((*id)->pd_gpu_addr != job->vm_pd_addr)continue ; -if (!id->last_flush || - (id->last_flush->context != fence_context && - !dma_fence_is_signaled (id->last_flush))) +if (!(*id)->last_flush || + ((*id)->last_flush->context != fence_context && + !dma_fence_is_signaled ((*id)->last_flush))) needs_flush = true; - flushed = id->flushed_updates; + flushed = (*id)->flushed_updates;if (updates && (!flushed ||dma_fence_is_later (updates, flushed))) needs_flush = true;@@ -380,44 +373,83 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,if (adev->asic_type <CHIP_VEGA10 && needs_flush)continue ; -/* Good we can use this VMID. Remember this submission as +/* Good, we can use this VMID. Remember this submission as * user of the VMID. */ - r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); + r =amdgpu_sync_fence (ring->adev, &(*id)->active, fence, false);if (r) - goto error; +return r;if (updates && (!flushed ||dma_fence_is_later (updates, flushed))) { -dma_fence_put (id->flushed_updates); - id->flushed_updates =dma_fence_get (updates); +dma_fence_put ((*id)->flushed_updates); + (*id)->flushed_updates =dma_fence_get (updates); } -if (needs_flush) - goto needs_flush; -else - goto no_flush_needed; - + job->vm_needs_flush |= needs_flush; +return 0 ; } -/* Still no ID to use? Then use the idle one found earlier */ - id = idle; + *id =NULL ; +return 0 ; +} -/* Remember this submission as user of the VMID */ - r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); +/** +* amdgpu_vm_grab_id - allocate the next free VMID +* +* @vm: vm to allocate id for +* @ring: ring we want to submit job to +* @sync: sync object where we add dependencies +* @fence: fence protecting ID from reuse +* @job: job who wants to use the VMID +* +* Allocate an id for the vm, adding fences to the sync obj as necessary. +*/ +int amdgpu_vmid_grab (struct amdgpu_vm *vm,struct amdgpu_ring *ring, +struct amdgpu_sync *sync,struct dma_fence *fence, +struct amdgpu_job *job) +{ +struct amdgpu_device *adev = ring->adev; +unsigned vmhub = ring->funcs->vmhub; +struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; +struct dma_fence *updates = sync->last_vm_update; +struct amdgpu_vmid *id, *idle; +int r =0 ; + +mutex_lock (&id_mgr->lock); + r =amdgpu_vmid_grab_idle (vm, ring, sync, &idle); +if (r || !idle) + goto error; + +if (vm->reserved_vmid[vmhub]) { + r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job); +mutex_unlock (&id_mgr->lock); +return r; + } + + r =amdgpu_vmid_grab_used (vm, ring, sync, fence, job, &id);if (r) goto error; - id->pd_gpu_addr = job->vm_pd_addr; -dma_fence_put (id->flushed_updates); - id->flushed_updates =dma_fence_get (updates); - id->owner = vm->entity.fence_context; +if (!id) { +/* Still no ID to use? Then use the idle one found earlier */ + id = idle; -needs_flush: - job->vm_needs_flush = true; -dma_fence_put (id->last_flush); - id->last_flush =NULL ; +/* Remember this submission as user of the VMID */ + r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); +if (r) + goto error; -no_flush_needed: + id->pd_gpu_addr = job->vm_pd_addr; +dma_fence_put (id->flushed_updates); + id->flushed_updates =dma_fence_get (updates); + id->owner = vm->entity.fence_context;
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · line 455
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +7
-0+ job->vm_needs_flush = true; + } + +if (job->vm_needs_flush) { +dma_fence_put (id->last_flush); + id->last_flush =NULL ; + }list_move_tail (&id->list, &id_mgr->ids_lru); job->vmid = id - id_mgr->ids;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/8 drm/amdgpu: restructure amdgpu_vmid_grab
In reply to a message not in the archiveNow that we have the different cases for grabbing a VMID in separate functions, restructure the top level function to only have one place where VMIDs are assigned to jobs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 89 ++++++++++++++++----------------- 1 file changed, 42 insertions(+), 47 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +42 -47
@@ -263,33 +263,34 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm,struct amdgpu_ring *ring, struct amdgpu_sync *sync, struct dma_fence *fence, - struct amdgpu_job *job) + struct amdgpu_job *job, + struct amdgpu_vmid **id) { struct amdgpu_device *adev = ring->adev;unsigned vmhub = ring->funcs->vmhub;uint64_t fence_context = adev->fence_context + ring->idx; -struct amdgpu_vmid *id = vm->reserved_vmid[vmhub]; -struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];struct dma_fence *updates = sync->last_vm_update;bool needs_flush = vm->use_cpu_for_update;int r =0 ; -if (updates && id->flushed_updates && - updates->context == id->flushed_updates->context && - !dma_fence_is_later (updates, id->flushed_updates)) + *id = vm->reserved_vmid[vmhub]; +if (updates && (*id)->flushed_updates && + updates->context == (*id)->flushed_updates->context && + !dma_fence_is_later (updates, (*id)->flushed_updates)) updates =NULL ; -if (id->owner != vm->entity.fence_context || - job->vm_pd_addr != id->pd_gpu_addr || - updates || !id->last_flush || - (id->last_flush->context != fence_context && - !dma_fence_is_signaled (id->last_flush))) { +if ((*id)->owner != vm->entity.fence_context || + job->vm_pd_addr != (*id)->pd_gpu_addr || + updates || !(*id)->last_flush || + ((*id)->last_flush->context != fence_context && + !dma_fence_is_signaled ((*id)->last_flush))) {struct dma_fence *tmp;/* to prevent one context starved by another context */ - id->pd_gpu_addr =0 ; - tmp =amdgpu_sync_peek_fence (&id->active, ring); + (*id)->pd_gpu_addr =0 ; + tmp =amdgpu_sync_peek_fence (&(*id)->active, ring);if (tmp) { + *id =NULL ; r =amdgpu_sync_fence (adev, sync, tmp, false);return r; }
@@ -299,24 +300,15 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm,/* Good we can use this VMID. Remember this submission as * user of the VMID. */ - r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); + r =amdgpu_sync_fence (ring->adev, &(*id)->active, fence, false);if (r)return r;if (updates) { -dma_fence_put (id->flushed_updates); - id->flushed_updates =dma_fence_get (updates); +dma_fence_put ((*id)->flushed_updates); + (*id)->flushed_updates =dma_fence_get (updates); } - id->pd_gpu_addr = job->vm_pd_addr; - id->owner = vm->entity.fence_context; job->vm_needs_flush = needs_flush; -if (needs_flush) { -dma_fence_put (id->last_flush); - id->last_flush =NULL ; - } - job->vmid = id - id_mgr->ids; - job->pasid = vm->pasid; -trace_amdgpu_vm_grab_id (vm, ring, job);return 0 ; }
@@ -411,7 +403,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,struct amdgpu_device *adev = ring->adev;unsigned vmhub = ring->funcs->vmhub;struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; -struct dma_fence *updates = sync->last_vm_update;struct amdgpu_vmid *id, *idle;int r =0 ;
@@ -421,37 +412,41 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, goto error;if (vm->reserved_vmid[vmhub]) { - r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job); -mutex_unlock (&id_mgr->lock); -return r; - } + r =amdgpu_vmid_grab_reserved (vm, ring, sync, fence, job, &id); +if (r || !id) + goto error; + }else { + r =amdgpu_vmid_grab_used (vm, ring, sync, fence, job, &id); +if (r) + goto error; - r =amdgpu_vmid_grab_used (vm, ring, sync, fence, job, &id); -if (r) - goto error; +if (!id) { +struct dma_fence *updates = sync->last_vm_update; -if (!id) { -/* Still no ID to use? Then use the idle one found earlier */ - id = idle; +/* Still no ID to use? Then use the idle one found earlier */ + id = idle; -/* Remember this submission as user of the VMID */ - r =amdgpu_sync_fence (ring->adev, &id->active, fence, false); -if (r) - goto error; +/* Remember this submission as user of the VMID */ + r =amdgpu_sync_fence (ring->adev, &id->active, + fence, false); +if (r) + goto error; - id->pd_gpu_addr = job->vm_pd_addr; -dma_fence_put (id->flushed_updates); - id->flushed_updates =dma_fence_get (updates); - id->owner = vm->entity.fence_context; - job->vm_needs_flush = true; +dma_fence_put (id->flushed_updates); + id->flushed_updates =dma_fence_get (updates); + job->vm_needs_flush = true; + } + +list_move_tail (&id->list, &id_mgr->ids_lru); } + id->pd_gpu_addr = job->vm_pd_addr; + id->owner = vm->entity.fence_context; +if (job->vm_needs_flush) {dma_fence_put (id->last_flush); id->last_flush =NULL ; } -list_move_tail (&id->list, &id_mgr->ids_lru); - job->vmid = id - id_mgr->ids; job->pasid = vm->pasid;trace_amdgpu_vm_grab_id (vm, ring, job);
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/8 drm/amdgpu: cache the fence to wait for a VMID
In reply to a message not in the archiveBeneficial when a lot of processes are waiting for VMIDs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 7 +++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +5 -2
@@ -205,6 +205,9 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm,unsigned i;int r; +if (ring->vmid_wait && !dma_fence_is_signaled (ring->vmid_wait)) +return amdgpu_sync_fence (adev, sync, ring->vmid_wait, false); + fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL );if (!fences)return -ENOMEM ;
@@ -239,9 +242,9 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm, } r =amdgpu_sync_fence (adev, sync, &array->base, false); -dma_fence_put (&array->base); +dma_fence_put (ring->vmid_wait); + ring->vmid_wait = &array->base;return r; - }kfree (fences);
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -0
@@ -360,6 +360,9 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)amdgpu_debugfs_ring_fini (ring); +dma_fence_put (ring->vmid_wait); + ring->vmid_wait =NULL ; + ring->adev->rings[ring->idx] =NULL ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1 -0
@@ -196,6 +196,7 @@ struct amdgpu_ring {u64 cond_exe_gpu_addr;volatile u32 *cond_exe_cpu_addr;unsigned vm_inv_eng; +struct dma_fence *vmid_wait;bool has_compute_vm_bug;atomic_t num_jobs[DRM_SCHED_PRIORITY_MAX ];
Signature · 6 lines
2.14.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): 20180131154756.3374-8-christian.koenig-5C7GfCeVMHo@public.gmane.org
Chunming Zhou
Reviewed-byRe: [PATCH 8/8] drm/amdgpu: cache the fence to wait for a VMID
Quoted 1 line · Christian König
Beneficial when a lot of processes are waiting for VMIDs.
Yeah, we can save re-creating fence array when vmid is used up.
Quoted 53 lines
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 7 +++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +5
-2@@ -205,6 +205,9 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm,unsigned i;int r; +if (ring->vmid_wait && !dma_fence_is_signaled (ring->vmid_wait)) +return amdgpu_sync_fence (adev, sync, ring->vmid_wait, false); + fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL );if (!fences)return -ENOMEM ;@@ -239,9 +242,9 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_vm *vm, } r =amdgpu_sync_fence (adev, sync, &array->base, false); -dma_fence_put (&array->base); +dma_fence_put (ring->vmid_wait); + ring->vmid_wait = &array->base;return r; - }kfree (fences);drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3
-0@@ -360,6 +360,9 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)amdgpu_debugfs_ring_fini (ring); +dma_fence_put (ring->vmid_wait); + ring->vmid_wait =NULL ; + ring->adev->rings[ring->idx] =NULL ; }drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h struct amdgpu_ring { · line 202
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1
-0@@ -196,6 +196,7 @@ struct amdgpu_ring {u64 cond_exe_gpu_addr;volatile u32 *cond_exe_cpu_addr;unsigned vm_inv_eng; +struct dma_fence *vmid_wait;bool has_compute_vm_bug;atomic_t num_jobs[DRM_SCHED_PRIORITY_MAX ];
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Chunming Zhou
NAKNAK, reserved vmid is independent on id_mgr, which is removed from id mgr when process allocates reserved vmid.
Regards,
David Zhou
Quoted 28 lines · Christian König
To guarantee fairness between processes grab reserved VMID only when there is an idle one.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-5@@ -268,11 +268,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,int r =0 ;mutex_lock (&id_mgr->lock); -if (vm->reserved_vmid[vmhub]) { - r =amdgpu_vmid_grab_reserved_locked (vm, ring, sync, fence, job); -mutex_unlock (&id_mgr->lock); -return r; - } fences =kmalloc_array (sizeof (void *), id_mgr->num_ids,GFP_KERNEL );if (!fences) {mutex_unlock (&id_mgr->lock);@@ -319,6 +314,13 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, }kfree (fences);
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, · line 326
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +7
-0+if (vm->reserved_vmid[vmhub]) { + r =amdgpu_vmid_grab_reserved_locked (vm, ring, sync, + fence, job); +mutex_unlock (&id_mgr->lock); +return r; + } + job->vm_needs_flush = vm->use_cpu_for_update;/* Check if we can use a VMID already assigned to this VM */ list_for_each_entry_reverse (id, &id_mgr->ids_lru, list) {
_______________________________________________
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): 2e5a2349-5036-dff7-ab06-286bcf9de9b3-5C7GfCeVMHo@public.gmane.org
Quoted 1 line
reserved vmid is independent on
id_mgr
And that is exactly the reason why I want to have that here.
If we don't fix this reserving a VMID would otherwise give the process an unfair advantage while scheduling jobs.
Regards,
Christian.
Am 01.02.2018 um 05:42 schrieb Chunming Zhou:
Quoted 40 lines
NAK, reserved vmid is independent on
id_mgr, which is removed from id mgr when process allocates reserved vmid.Regards,
David Zhou
Quoted 31 lines · Christian König
To guarantee fairness between processes grab reserved VMID only when there is an idle one.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c| 12 +++++++-----1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-5@@ -268,11 +268,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm,struct amdgpu_ring *ring, int r = 0; mutex_lock(&id_mgr->lock); - if (vm->reserved_vmid[vmhub]) { - r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, fence, job); - mutex_unlock(&id_mgr->lock); - return r; - } fences = kmalloc_array(sizeof(void *), id_mgr->num_ids, GFP_KERNEL); if (!fences) {
mutex_unlock(&id_mgr->lock);drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +1
-0@@ -319,6 +314,13 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm,struct amdgpu_ring *ring, } kfree(fences); + if (vm->reserved_vmid[vmhub]) { + r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync,
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +5
-0+ fence, job); + mutex_unlock(&id_mgr->lock); + return r; + } + job->vm_needs_flush = vm->use_cpu_for_update; /* Check if we can use a VMID already assigned to this VM */
list_for_each_entry_reverse(id, &id_mgr->ids_lru, list){
_______________________________________________
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): d3c6258b-2015-6d11-65cf-06e6449d76c7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Chunming Zhou
Acked-byQuoted 4 lines · Christian König
Quoted 1 line
reserved vmid is independent on
id_mgrAnd that is exactly the reason why I want to have that here.
If we don't fix this reserving a VMID would otherwise give the process an unfair advantage while scheduling jobs.
ok, I see your mean, that's same why you always make idle vmid for re-using vmid. Adding this explain to patch commit is better.
Regards,
David Zhou
Quoted 55 lines
Regards,
Christian.Am 01.02.2018 um 05:42 schrieb Chunming Zhou:
Quoted 49 lines
NAK, reserved vmid is independent on
id_mgr, which is removed from id mgr when process allocates reserved vmid.Regards,
David Zhou
Quoted 39 lines · Christian König
To guarantee fairness between processes grab reserved VMID only when there is an idle one.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c| 12 +++++++-----1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-5@@ -268,11 +268,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm,struct amdgpu_ring *ring, int r = 0; mutex_lock(&id_mgr->lock); - if (vm->reserved_vmid[vmhub]) { - r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, fence, job); - mutex_unlock(&id_mgr->lock); - return r; - } fences = kmalloc_array(sizeof(void *), id_mgr->num_ids, GFP_KERNEL); if (!fences) {
mutex_unlock(&id_mgr->lock);drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +6
-0@@ -319,6 +314,13 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm,struct amdgpu_ring *ring, } kfree(fences); + if (vm->reserved_vmid[vmhub]) { + r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, + fence, job); + mutex_unlock(&id_mgr->lock); + return r; + } + job->vm_needs_flush = vm->use_cpu_for_update; /* Check if we can use a VMID already assigned to this VM */
list_for_each_entry_reverse(id, &id_mgr->ids_lru, list){
_______________________________________________
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): a8418ef0-6bec-af57-0555-cf48b38fa09a-5C7GfCeVMHo@public.gmane.org
Am 01.02.2018 um 09:55 schrieb Chunming Zhou:
Quoted 8 lines · Christian König
Quoted 4 lines
Quoted 1 line
reserved vmid is independent on
id_mgrAnd that is exactly the reason why I want to have that here.
If we don't fix this reserving a VMID would otherwise give the process an unfair advantage while scheduling jobs.
ok, I see your mean, that's same why you always make idle vmid for re-using vmid.
Yes, exactly.
Quoted 1 line
Adding this explain to patch commit is better.
Good point.
Quoted 2 lines
With the addition of the mutex can I get your rb or ab for patch #3 as well? Cause then it looks ready for commit.
Thanks,
Christian.
Quoted 59 lines
Regards,
David ZhouQuoted 55 lines
Regards,
Christian.Am 01.02.2018 um 05:42 schrieb Chunming Zhou:
Quoted 49 lines
NAK, reserved vmid is independent on
id_mgr, which is removed from id mgr when process allocates reserved vmid.Regards,
David Zhou
Quoted 39 lines · Christian König
To guarantee fairness between processes grab reserved VMID only when there is an idle one.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c| 12 +++++++-----1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +0
-5@@ -268,11 +268,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm,struct amdgpu_ring *ring, int r = 0; mutex_lock(&id_mgr->lock); - if (vm->reserved_vmid[vmhub]) { - r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, fence, job); - mutex_unlock(&id_mgr->lock); - return r; - } fences = kmalloc_array(sizeof(void *), id_mgr->num_ids, GFP_KERNEL); if (!fences) {
mutex_unlock(&id_mgr->lock);drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +6
-0@@ -319,6 +314,13 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm,struct amdgpu_ring *ring, } kfree(fences); + if (vm->reserved_vmid[vmhub]) { + r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, + fence, job); + mutex_unlock(&id_mgr->lock); + return r; + } + job->vm_needs_flush = vm->use_cpu_for_update; /* Check if we can use a VMID already assigned to this VM */
list_for_each_entry_reverse(id, &id_mgr->ids_lru, list){
Quoted 4 lines
_______________________________________________
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): d4989e55-7331-9e1b-327b-8cf6789fefc3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 1 line · Christian König
With the addition of the mutex can I get your rb or ab for patch #3 as well? Cause then it looks ready for commit.
Feel free to add my RB for that one.
Regards,
David Zhou
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx