19
19
#include " dotproduct.h"
20
20
#include " dotproductavx.h"
21
21
#include " dotproductsse.h"
22
+ #include " intsimdmatrix.h" // for IntSimdMatrix
22
23
#include " params.h" // for STRING_VAR
23
24
#include " tprintf.h" // for tprintf
24
25
@@ -68,8 +69,9 @@ static double DotProductGeneric(const double* u, const double* v, int n) {
68
69
return total;
69
70
}
70
71
71
- static void SetDotProduct (DotProductFunction function) {
72
- DotProduct = function;
72
+ static void SetDotProduct (DotProductFunction f, const IntSimdMatrix* m = nullptr ) {
73
+ DotProduct = f;
74
+ IntSimdMatrix::intSimdMatrix = m;
73
75
}
74
76
75
77
// Constructor.
@@ -126,12 +128,12 @@ SIMDDetect::SIMDDetect() {
126
128
#if defined(AVX)
127
129
} else if (avx_available_) {
128
130
// AVX detected.
129
- SetDotProduct (DotProductAVX);
131
+ SetDotProduct (DotProductAVX, &IntSimdMatrix::IntSimdMatrixAVX2 );
130
132
#endif
131
133
#if defined(SSE4_1)
132
134
} else if (sse_available_) {
133
135
// SSE detected.
134
- SetDotProduct (DotProductSSE);
136
+ SetDotProduct (DotProductSSE, &IntSimdMatrix::IntSimdMatrixSSE );
135
137
#endif
136
138
}
137
139
}
@@ -153,13 +155,13 @@ void SIMDDetect::Update() {
153
155
#if defined(AVX)
154
156
} else if (!strcmp (dotproduct.string (), " avx" )) {
155
157
// AVX selected by config variable.
156
- SetDotProduct (DotProductAVX);
158
+ SetDotProduct (DotProductAVX, &IntSimdMatrix::IntSimdMatrixAVX2 );
157
159
dotproduct_method = " avx" ;
158
160
#endif
159
161
#if defined(SSE4_1)
160
162
} else if (!strcmp (dotproduct.string (), " sse" )) {
161
163
// SSE selected by config variable.
162
- SetDotProduct (DotProductSSE);
164
+ SetDotProduct (DotProductSSE, &IntSimdMatrix::IntSimdMatrixSSE );
163
165
dotproduct_method = " sse" ;
164
166
#endif
165
167
} else {
0 commit comments