AVX/TypeCasting.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_TYPE_CASTING_AVX_H
11 #define EIGEN_TYPE_CASTING_AVX_H
12 
13 namespace Eigen {
14 
15 namespace internal {
16 
17 // For now we use SSE to handle integers, so we can't use AVX instructions to cast
18 // from int to float
19 template <>
20 struct type_casting_traits<float, int> {
21  enum {
22  VectorizedCast = 0,
23  SrcCoeffRatio = 1,
24  TgtCoeffRatio = 1
25  };
26 };
27 
28 template <>
29 struct type_casting_traits<int, float> {
30  enum {
31  VectorizedCast = 0,
32  SrcCoeffRatio = 1,
33  TgtCoeffRatio = 1
34  };
35 };
36 
37 
38 #ifndef EIGEN_VECTORIZE_AVX512
39 
40 template <>
42  enum {
46  };
47 };
48 
49 
50 template <>
52  enum {
56  };
57 };
58 
59 template <>
61  enum {
65  };
66 };
67 
68 template <>
70  enum {
74  };
75 };
76 
77 #endif // EIGEN_VECTORIZE_AVX512
78 
80  return _mm256_cvttps_epi32(a);
81 }
82 
84  return _mm256_cvtepi32_ps(a);
85 }
86 
88  return _mm256_castps_si256(a);
89 }
90 
92  return _mm256_castsi256_ps(a);
93 }
94 
96  return half2float(a);
97 }
98 
100  return Bf16ToF32(a);
101 }
102 
104  return float2half(a);
105 }
106 
108  return F32ToBf16(a);
109 }
110 
111 } // end namespace internal
112 
113 } // end namespace Eigen
114 
115 #endif // EIGEN_TYPE_CASTING_AVX_H
EIGEN_STRONG_INLINE Packet8f half2float(const Packet8h &a)
EIGEN_STRONG_INLINE Packet8f preinterpret< Packet8f, Packet8i >(const Packet8i &a)
EIGEN_STRONG_INLINE Packet8f Bf16ToF32(const Packet8bf &a)
EIGEN_STRONG_INLINE Packet8bf F32ToBf16(Packet4f p4f)
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
EIGEN_STRONG_INLINE Packet8f pcast< Packet8bf, Packet8f >(const Packet8bf &a)
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
EIGEN_STRONG_INLINE Packet8f pcast< Packet8i, Packet8f >(const Packet8i &a)
EIGEN_STRONG_INLINE Packet8i preinterpret< Packet8i, Packet8f >(const Packet8f &a)
EIGEN_STRONG_INLINE Packet8i pcast< Packet8f, Packet8i >(const Packet8f &a)
EIGEN_STRONG_INLINE Packet8bf pcast< Packet8f, Packet8bf >(const Packet8f &a)
EIGEN_STRONG_INLINE Packet8f pcast< Packet8h, Packet8f >(const Packet8h &a)
EIGEN_STRONG_INLINE Packet8h float2half(const Packet8f &a)
EIGEN_STRONG_INLINE Packet8h pcast< Packet8f, Packet8h >(const Packet8f &a)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:40:38