PDA

View Full Version : Semantics system



jbasic
10-12-2009, 01:05 PM
For faster programming of OpenCL applications, and easier communication between host and OpenCL runtime code, semantics layer system as seen in shading languages (Cg, HLSL, etc.) could be added. Using semantics, host code would be lighter and more flexible (concerning OpenCL compiles code at runtime), with the semi-automatic arguments managing.

In OpenCL C, semantics can be, for example as in C-like shading languages, defined with colon and name after parameter declaration inside kernel parameter list. Example:


__kernel void KernelFunction(__global const *x : INPUT_SEMANTIC, __global *y : OUTPUT_SEMANTIC, int z : A_SEMANTIC)
{
...
}


Example definition of function needed:


cl_int clSetProgramSemantic(cl_program program, const char* name, size_t arg_size, const void * arg_value);

I've made a lightweight semantic system, hopefully will be releasing it soon, but it would be great to see it directly implemented in OpenCL. Using user written semantic system still requires some more function calls, that would be avoided if OpenCL directly managed the semantics.

Thank you for your patience.