AnsweredAssumed Answered

How to use mangled name of templated kernel, specified in custom namespace?

Question asked by i_alex2004 on Mar 3, 2015
Latest reply on Mar 20, 2015 by i_alex2004

The problem is: when I use Static C++ OpenCL kernel extension I give mangled names to variants of templated kernel, e.g:


template<typename T>

__kernel void vec_add(__global T *A, __global T *B,  __global T *C)

{

   int idx = get_global_id(o);

   C[idx] = A[idx] + B[idx];

}


template __attribute__((mangled_name(vec_add_int)))

__kernel void vec_add(__global int * A, __global int * B, __global int * C);

}

 

But if I place it into a cstom namespace as shown below:


namespace my_vec_add_namespace {

template<typename T>

__kernel void vec_add(__global T *A, __global T *B,  __global T *C)

{

   int idx = get_global_id(o);

   C[idx] = A[idx] + B[idx];

}


template __attribute__((mangled_name(vec_add_int)))

__kernel void vec_add(__global int * A, __global int * B, __global int * C);

 

}

 

The compiler doesn't see "vec_add_int" kernel during online compilation.

How to use it properly?

Outcomes