Closed AlexRTer closed 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!
Thank you for looking at the cast in the Order.h
kernel.
You can go ahead and merge the PR.
This PR adds implementations using the generic
Matrix
type for most kernels. They only use methods that are sure to be supported byMatrix.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:
Matrix.h
specializations have been added to almost all local kernels with exception of e.g. Neural Network related kernels.Existing tests have been extended to cover these as well. Currently, the kernels always default to a
DenseMatrix
ifres
was given as anullptr
, so tests also use aDenseMatrix
throughGenGivenVals
.DTEmpty
orDTView
to generate these before they are cast to the appropriate type.using DTEmpty = DenseMatrix<typename DTArg::VT>;
static_cast<DTArg *>(DataObjectFactory::create<DTEmpty>(0, 0, false));
Filter*
also expectsel
to be aDenseMatrix
, in which casesDTSel
is sometimes used.DTRes
type thanDTArg
, soDT
might be set usingstd::conditional
DenseMatrix.h
has also been changed to handle empty matrices ifprepare-/finish- Append
is called on them. I suspect this might also be an issue with e.g.CSRMatrix
but I have not yet confirmed this.To do: The cast (l. 327) in
Order.h
should be fine, though restrictive, asVTRes = VTArg
is guaranteed in that case but please confirm this. The problem lies inextractRow
expectingres
andarg
to have the same value type, which is true ifreturnIdx = false
, but the compiler seems to also check if a cast is legal for the case ofreturnIdx = true
in which value types are not guaranteed to be the same - so a static cast does not work.