Unify the data pointer in the AVX kernel interface
Issue/feature addressed
Previously there are too many kinds of data pointers:
simd_type *
simd_type::scalarType *
simd_type::vectorType *
And also too many different workspaces
std::vector<simd_t, tinysimd::allocator<simd_t>>
alignas(simd_t::alignment) TData[nqTot*simd_t::wdith];
static_cast<TData *>(::operator new[](nqTot *simd_t::width * sizeof(TData), std::align_val_t(simd_t::alignment)));
Proposed solution
Leave only 1 pointer simd_t *
. We can reinterpret TData *
** to simd_t *
freely and vice versa;**
Leave only std::vector<simd_t, tinysimd::allocator<simd_t>>
as a workspace;
Technically, using a plain array when size is a compile-time constant should guarantee the memory allocated on stack rather than heap, which is more efficient.
But so far, no clear evidence shows this has a significant impact.
Implementation
Tests
Suggested reviewers
Notes
Please add any other information that could be useful for reviewers.
Checklist
-
Functions and classes, or changes to them, are documented. [ ] User guide/documentation is updated.[ ] Changelog is updated.-
Suitable tests added for new functionality. -
Contributed code is correctly formatted. (See the contributing guidelines). -
License added to any new files. -
No extraneous files have been added (e.g. compiler output or test data files).
Edited by Jacques Xing