Login  Register

Re: Where does my code spend time and how to improve this

Posted by nyholku on Jan 01, 2019; 6:37pm
URL: https://forum.jogamp.org/Where-does-my-code-spend-time-and-how-to-improve-this-tp4039358p4039360.html

Thanks for taking a look.

For test I simplified the kernel to:

int x=get_global_id(0);
int y=get_global_id(1);
int si = (x + tool_pos_x) + (y + tool_pos_y) * stock_size;
stock[si] = 0.0f;

And it makes no difference. So the limiting factor must be the kernel scheduling time?

For that of course doing more work inside the kernel would work, I will try that.

Yes, you are right about the float/int mix. Basically everything is int so I will fix that.

The data dependent stuff needs to be there, it is the beef of the calculation. As far as I understand (which is not much at this point) the execution time will be the sum of code path execution times in and since there is no else part in the if I think this should just execute at the speed as if every statement is executed.

The integer math not being GPU strong side, you are of course right. On the other hand there is only integer addition and comparison ahd the multiplications are variable by constants and are the sort of index calculations that every kernel needs to do so I expect OpenCL/GPU must be pretty efficient at those. And my test above would seem to indicate that indeed the actual work done inside kernel does not matter much.

So I guess I will have to go and try get more work done in the kernel.

Thanks again!

wbr Kusti