cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

New feature request : global buffers

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 😛 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); }

0 Likes
4 Replies

viewon01,
You will need to bring this up with khronos, good idea, but something that should be fundamentally part of the language and not a vendor extension.
0 Likes

hi viewon01,

I suppose it's the same request you did in the AMD APP SDK suggest feature thread. As Micah says, this is something which does not depend of the vendor, this really is something related to OpenCL itself. However, I really would like to see AMD propose this to Khronos, not you or me, because AMD is an active member of Khronos, so AMD's voice would count much more than that of an isolated OpenCL API user.

But I tend to believe that features that are successfully implemented in CUDA will come someday to OpenCL, like the use of dynamic memory allocation in kernel and other stuff. Roughly speaking, almost every functionality that CUDA has would be welcome in OpenCL. There's an old thread about suggestions to OpenCL 2: http://forums.amd.com/devforum/messageview.cfm?catid=390&threadid=139081&highlight_key=y&keyword1=suggestion I don't know if one should revive it, but your request would feet there.

And me too, I would like to know which features are in discussion for OpenCL 2. Is this a public information, or you must be a member of the consortium to have access to it?

0 Likes

I agree with you, it is a request for the Khronos Group... but I think that it is better if AMD propose this feature (I'm nobody !).

It is why I ask directly to AMD to forward the request.

 

You know, every kernel parameter can be useful at any level of the kernel, any function, so passing it as a parameter is a waste of performance and memory.

0 Likes

Originally posted by: viewon01You know, every kernel parameter can be useful at any level of the kernel, any function, so passing it as a parameter is a waste of performance and memory.


Parameter passing isn't always a burden, the compiler can optimize a lot of that away.

There are real reasons why OpenCL works the way it does.  For example, some hardware may need to know how to describe the buffer at kernel execution time.  If you just pass in pointers, then these values may not be correctly associated with the device.

Think about texture resources or images.  There is a lot of data required to describe that resource and how to properly access it.

Jeff

0 Likes