3

If the (discrete) GPU has its own video RAM, I have to copy my data from RAM to VRAM to be able to use them. But if the GPU is integrated with the CPU (e.g. AMD Ryzen) and shares the memory, do I still have to make copies, or can they both alternatively access the same memory block?

Pietro
  • 10,628
  • 22
  • 80
  • 165

3 Answers3

3

It is possible to avoid copying in case of integrated graphics, but this feature is platform specific, and it may work differently for different vendors.

How to Increase Performance by Minimizing Buffer Copies on IntelĀ® Processor Graphics article describes how to achieve this for Intel hardware:

To create zero copy buffers, do one of the following:

Use CL_MEM_ALLOC_HOST_PTR and let the runtime handle creating a zero copy allocation buffer for you

If you already have the data and want to load the data into an OpenCL buffer object, then use CL_MEM_USE_HOST_PTR with a buffer allocated at a 4096 byte boundary (aligned to a page and cache line boundary) and a total size that is a multiple of 64 bytes (cache line size).

When reading or writing data to these buffers from the host, use clEnqueueMapBuffer(), operate on the buffer, then call clEnqueueUnmapMemObject().

2

GPU and CPU memory sharing ? GPU have multiple cores without control unit but the CPU controls the GPU through control unit. dedicated GPU have its own DRAM=VRAM=GRAM faster then integrated RAM. when we say integrated GPU its mean that GPU placed on same chip with CPU, and CPU & GPU used same RAM memory (shared memory ).

0

References to other similar Q&As:

Pietro
  • 10,628
  • 22
  • 80
  • 165