[RFC PATCH 2/2] drm/amdgpu: Dummy CS for VM sync of compute VMs
Christian König
christian.koenig at amd.com
Mon Mar 13 07:38:42 UTC 2023
Am 10.03.23 um 23:16 schrieb Felix Kuehling:
> Use dummy command submissions with a 0-sized IB on a compute VM to flush
> TLBs and signal the fence in SW. This allows applications with user mode
> queues to sync with asynchronous VM updates through the CS API.
Ok that is really hacky. Going to sync up with Shashank if we can
implement the TLB flush fence a bit earlier.
Christian.
>
> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> index bcccc348dbe2..3f35d04bd4f7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> @@ -171,6 +171,15 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
> return -EINVAL;
> }
>
> + if (ib->length_dw == 0 && vm->is_compute_context) {
> + /* Hack: Dummy CS. Just flush TLBs and signal the fence. */
> + r = amdgpu_amdkfd_flush_tlb(adev, vm, TLB_FLUSH_LEGACY);
> + if (r)
> + return r;
> + *f = &job->hw_fence;
> + return dma_fence_signal(*f);
> + }
> +
> alloc_size = ring->funcs->emit_frame_size + num_ibs *
> ring->funcs->emit_ib_size;
>
More information about the amd-gfx
mailing list