2

I am writing an OpenCL program and I wish to transfer data from a frame grabber to a GPU using DMA. How can I get the physical address of an OpenCL buffer on the GPU to do that?

e_dod_as
  • 21
  • 4
  • In all likelihood, you can't. Depending on what operating system and hardware you are using, there will be host side driver and/or operating system segmentation that will prevent direct access to the GPU memory. – talonmies May 24 '12 at 11:46
  • I am actually using frame grabbers of own design, so the driver is under my control. OS used is Windows or Linux. Still no way of accessing GPU memory address? – e_dod_as May 24 '12 at 14:03
  • 1
    When I was referring to driver, I mean the GPU driver. The host GPU driver (or the display manager in WDDM windows) is actively managing the device memory. Each GPU process gets a context with its own virtualised address space, user space processes doesn't get to see raw memory at all (in fact I am pretty sure all modern GPUs use an onboard TLB which handles address translation inside any given context). NVIDIA have a couple of special drivers hooks for CUDA supporting Inifiband adapters doing DMA to their Telsa cards, but those aren't public AFAIK. – talonmies May 24 '12 at 14:15
  • Thank you for your quick responses! I am insisting a bit as this is a crucial point in my application. My next question is: can I get a Windows virtual address of memory located on GPU and then use it as destination in the memcpy function? – e_dod_as May 24 '12 at 15:00
  • Sorry I don't know the answer to that, I don't work with Windows enough to say for sure. – talonmies May 24 '12 at 15:08

1 Answers1

2

With OpenCL, you cannot get the physical GPU address of a buffer.

However, you can map a region of a buffer directly into host memory, allowing the memory to be copied in and out using standard C/C++ code such as memcpy. See clEnqueueMapBuffer.

vocaro
  • 2,779
  • 2
  • 23
  • 16