enable specifying number of lanes for simd type
Issue/feature addressed
Fixes this error
In file included from /home/gcastigl/codes/nektar/library/UnitTests/LibUtilities/TestVmathSIMD.cpp:35:
/home/gcastigl/codes/nektar/library/LibUtilities/BasicUtils/VmathSIMD.hpp: In instantiation of ‘void Vmath::SIMD::Gathr(I, const T*, const I*, T*) [with T = double; I = int; <template-parameter-1-3> = void]’:
/home/gcastigl/codes/nektar/library/UnitTests/LibUtilities/TestVmathSIMD.cpp:339:56: required from here
/home/gcastigl/codes/nektar/library/LibUtilities/BasicUtils/VmathSIMD.hpp:437:9: error: no matching function for call to ‘tinysimd::avx2Double4::gather(const double*&, vec_t_i&)’
437 | zChunk0.gather(x, yChunk0);
| ^~~~~~~
In file included from /home/gcastigl/codes/nektar/library/LibUtilities/SimdLib/tinysimd.hpp:38,
from /home/gcastigl/codes/nektar/library/LibUtilities/BasicUtils/VmathSIMD.hpp:42,
from /home/gcastigl/codes/nektar/library/UnitTests/LibUtilities/TestVmathSIMD.cpp:35:
/home/gcastigl/codes/nektar/library/LibUtilities/SimdLib/avx2.hpp:433:17: note: candidate: ‘template<class T> void tinysimd::avx2Double4::gather(const scalarType*, const tinysimd::avx2Long4<T>&)’
433 | inline void gather(scalarType const *p, const avx2Long4<T> &indices)
| ^~~~~~
/home/gcastigl/codes/nektar/library/LibUtilities/SimdLib/avx2.hpp:433:17: note: template argument deduction/substitution failed:
In file included from /home/gcastigl/codes/nektar/library/UnitTests/LibUtilities/TestVmathSIMD.cpp:35:
/home/gcastigl/codes/nektar/library/LibUtilities/BasicUtils/VmathSIMD.hpp:437:9: note: ‘vec_t_i’ {aka ‘tinysimd::avx2Int8<int>’} is not derived from ‘const tinysimd::avx2Long4<T>’
437 | zChunk0.gather(x, yChunk0);
| ^~~~~~~
/home/gcastigl/codes/nektar/library/LibUtilities/BasicUtils/VmathSIMD.hpp:438:9: error: no matching function for call to ‘tinysimd::avx2Double4::gather(const double*&, vec_t_i&)’
438 | zChunk1.gather(x, yChunk1);
| ^
Implementation
Extended the mapping between abstract and concrete types to optionally specify the number of lanes. This allows to choose non native combo, for instance 64 bit floating point with 32 bit indexes. Before introducing fp 32 the dispatch was always unambiguous.
Tests
Restored TestGathrInt
that was disabled when we introduced floats.
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).
Warning
On the 19.07 the code formatting (code style) was standardised using clang-format, over the whole Nektar++ code. This means changes in your branch will conflict with formatting changes on the master
branch. To resolve these conflicts , see
#295 (closed)
Edited by Giacomo Castiglioni