-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Though most of the implementation follows a certain logic, some signature different and varies, by little or by a lot. Both in parameters name and order. Some example: maximum_z_projection_x, absolute_2d_x, and add_image_and_scalar_2d_x
I believe it could be nice to uniform as much as possible the kernel signature, to make it a generic as possible, by defining a parameter name nomenclature and order. This would simplify certain implementation aspect on the C++ side (and Python?), improve scalability, and facilitate most of the repetitive implementation (auto-generation?). And this could also facilitate the writing of a documentation raised in #10 .
I would be ok to do it, with anyone who also want to suffer with me, but we need first to have a good signature rule. I am not aware enough yet with all the kernels and the specific cases but here are some first suggestions from what I could see:
- enforce the input and output parameter to be respectively
srcanddst - enforce the first parameter to be
dst, and the second parameter to besrc. This is mainly becausedstis always present (e.g. set_2d_x) - if multiple input or output required, the addition of a numeration, starting from 2, e.g.
src,src2,src3anddst,dst2,dst3 - enforce order priority to first I/O buffer, then buffer parameters, and finally scalar parameters
- the scalar parameter name have less impact as they do not require a push or pull to the GPU side, hence they could keep the meaning full name (e.g. sigma for Gaussian blur).
This would lead to this kind of signature:
__kernel do_something_2d ( dst, src )__kernel do_something_2d ( dst, src, src2, scalar, scalar2 )
And the fun part begins with multiple input and output as it raise two options:
__kernel do_something_2d ( dst, dst2, src, src2, scalar, scalar2 )__kernel do_something_2d ( dst, src, dst2, src2, scalar, scalar2 )