libclc + llvm: enabling extensions

Hi,

I'm working with libclc/llvm, and encountered a compilation error on generic/include/clc/clc.h

#ifndef cl_clang_storage_class_specifiers
#error Implementation requires cl_clang_storage_class_specifiers extension!
#endif

Quite reasonable; as I'm investigating what goes on in LLVM3.5 I do not see any apparent instances where the various features are turned on for a given target. What (if any) is the 'normal' convention used to turn the various extensions on or off for a given target?

Regards,

  Richard Gorton
  rcgorton@cog-e.com

Hi,

I'm working with libclc/llvm, and encountered a compilation error on generic/include/clc/clc.h

#ifndef cl_clang_storage_class_specifiers
#error Implementation requires cl_clang_storage_class_specifiers extension!
#endif

Quite reasonable; as I'm investigating what goes on in LLVM3.5 I do not see any apparent instances where the various features are turned on for a given target. What (if any) is the 'normal' convention used to turn the various extensions on or off for a given target?

There is no convention for this, but what I would suggest is to wrap any extended features
in:

#if feature_x
...
#endif

And then have either you OpenCL implementation or the target defintion in
clang enable them by defining feature_x.

This won't work for all extensions, though. If you want to enable an extension
that adds a new type, you will need to make modifications to clang.

-Tom

Hi,

I’m working with libclc/llvm, and encountered a compilation error on generic/include/clc/clc.h

#ifndef cl_clang_storage_class_specifiers
#error Implementation requires cl_clang_storage_class_specifiers extension!
#endif

Quite reasonable; as I’m investigating what goes on in LLVM3.5 I do not see any apparent instances where the various features are turned on for a given target. What (if any) is the ‘normal’ convention used to turn the various extensions on or off for a given target?

There is no convention for this, but what I would suggest is to wrap any extended features
in:

#if feature_x

#endif

And then have either you OpenCL implementation or the target defintion in
clang enable them by defining feature_x.

This won’t work for all extensions, though. If you want to enable an extension
that adds a new type, you will need to make modifications to clang.

-Tom

Note that in the case of storage class specifiers, I’m not sure that defining the feature is enough. I tried doing that in clover a while back and that wasn’t enough to enable usage of the static keyword for functions in clc source.

I had hoped to figure that out for clover a while ago, but babies eat up all available energy/free time.

–Aaron