In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
In file included from ./../x86-simd-sort/src/xss-pivot-selection.hpp:5:
./../x86-simd-sort/src/xss-common-comparators.hpp:39:28: error: implicit instantiation of undefined template 'avx2_vector<short>'
39 | using reg_t = typename vtype::reg_t;
| ^
./../x86-simd-sort/src/xss-common-qsort.h:540:48: note: in instantiation of template class 'Comparator<avx2_vector<short>, true>' requested here
540 | std::sort(arr + left, arr + right + 1, comparator::STDSortComparator);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:701:9: note: in instantiation of function template specialization 'qsort_<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
701 | qsort_<vtype, comparator, T>(
| ^
./../x86-simd-sort/src/xss-common-qsort.h:806:1: note: in instantiation of function template specialization 'xss_qsort<avx2_vector<short>, short, true>' requested here
806 | DEFINE_METHODS(avx2, avx2_vector<T>)
| ^
./../x86-simd-sort/src/xss-common-qsort.h:773:27: note: expanded from macro 'DEFINE_METHODS'
773 | if (descending) { xss_qsort<VTYPE, T, true>(arr, size, hasnan); } \
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:208:1: note: in instantiation of function template specialization 'avx2_qsort<short>' requested here
208 | XSS_METHODS(avx2)
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:78:9: note: expanded from macro 'XSS_METHODS'
78 | ISA##_qsort(arr, size, hasnan, descending); \
| ^
<scratch space>:164:1: note: expanded from here
164 | avx2_qsort
| ^
main.cpp:15:24: note: in instantiation of function template specialization 'x86simdsortStatic::qsort<short>' requested here
15 | x86simdsortStatic::qsort(arr.data(), 34, ARRSIZE);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
In file included from ./../x86-simd-sort/src/xss-pivot-selection.hpp:5:
./../x86-simd-sort/src/xss-common-comparators.hpp:40:31: error: implicit instantiation of undefined template 'avx2_vector<short>'
40 | using opmask_t = typename vtype::opmask_t;
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
In file included from ./../x86-simd-sort/src/xss-pivot-selection.hpp:5:
./../x86-simd-sort/src/xss-common-comparators.hpp:41:29: error: implicit instantiation of undefined template 'avx2_vector<short>'
41 | using type_t = typename vtype::type_t;
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
./../x86-simd-sort/src/xss-common-qsort.h:546:29: error: implicit instantiation of undefined template 'avx2_vector<short>'
546 | if (right + 1 - left <= vtype::network_sort_threshold) {
| ^
./../x86-simd-sort/src/xss-common-qsort.h:701:9: note: in instantiation of function template specialization 'qsort_<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
701 | qsort_<vtype, comparator, T>(
| ^
./../x86-simd-sort/src/xss-common-qsort.h:806:1: note: in instantiation of function template specialization 'xss_qsort<avx2_vector<short>, short, true>' requested here
806 | DEFINE_METHODS(avx2, avx2_vector<T>)
| ^
./../x86-simd-sort/src/xss-common-qsort.h:773:27: note: expanded from macro 'DEFINE_METHODS'
773 | if (descending) { xss_qsort<VTYPE, T, true>(arr, size, hasnan); } \
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:208:1: note: in instantiation of function template specialization 'avx2_qsort<short>' requested here
208 | XSS_METHODS(avx2)
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:78:9: note: expanded from macro 'XSS_METHODS'
78 | ISA##_qsort(arr, size, hasnan, descending); \
| ^
<scratch space>:164:1: note: expanded from here
164 | avx2_qsort
| ^
main.cpp:15:24: note: in instantiation of function template specialization 'x86simdsortStatic::qsort<short>' requested here
15 | x86simdsortStatic::qsort(arr.data(), 34, ARRSIZE);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
./../x86-simd-sort/src/xss-common-qsort.h:558:23: error: implicit instantiation of undefined template 'avx2_vector<short>'
558 | type_t smallest = vtype::type_max();
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
./../x86-simd-sort/src/xss-common-qsort.h:559:22: error: implicit instantiation of undefined template 'avx2_vector<short>'
559 | type_t biggest = vtype::type_min();
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
./../x86-simd-sort/src/xss-common-qsort.h:563:48: error: implicit instantiation of undefined template 'avx2_vector<short>'
563 | vtype::partition_unroll_factor>(
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
./../x86-simd-sort/src/xss-pivot-selection.hpp:98:28: error: implicit instantiation of undefined template 'avx2_vector<short>'
98 | using reg_t = typename vtype::reg_t;
| ^
./../x86-simd-sort/src/xss-common-qsort.h:553:15: note: in instantiation of function template specialization 'get_pivot_smart<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
553 | = get_pivot_smart<vtype, comparator, type_t>(arr, left, right);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:701:9: note: in instantiation of function template specialization 'qsort_<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
701 | qsort_<vtype, comparator, T>(
| ^
./../x86-simd-sort/src/xss-common-qsort.h:806:1: note: in instantiation of function template specialization 'xss_qsort<avx2_vector<short>, short, true>' requested here
806 | DEFINE_METHODS(avx2, avx2_vector<T>)
| ^
./../x86-simd-sort/src/xss-common-qsort.h:773:27: note: expanded from macro 'DEFINE_METHODS'
773 | if (descending) { xss_qsort<VTYPE, T, true>(arr, size, hasnan); } \
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:208:1: note: in instantiation of function template specialization 'avx2_qsort<short>' requested here
208 | XSS_METHODS(avx2)
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:78:9: note: expanded from macro 'XSS_METHODS'
78 | ISA##_qsort(arr, size, hasnan, descending); \
| ^
<scratch space>:164:1: note: expanded from here
164 | avx2_qsort
| ^
main.cpp:15:24: note: in instantiation of function template specialization 'x86simdsortStatic::qsort<short>' requested here
15 | x86simdsortStatic::qsort(arr.data(), 34, ARRSIZE);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
./../x86-simd-sort/src/xss-pivot-selection.hpp:101:43: error: implicit instantiation of undefined template 'avx2_vector<short>'
101 | if (right - left + 1 <= 4 * numVecs * vtype::numlanes) {
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
./../x86-simd-sort/src/xss-pivot-selection.hpp:105:33: error: implicit instantiation of undefined template 'avx2_vector<short>'
105 | constexpr int N = numVecs * vtype::numlanes;
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
./../x86-simd-sort/src/xss-pivot-selection.hpp:107:32: error: implicit instantiation of undefined template 'avx2_vector<short>'
107 | arrsize_t width = (right - vtype::numlanes) - left;
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
./../x86-simd-sort/src/xss-pivot-selection.hpp:112:19: error: implicit instantiation of undefined template 'avx2_vector<short>'
112 | vecs[i] = vtype::loadu(arr + left + delta * i);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
./../x86-simd-sort/src/xss-pivot-selection.hpp:122:9: error: implicit instantiation of undefined template 'avx2_vector<short>'
122 | vtype::storeu(samples + vtype::numlanes * i, vecs[i]);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
In file included from ./../x86-simd-sort/src/xss-pivot-selection.hpp:5:
./../x86-simd-sort/src/xss-common-comparators.hpp:39:28: error: implicit instantiation of undefined template 'avx2_vector<short>'
39 | using reg_t = typename vtype::reg_t;
| ^
./../x86-simd-sort/src/xss-optimal-networks.hpp:9:5: note: in instantiation of template class 'Comparator<avx2_vector<short>, false>' requested here
9 | comparator::COEX(vecs[0], vecs[2]);
| ^
./../x86-simd-sort/src/xss-network-qsort.hpp:23:9: note: in instantiation of function template specialization 'optimal_sort_4<avx2_vector<short>, Comparator<avx2_vector<short>, false>, int>' requested here
23 | optimal_sort_4<vtype, comparator>(regs);
| ^
./../x86-simd-sort/src/xss-network-qsort.hpp:165:5: note: in instantiation of function template specialization 'bitonic_sort_n_vec<avx2_vector<short>, Comparator<avx2_vector<short>, false>, 4, int>' requested here
165 | bitonic_sort_n_vec<vtype, comparator, numVecs>(vecs);
| ^
./../x86-simd-sort/src/xss-pivot-selection.hpp:118:5: note: in instantiation of function template specialization 'sort_vectors<avx2_vector<short>, Comparator<avx2_vector<short>, false>, 4, int>' requested here
118 | sort_vectors<vtype, Comparator<vtype, false>, numVecs>(vecs);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:553:15: note: in instantiation of function template specialization 'get_pivot_smart<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
553 | = get_pivot_smart<vtype, comparator, type_t>(arr, left, right);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:701:9: note: in instantiation of function template specialization 'qsort_<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
701 | qsort_<vtype, comparator, T>(
| ^
./../x86-simd-sort/src/xss-common-qsort.h:806:1: note: in instantiation of function template specialization 'xss_qsort<avx2_vector<short>, short, true>' requested here
806 | DEFINE_METHODS(avx2, avx2_vector<T>)
| ^
./../x86-simd-sort/src/xss-common-qsort.h:773:27: note: expanded from macro 'DEFINE_METHODS'
773 | if (descending) { xss_qsort<VTYPE, T, true>(arr, size, hasnan); } \
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:208:1: note: in instantiation of function template specialization 'avx2_qsort<short>' requested here
208 | XSS_METHODS(avx2)
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:78:9: note: expanded from macro 'XSS_METHODS'
78 | ISA##_qsort(arr, size, hasnan, descending); \
| ^
<scratch space>:164:1: note: expanded from here
164 | avx2_qsort
| ^
main.cpp:15:24: note: in instantiation of function template specialization 'x86simdsortStatic::qsort<short>' requested here
15 | x86simdsortStatic::qsort(arr.data(), 34, ARRSIZE);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
In file included from ./../x86-simd-sort/src/xss-pivot-selection.hpp:5:
./../x86-simd-sort/src/xss-common-comparators.hpp:40:31: error: implicit instantiation of undefined template 'avx2_vector<short>'
40 | using opmask_t = typename vtype::opmask_t;
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
In file included from ./../x86-simd-sort/src/xss-pivot-selection.hpp:5:
./../x86-simd-sort/src/xss-common-comparators.hpp:41:29: error: implicit instantiation of undefined template 'avx2_vector<short>'
41 | using type_t = typename vtype::type_t;
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
./../x86-simd-sort/src/xss-common-qsort.h:195:9: error: implicit instantiation of undefined template 'avx2_vector<short>'
195 | a = vtype::min(a, b);
| ^
./../x86-simd-sort/src/xss-common-comparators.hpp:64:15: note: in instantiation of function template specialization 'COEX<avx2_vector<short>, int>' requested here
64 | ::COEX<vtype, reg_t>(a, b);
| ^
./../x86-simd-sort/src/xss-optimal-networks.hpp:10:17: note: in instantiation of member function 'Comparator<avx2_vector<short>, false>::COEX' requested here
10 | comparator::COEX(vecs[1], vecs[3]);
| ^
./../x86-simd-sort/src/xss-network-qsort.hpp:23:9: note: in instantiation of function template specialization 'optimal_sort_4<avx2_vector<short>, Comparator<avx2_vector<short>, false>, int>' requested here
23 | optimal_sort_4<vtype, comparator>(regs);
| ^
./../x86-simd-sort/src/xss-network-qsort.hpp:165:5: note: in instantiation of function template specialization 'bitonic_sort_n_vec<avx2_vector<short>, Comparator<avx2_vector<short>, false>, 4, int>' requested here
165 | bitonic_sort_n_vec<vtype, comparator, numVecs>(vecs);
| ^
./../x86-simd-sort/src/xss-pivot-selection.hpp:118:5: note: in instantiation of function template specialization 'sort_vectors<avx2_vector<short>, Comparator<avx2_vector<short>, false>, 4, int>' requested here
118 | sort_vectors<vtype, Comparator<vtype, false>, numVecs>(vecs);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:553:15: note: in instantiation of function template specialization 'get_pivot_smart<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
553 | = get_pivot_smart<vtype, comparator, type_t>(arr, left, right);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:701:9: note: in instantiation of function template specialization 'qsort_<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
701 | qsort_<vtype, comparator, T>(
| ^
./../x86-simd-sort/src/xss-common-qsort.h:806:1: note: in instantiation of function template specialization 'xss_qsort<avx2_vector<short>, short, true>' requested here
806 | DEFINE_METHODS(avx2, avx2_vector<T>)
| ^
./../x86-simd-sort/src/xss-common-qsort.h:773:27: note: expanded from macro 'DEFINE_METHODS'
773 | if (descending) { xss_qsort<VTYPE, T, true>(arr, size, hasnan); } \
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:208:1: note: in instantiation of function template specialization 'avx2_qsort<short>' requested here
208 | XSS_METHODS(avx2)
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:78:9: note: expanded from macro 'XSS_METHODS'
78 | ISA##_qsort(arr, size, hasnan, descending); \
| ^
<scratch space>:164:1: note: expanded from here
164 | avx2_qsort
| ^
main.cpp:15:24: note: in instantiation of function template specialization 'x86simdsortStatic::qsort<short>' requested here
15 | x86simdsortStatic::qsort(arr.data(), 34, ARRSIZE);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
./../x86-simd-sort/src/xss-common-qsort.h:196:9: error: implicit instantiation of undefined template 'avx2_vector<short>'
196 | b = vtype::max(temp, b);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
In file included from main.cpp:2:
In file included from ./../x86-simd-sort/src/x86simdsort-static-incl.h:155:
In file included from ./../x86-simd-sort/src/xss-common-qsort.h:37:
In file included from ./../x86-simd-sort/src/xss-pivot-selection.hpp:4:
./../x86-simd-sort/src/xss-network-qsort.hpp:146:28: error: implicit instantiation of undefined template 'avx2_vector<short>'
146 | if constexpr (numPer > vtype::numlanes) {
| ^
./../x86-simd-sort/src/xss-network-qsort.hpp:168:5: note: in instantiation of function template specialization 'merge_n_vec<avx2_vector<short>, Comparator<avx2_vector<short>, false>, 4, 2, int>' requested here
168 | merge_n_vec<vtype, comparator, numVecs>(vecs);
| ^
./../x86-simd-sort/src/xss-pivot-selection.hpp:118:5: note: in instantiation of function template specialization 'sort_vectors<avx2_vector<short>, Comparator<avx2_vector<short>, false>, 4, int>' requested here
118 | sort_vectors<vtype, Comparator<vtype, false>, numVecs>(vecs);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:553:15: note: in instantiation of function template specialization 'get_pivot_smart<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
553 | = get_pivot_smart<vtype, comparator, type_t>(arr, left, right);
| ^
./../x86-simd-sort/src/xss-common-qsort.h:701:9: note: in instantiation of function template specialization 'qsort_<avx2_vector<short>, Comparator<avx2_vector<short>, true>, short>' requested here
701 | qsort_<vtype, comparator, T>(
| ^
./../x86-simd-sort/src/xss-common-qsort.h:806:1: note: in instantiation of function template specialization 'xss_qsort<avx2_vector<short>, short, true>' requested here
806 | DEFINE_METHODS(avx2, avx2_vector<T>)
| ^
./../x86-simd-sort/src/xss-common-qsort.h:773:27: note: expanded from macro 'DEFINE_METHODS'
773 | if (descending) { xss_qsort<VTYPE, T, true>(arr, size, hasnan); } \
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:208:1: note: in instantiation of function template specialization 'avx2_qsort<short>' requested here
208 | XSS_METHODS(avx2)
| ^
./../x86-simd-sort/src/x86simdsort-static-incl.h:78:9: note: expanded from macro 'XSS_METHODS'
78 | ISA##_qsort(arr, size, hasnan, descending); \
| ^
<scratch space>:164:1: note: expanded from here
164 | avx2_qsort
| ^
main.cpp:15:24: note: in instantiation of function template specialization 'x86simdsortStatic::qsort<short>' requested here
15 | x86simdsortStatic::qsort(arr.data(), 34, ARRSIZE);
| ^
./../x86-simd-sort/src/xss-common-includes.h:102:8: note: template is declared here
102 | struct avx2_vector;
| ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
This patch tries to make type errors better when building with the static functions. It should hopefully make it more clear when the typing is an issue.
Here is a comparison between before and after error messages for GCC with a simple test program that tries to sort int16_t values. This is built with only AVX2 enabled, so int16_t sorting is not available.
GCC Before
GCC After
Unfortunately, it doesn't work nearly as well for Clang:
Clang Before
Clang After
I'm not so sure about the description for the error messages, so I'd be glad to get feedback on that.