Topic
  • 3 replies
  • Latest Post - ‏2011-06-16T16:33:30Z by khanna
khanna
khanna
6 Posts

Pinned topic Complex number support in OpenCL

‏2011-06-15T15:43:04Z |
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
Updated on 2011-06-16T16:33:30Z at 2011-06-16T16:33:30Z by khanna
  • SystemAdmin
    SystemAdmin
    131 Posts

    Re: Complex number support in OpenCL

    ‏2011-06-15T16:26:42Z  
    Gaurav,

    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.
  • SystemAdmin
    SystemAdmin
    131 Posts

    Re: Complex number support in OpenCL

    ‏2011-06-16T15:57:02Z  
    Gaurav,

    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 re-interpretations, 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 built-ins? load/store, mathematical? async_copy?

    It quickly becomes a significant implementation effort to fully support complex data types.

    Dan B.
  • khanna
    khanna
    6 Posts

    Re: Complex number support in OpenCL

    ‏2011-06-16T16:33:30Z  
    Gaurav,

    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 re-interpretations, 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 built-ins? load/store, mathematical? async_copy?

    It quickly becomes a significant implementation effort to fully support complex data types.

    Dan B.
    Thanks. 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 re-interpretations, then it has to be specified.

    At least scalar level support. Ideally double-precision, but I can do with single-precision (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 built-ins? 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 operator-overloading, 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. :-(