[Libclc-dev] How to access work-item functions with libclc?
peter at pcc.me.uk
Sat Mar 10 18:39:09 GMT 2012
On Fri, Mar 09, 2012 at 01:47:01PM -0500, Tom Stellard wrote:
> I'm working on adding support to libclc for the r600 target (AMD GPUs),
> and I'm having a little trouble figuring out how to how to use libclc with
> the Clang API. Right now, I'm just trying to test my get_global_id()
> implementation, but this function does not appear to have been compiled
> into the buitins.bc file generated for my target. Are the workitem
> functions supposed to end up in the bytecode library, or should I just
> be including the work-item header files directly?
If you are following the example given by the PTX work-item and
synchronisation functions, then that is probably a bad example
to follow at the moment, because they are the only functions that
have not yet been moved from inline definitions in header files to
declarations in header files plus definitions in the builtin library
All builtin functions should have their implementations in the
builtin library wherever possible to decrease the amount of parsing
required per translation unit, thereby improving performance. If you
are writing your own work-item functions for the r600 target then I
would recommend following the example of all other builtin functions
in the library by adding header files containing function declarations
in r600/include/clc together with definitions in r600/lib.
In all cases, the only header file that needs to be included in every
OpenCL C translation unit is clc/clc.h which transitively includes
all builtin function header files.
More information about the Libclc-dev