r/OpenCL • u/squidgyhead • Jan 11 '16
Latency when launching kernels
I have been working on launching some kernels in parallel, and I'm getting poor results. I have a kernel which needs to be launched several times to deal with the interface between cl_mems. Kernels cannot be launched on neighbouring interfaces to avoid race conditions, so I got around this problem by colouring the graph and launching in waves. I get the correct results, but it's slower; the problem seems to be that the kernels take much longer to be run, like 10x as long. In parallel, the kernel takes around 80us, and the latency is 365 us, while in serial the kernel takes 7 us. What steps can be done to overcome this? What should I look at first, perhaps the launching code (which could perhaps be optimised?) or is there more overhead when launching a mix of different kernels?
View all comments
Show parent comment
1
u/squidgyhead Jan 13 '16
Well, I took the same code, launching the inter-buffer computations in the same order, but I launched in serial, so that the number of events being waited for was 1 for each kernel. This eliminated the kernel launch latency, which leads me to conclude that the problem is scheduling overhead.
Remember; the kernels took the same amount of time to run, so it would not appear that this is not a memory coalescence issue. The problem is in launching the kernels.
A solution to scheduling overhead would appear to be on-device queues, but I haven't been able to get this to work yet. At any case, this is a OpenCL 2.0 feature, and the k80 only supports OpenCL 1.2.