AnsweredAssumed Answered

multi recursive function

Question asked by roger512 on Apr 12, 2013
Latest reply on Apr 15, 2013 by roger512



I know recursivity in opencl is a thorny question since we dont have a call stack, still it is possible to emulate it with a private stack.


I already know how to implement a recursive algorithm that would look like :








But concerning a recursive algorithm like that, i dont know how to do it.




     rec_func();     //call 1

     //some random code


     rec_func(); //call 2




the problem is after a call of rec_func(),rec_func() is called again (recursive call 1) and it is computed, then the program need to get back to the instructions after call 1 in order to call rec_func() properly (call 2).


I dont know if it is achievable to emulate that kind of behaviour in opencl. Maybe a goto could be usefull here, to get back at the right position in the code after the stack is poped, but there is no goto unfortunatly.


Maybe i'm not posing the problem in a correct way. If anyone got an idea about this ?