daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 62 forks source link

Generic Matrix kernel specializations #722

Closed AlexRTer closed 6 months ago

AlexRTer commented 6 months ago

This PR adds implementations using the generic Matrix type for most kernels. They only use methods that are sure to be supported by Matrix.h based classes, i.e. get, set, prepare-/finish-/append.

Hence, new classes based on Matrix.h do not necessarily have to implement specializations for all kernels in order to make use of them. The implementations do not assume any additional constraints (e.g. memory layout) which limits possibilities for optimization in some cases. Therefore, they do not replace specialized kernels entirely but save a great amount of time by providing basic utility "out of the box". Note that this PR only adds the necessary specialized kernels and does not make them accessible to the runtime yet.

Changes:

To do: The cast (l. 327) in Order.h should be fine, though restrictive, as VTRes = VTArg is guaranteed in that case but please confirm this. The problem lies in extractRow expecting res and arg to have the same value type, which is true if returnIdx = false, but the compiler seems to also check if a cast is legal for the case of returnIdx = true in which value types are not guaranteed to be the same - so a static cast does not work.

pdamme commented 6 months ago

Thanks also for cleaning up the existing kernels and their test cases a bit (e.g., consistent file structure, corrections of misformattings and misnamings, compaction of multiple DataObjectFactory::destroy() into a single one, adding missing destroys() etc.). Very much appreciated!

AlexRTer commented 6 months ago

Thank you for looking at the cast in the Order.h kernel. You can go ahead and merge the PR.