Pinned Memory

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pinned Memory

Matthias
Hello,

i have a question related to pinned memory / mapping buffers.

The jocl-demo bandwidth source code is as follows:
// unmap and make data in the host buffer valid
queue.putUnmapMemory(cmPinnedData, h_data);

according to the OpenCL Spec and the Nvidia examples its not necessary to unmap the buffer before copy it to the device and use it.
and later before performance measurement you remap it:
h_data = queue.putMapBuffer(cmPinnedData, WRITE, true);
... assuming that the pinned data is mapped again to the same virtual address (in underlying c code)?
Is it guaranteed that the data is still "there", i thougt there is DMA used and the data is not stored in your memory, or is just the OpenCL buffer Object stored in the DMA region and some copy magic happens within the driver?

I am a bite confused now.

best regards
Matthias
Reply | Threaded
Open this post in threaded view
|

Re: Pinned Memory

Michael Bien
Hello Matthias,

i translated the demo from the nv samples (or AMD sample?) in the early stages of jocl development to have something to test the binding and compare the results to the C version (there where not many samples out there before the spec was final ;) ). It is probably best to take a look at the original C sample. It wasn't a line-by-line port, so its possible that i made some translation mistakes back than.

best regards,
michael

On 03/16/2012 05:04 PM, Matthias [via jogamp] wrote:
Hello,

i have a question related to pinned memory / mapping buffers.

The jocl-demo bandwidth source code is as follows:
// unmap and make data in the host buffer valid
queue.putUnmapMemory(cmPinnedData, h_data);

according to the OpenCL Spec and the Nvidia examples its not necessary to unmap the buffer before copy it to the device and use it.
and later before performance measurement you remap it:
h_data = queue.putMapBuffer(cmPinnedData, WRITE, true);
... assuming that the pinned data is mapped again to the same virtual address (in underlying c code)?
Is it guaranteed that the data is still "there", i thougt there is DMA used and the data is not stored in your memory?

I am a bite confused now.

best regards
Matthias


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/Pinned-Memory-tp3832295p3832295.html
To start a new topic under jogamp, email [hidden email]
To unsubscribe from jogamp, click here.
NAML


-- 
- - - -
http://michael-bien.com