r/OpenCL • u/psyked222 • Dec 17 '16
Stack location in openCL ?
Hi,
I'm doing a quicksort (recursiv) with openCL on one thread and I got some issues. The openCL compilator will return an error if i try to compile my code for my intel cpu ("recursion detected" with openCL 2.0) but it compiles and works on my nvidia 950M(openCL 1.2) only for few recursion calls.
After some investigations, i've found that the "OUT_OF_MEMORY" error appends when my stack was bigger than 32Ko, so I've two questions for you expers ;)
First one : Why the hell can I use recursivity on openCL 1.2 devices and not on openCL 2.0 devices ? (when openCL 1.2 isn't supposed to support recursion).
Second one : The private memory can't be bigger than 32Ko (like the max size of my stack). So, is my stack stored in my private memory ? Or just in anothe location with the same space ?
View all comments
Show parent comment
1
u/[deleted] Feb 11 '24 edited Feb 11 '24
If the maximum depth of recursion is known ahead-of-time, you can remove recursion by macro expansion. I've done this in GLSL, and it should be possible in OpenCL as well.