spectral

New feature request : global buffers

Discussion created by spectral on Sep 9, 2011
Latest reply on Sep 13, 2011 by jeff_golds

Hi,

In CUDA, when you declare a gpu-buffer it is accessible to all the methods of your kernel, not only the 'kernel'.

It is a problem because if you have a lot of buffers, you have to pass all the buffers pointers to every method !

The best way I have found is to create a typedef that will contains all theses pointers, if I don't want that all the methods have 40 parameters ! But it require time to initialize, to pass and some memory too. Also it will be easier if we will be able to access all theses buffers globally ! 

BTW, does someone know if OpenCL 2 (or a new specification) is in preparation ? Because we really miss a lot of features :-P Even if today it is more important to have stable OpenCL drivers !

 

Thanks

typedef struct { __global Data1 * data1; __global Data2 * data4; __global Data3 * data3; __global Data4 * data2; ..... } clBufferReferences; void __kernel main_kernel(__global Data1 * data1, __global Data2 * data2, __global Data3 * data3, __global Data4 * data4) { clBufferReferences references; references.data1 = data1; references.data2 = data2; references.data3 = data3; references.data4 = data4; first_method(&references); }

Outcomes