Xavier Shared CPU iGPU memory

Hi,
I’m using the Pegasus Xavier and trying to understand how to make use of the shared physical memory between the iGPU to the CPU to prevent unnecessary data transfer.

my question is:
Do I have to allocate GPU memory before running a kernel or there is a way to use directly the data that was allocated before for the CPU?

also, does this Unified memory concurrent access means I can’t use Unified Memory at all or I only need to make sure CPU and GPU are not access the same memory at the same time?

Yotam

Moving this topic to the DRIVE AGX forum.

Dear @getesh.manaye,
You need to allocate pinned memory or unified memory to allocate memory buffers that can be shared across CPU and GPU to avoid data transfers.
Do I have to allocate GPU memory before running a kernel or there is a way to use directly the data that was allocated before for the CPU?

You need to allocate memory which will be accessed in kernel before launching it.

I can’t use Unified Memory at all or I only need to make sure CPU and GPU are not access the same memory at the same time?

Yes. Either CPU or GPU can access unified memory buffer at a time but not both.

For more details about memory types please look at