Skip to content

Kernel signature uniformisation #11

@StRigaud

Description

@StRigaud

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:

  1. enforce the input and output parameter to be respectively src and dst
  2. enforce the first parameter to be dst, and the second parameter to be src. This is mainly because dst is always present (e.g. set_2d_x)
  3. if multiple input or output required, the addition of a numeration, starting from 2, e.g. src, src2, src3 and dst, dst2, dst3
  4. enforce order priority to first I/O buffer, then buffer parameters, and finally scalar parameters
  5. 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:

  1. __kernel do_something_2d ( dst, dst2, src, src2, scalar, scalar2 )
  2. __kernel do_something_2d ( dst, src, dst2, src2, scalar, scalar2 )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions