I need to be able to do something like this in OpenCL, where to my kernel I'll pass an index, and that index represents what function I need currently (C++ example):
int a(int _i) {
return +_i;
}
int b(int _i) {
return -_i;
}
decltype(a) * FUNCS[2] = { a, b };
int main() {
FUNCS[0](9);
}
I basically want to create n
local functions in the kernel file along with the main kernel, and being able to choose what to use based on the index I'll pass globally.
Is this possible?