Skip to content

Commit

Permalink
Fix selection of IntSimdMatrix method
Browse files Browse the repository at this point in the history
Commit d36231e did not distinguish
between AVX and AVX2, so AVX2 code was enabled for IntSimdMatrix
even when only AVX was supported.

This resulted in an illegal instruction.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jan 20, 2019
1 parent 277457f commit 564482d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/arch/simddetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,15 @@ SIMDDetect::SIMDDetect() {
// Select code for calculation of dot product based on autodetection.
if (false) {
// This is a dummy to support conditional compilation.
#if defined(AVX2)
} else if (avx2_available_) {
// AVX2 detected.
SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixAVX2);
#endif
#if defined(AVX)
} else if (avx_available_) {
// AVX detected.
SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixAVX2);
SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixSSE);
#endif
#if defined(SSE4_1)
} else if (sse_available_) {
Expand All @@ -152,10 +157,16 @@ void SIMDDetect::Update() {
// Native optimized code selected by config variable.
SetDotProduct(DotProductNative);
dotproduct_method = "native";
#if defined(AVX2)
} else if (!strcmp(dotproduct.string(), "avx2")) {
// AVX2 selected by config variable.
SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixAVX2);
dotproduct_method = "avx2";
#endif
#if defined(AVX)
} else if (!strcmp(dotproduct.string(), "avx")) {
// AVX selected by config variable.
SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixAVX2);
SetDotProduct(DotProductAVX, &IntSimdMatrix::intSimdMatrixSSE);
dotproduct_method = "avx";
#endif
#if defined(SSE4_1)
Expand Down

0 comments on commit 564482d

Please sign in to comment.