cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

Atmapuri
Journeyman III
Journeyman III

Keeping buffers on GPU!

Hi!

How should the buffers be configured when calling clCreateBuffer to make sure that they are never mirrored back and forth between Host and GPU in the background without explicit call to clEnqueueReadBuffer / clEnqueueWriteBuffer?

I keep reading about "driver will cache buffer in GPU memory if seemed appropriate". For example, I have 2 buffers, which are input/output buffers for the program and about 10 others which are GPU only and never accessed by the Host (only by GPU).

Is there a difference in behaviour, if the same buffer is used per partes (using offsets) or multiple distinct buffers?

Thanks!
Atmapuri

0 Kudos
Reply
5 Replies
maximmoroz
Journeyman III
Journeyman III

Keeping buffers on GPU!

Just create them without any special flags (CL_MEM_READ_ONLY, CL_MEM_WRITE_ONLY, CL_MEM_READ_WRITE are Ok).

0 Kudos
Reply
Atmapuri
Journeyman III
Journeyman III

Keeping buffers on GPU!

Thanks! Is there some special reason when I should specify CL_MEM_READ_WRITE ?

0 Kudos
Reply
maximmoroz
Journeyman III
Journeyman III

Keeping buffers on GPU!

Just for readability purposes.

0 Kudos
Reply
nou
Exemplar
Exemplar

Keeping buffers on GPU!

CL_COPY_HOST_PTR should be ok too.

0 Kudos
Reply
himanshu_gautam
Grandmaster
Grandmaster

Keeping buffers on GPU!

Hi,

The simplest answer is to refer to OpenCL Programming guide Table 4.2 and Table 4.3.And yes, buffer created with no flags go directly in device.Other methods are explained in the source pointed above.

0 Kudos
Reply