Skip to content

Commit

Permalink
Set global avx2 for linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
zwd-ms committed Nov 30, 2022
1 parent f17b0e8 commit 1e999d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmake/VWFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
if(NOT "arm64" STREQUAL "${CMAKE_OSX_ARCHITECTURES}")
# Use sse2 by default. Change to latest simd extensions such as avx512 on supported architecture.
set(LINUX_X86_64_OPT_FLAGS -msse2 -mfpmath=sse)
if(UNIX AND NOT APPLE)
set(LINUX_X86_64_OPT_FLAGS ${LINUX_X86_64_OPT_FLAGS} -mavx2 -mfma)
endif()
endif()
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#include "vw/core/v_array.h"
#include "vw/core/vw_fwd.h"

// Eigen explicit vectorization may not work well with AVX2 when using smaller MAX_ALIGN_BYTES.
// For more info:
// https://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html#TopicPreprocessorDirectivesPerformance
#define EIGEN_MAX_ALIGN_BYTES 32

#include <Eigen/Dense>
#include <Eigen/SparseCore>
#include <iostream>
Expand Down

0 comments on commit 1e999d0

Please sign in to comment.