-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,8 +90,17 @@ double DotProductAVX(const double* u, const double* v, int n) { | |
// _mm256_extract_f64 doesn't exist, but resist the temptation to use an sse | ||
// instruction, as that introduces a 70 cycle delay. All this casting is to | ||
// fool the instrinsics into thinking we are extracting the bottom int64. | ||
auto cast_sum = _mm256_castpd_si256(sum); | ||
*(reinterpret_cast<inT64*>(&result)) = | ||
_mm256_extract_epi64(_mm256_castpd_si256(sum), 0); | ||
#ifndef _WIN32 | ||
_mm256_extract_epi64(cast_sum, 0) | ||
#else | ||
// this is a very simple workaround that probably could be activated | ||
// for all other platforms that do not have _mm256_extract_epi64 | ||
// _mm256_extract_epi64(X, Y) == ((uint64_t*)&X)[Y] | ||
((uint64_t*)&cast_sum)[0] | ||
#endif | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
egorpugin
Author
Contributor
|
||
; | ||
while (offset < n) { | ||
result += u[offset] * v[offset]; | ||
++offset; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Should
PROPERTIES COMPILE_DEFINITIONS __AVX__)
be added here? Or is that macro also set by MSVC?