Any word on complex number datatype support in OpenCL kernels? Is that planned sometime in the near future or is not a priority?
Thanks much,
Gaurav
Topic
NOTICE: developerWorks Community will be offline May 2930, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
3 replies
Latest Post
 20110616T16:33:30Z by khanna
ACCEPTED ANSWER
Pinned topic Complex number support in OpenCL
20110615T15:43:04Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.
Updated on 20110616T16:33:30Z at 20110616T16:33:30Z by khanna

ACCEPTED ANSWER
Re: Complex number support in OpenCL
20110615T16:26:42Z in response to khannaGaurav,
We are not currently working on complex number support. I can't speak of what is planned for future versions of the OpenCL standard in that such information is Khronos confidential. However, I can forward the request to the Khronos OpenCL working group.
Sorry, I can't give you any better information. 
ACCEPTED ANSWER
Re: Complex number support in OpenCL
20110616T15:57:02Z in response to khannaGaurav,
In order to formulate a proposal for complex number support, we need to determine what is the minimum level of functionality, and what is the complete functionality if development resources are unlimited. If we can propose a limited set of functionality, it might be easier to get implementers to accept the proposal in light of all the other feature requests that are being asked for.
Do you require?
1) complex data type  both scalar and vector? half, float and double? Both complex and imaginary? Would a vector data type is interleaved or separate? For example, would a 2 component complex number be riri or rrii. It would be nice if the type was opaque, but if we support reinterpretations, then it has to be specified.
2) vector component access. We would need to come up with a access specification that can access each component and each part (real and imaginary) of the complex vector.
3) Complex number operators. Which one? Arithmetic? Relational?
4) Type reinterpretations. Type conversions?
5) Which builtins? load/store, mathematical? async_copy?
It quickly becomes a significant implementation effort to fully support complex data types.
Dan B.
ACCEPTED ANSWER
Re: Complex number support in OpenCL
20110616T16:33:30Z in response to SystemAdminThanks. Here are some comments:
1) complex data type  both scalar and vector? half, float and double? Both complex and imaginary? Would a vector data type is interleaved or separate? For example, would a 2 component complex number be riri or rrii. It would be nice if the type was opaque, but if we support reinterpretations, then it has to be specified.
At least scalar level support. Ideally doubleprecision, but I can do with singleprecision (float) if thats all that possible. I'm not sure the ideal layout for the vector type. Thats going to require some thinking. My initial reaction is the interleaved format may be better.
2) vector component access. We would need to come up with a access specification that can access each component and each part (real and imaginary) of the complex vector.
Absolutely!
3) Complex number operators. Which one? Arithmetic? Relational?
Basic arithmetic operations would suffice (+,,x,/)
4) Type reinterpretations. Type conversions?
Yes. Need to be able to handle operations between real numbers and complex numbers.
5) Which builtins? load/store, mathematical? async_copy?
None needed. I can keep ALL the complex number data & operations local to a kernel.
Yes, I imagine it is not trivial to do. Perhaps another option (with broader applicability) would be for OpenCL to incorporate some C++ features. For example, if I had operatoroverloading, I could define my own complex datatype and overload all the usual operations. This is how I currently do it within CUDA and on the Cell BE's SPUs (through Cell SDK). But OpenCL doesn't support any C++ features currently. :(
