[PATCH v4 1/2] gpudev: expose GPU memory to CPU

Wang, Haiyue haiyue.wang at intel.com
Fri Feb 11 05:46:45 CET 2022


From: Elena Agostini <eagostini at nvidia.com> 
Sent: Thursday, February 10, 2022 18:38
To: Wang, Haiyue <haiyue.wang at intel.com>; dev at dpdk.org
Subject: Re: [PATCH v4 1/2] gpudev: expose GPU memory to CPU

> From: Wang, Haiyue <mailto:haiyue.wang at intel.com>
> Date: Thursday, 27 January 2022 at 07:56
> To: Elena Agostini <mailto:eagostini at nvidia.com>, mailto:dev at dpdk.org <mailto:dev at dpdk.org>
> Subject: RE: [PATCH v4 1/2] gpudev: expose GPU memory to CPU
> External email: Use caution opening links or attachments
> 
> 
> > -----Original Message-----
> > From: mailto:eagostini at nvidia.com <mailto:eagostini at nvidia.com>
> > Sent: Thursday, January 27, 2022 11:47
> > To: mailto:dev at dpdk.org
> > Cc: Elena Agostini <mailto:eagostini at nvidia.com>
> > Subject: [PATCH v4 1/2] gpudev: expose GPU memory to CPU
> >
> > From: Elena Agostini <mailto:eagostini at nvidia.com>
> >
> > Enable the possibility to expose a GPU memory area and make it
> > accessible from the CPU.
> >
> > GPU memory has to be allocated via rte_gpu_mem_alloc().
> >
> > This patch allows the gpudev library to map (and unmap),
> > through the GPU driver, a chunk of GPU memory and to return
> > a memory pointer usable by the CPU to access the GPU memory area.
> >
> > Signed-off-by: Elena Agostini <mailto:eagostini at nvidia.com>
> > ---
> >  doc/guides/prog_guide/gpudev.rst |  9 +++++
> >  drivers/gpu/cuda/cuda.c          |  2 ++
> >  lib/gpudev/gpudev.c              | 61 ++++++++++++++++++++++++++++++++
> >  lib/gpudev/gpudev_driver.h       |  6 ++++
> >  lib/gpudev/rte_gpudev.h          | 49 +++++++++++++++++++++++++
> >  lib/gpudev/version.map           |  2 ++
> >  6 files changed, 129 insertions(+)
> >
> 
> 
> > +__rte_experimental
> > +void *rte_gpu_mem_cpu_map(int16_t dev_id, size_t size, void *ptr);
> 
> How about add some direction words like "to/from" to make it straightforward ?
> 
> For this: rte_gpu_mem_map_to_cpu ?
> 
> > +__rte_experimental
> > +int rte_gpu_mem_cpu_unmap(int16_t dev_id, void *ptr);
> > +
> 
> And rte_gpu_mem_unmap_to_cpu ?
> 
> >  };
> > --
> > 2.17.1

> Motivation behind the name is to be compliant with 
> rte_*_dma_map/unmap() functions where the entity comes first
> (DMA) and the action later (map/unmap).


> I think your proposal is more readable but it's also too
> verbose for an API (map_to_cpu/unmap_from_cpu).

Then just ' rte_gpu_mem_map' & ' rte_gpu_mem_umap', since DPDK is running on CPU. ;-)



More information about the dev mailing list