|
||||
Warning, file /include/Vc/fwddecl.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the Vc library. {{{ 0002 Copyright © 2018 Matthias Kretz <kretz@kde.org> 0003 0004 Redistribution and use in source and binary forms, with or without 0005 modification, are permitted provided that the following conditions are met: 0006 * Redistributions of source code must retain the above copyright 0007 notice, this list of conditions and the following disclaimer. 0008 * Redistributions in binary form must reproduce the above copyright 0009 notice, this list of conditions and the following disclaimer in the 0010 documentation and/or other materials provided with the distribution. 0011 * Neither the names of contributing organizations nor the 0012 names of its contributors may be used to endorse or promote products 0013 derived from this software without specific prior written permission. 0014 0015 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 0016 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 0017 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 0018 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 0019 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 0020 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 0021 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 0022 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0023 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 0024 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0025 0026 }}}*/ 0027 0028 #ifndef VC_FWDDECL_H_ 0029 #define VC_FWDDECL_H_ 0030 0031 #include <cstddef> // for std::size_t 0032 0033 #define Vc_VERSIONED_NAMESPACE Vc_1 0034 0035 namespace Vc_VERSIONED_NAMESPACE 0036 { 0037 namespace VectorAbi 0038 { 0039 struct Scalar {}; 0040 struct Sse {}; 0041 struct Avx {}; 0042 struct Mic {}; 0043 template <class T> struct DeduceCompatible; 0044 template <class T> struct DeduceBest; 0045 } // namespace VectorAbi 0046 0047 namespace Common 0048 { 0049 template <class T, std::size_t N> struct select_best_vector_type; 0050 } // namespace Common 0051 0052 template <class T, class Abi> class Mask; 0053 template <class T, class Abi> class Vector; 0054 0055 // === having SimdArray<T, N> in the Vc namespace leads to a ABI bug === 0056 // 0057 // SimdArray<double, 4> can be { double[4] }, { __m128d[2] }, or { __m256d } even though the type 0058 // is the same. 0059 // The question is, what should SimdArray focus on? 0060 // a) A type that makes interfacing between different implementations possible? 0061 // b) Or a type that makes fixed size SIMD easier and efficient? 0062 // 0063 // a) can be achieved by using a union with T[N] as one member. But this may have more serious 0064 // performance implications than only less efficient parameter passing (because compilers have a 0065 // much harder time wrt. aliasing issues). Also alignment would need to be set to the sizeof in 0066 // order to be compatible with targets with larger alignment requirements. 0067 // But, the in-memory representation of masks is not portable. Thus, at the latest with AVX-512, 0068 // there would be a problem with requiring SimdMaskArray<T, N> to be an ABI compatible type. 0069 // AVX-512 uses one bit per boolean, whereas SSE/AVX use sizeof(T) Bytes per boolean. Conversion 0070 // between the two representations is not a trivial operation. Therefore choosing one or the other 0071 // representation will have a considerable impact for the targets that do not use this 0072 // representation. Since the future probably belongs to one bit per boolean representation, I would 0073 // go with that choice. 0074 // 0075 // b) requires that SimdArray<T, N> != SimdArray<T, N> if 0076 // SimdArray<T, N>::vector_type != SimdArray<T, N>::vector_type 0077 // 0078 // Therefore use SimdArray<T, N, V>, where V follows from the above. 0079 template <class T, std::size_t N, 0080 class V = typename Common::select_best_vector_type<T, N>::type, 0081 std::size_t Wt = V::Size> 0082 class SimdArray; 0083 template <class T, std::size_t N, 0084 class V = typename Common::select_best_vector_type<T, N>::type, 0085 std::size_t Wt = V::Size> 0086 class SimdMaskArray; 0087 0088 namespace simd_abi 0089 { 0090 using scalar = VectorAbi::Scalar; 0091 template <int N> struct fixed_size; 0092 template <class T> using compatible = typename VectorAbi::DeduceCompatible<T>::type; 0093 template <class T> using native = typename VectorAbi::DeduceBest<T>::type; 0094 using __sse = VectorAbi::Sse; 0095 using __avx = VectorAbi::Avx; 0096 struct __avx512; 0097 struct __neon; 0098 } // namespace simd_abi 0099 0100 template <class T, class Abi = simd_abi::compatible<T>> using simd = Vector<T, Abi>; 0101 template <class T, class Abi = simd_abi::compatible<T>> using simd_mask = Mask<T, Abi>; 0102 template <class T> using native_simd = simd<T, simd_abi::native<T>>; 0103 template <class T> using native_simd_mask = simd_mask<T, simd_abi::native<T>>; 0104 template <class T, int N> using fixed_size_simd = simd<T, simd_abi::fixed_size<N>>; 0105 template <class T, int N> 0106 using fixed_size_simd_mask = simd_mask<T, simd_abi::fixed_size<N>>; 0107 0108 } // namespace Vc_VERSIONED_NAMESPACE 0109 0110 #ifndef DOXYGEN 0111 // doxygen has Vc_VERSIONED_NAMESPACE predefined to Vc 0112 namespace Vc = Vc_VERSIONED_NAMESPACE; 0113 #endif // DOXYGEN 0114 0115 #endif // VC_FWDDECL_H_ 0116 0117 // vim: foldmethod=marker
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |