Skip to content

Commit

Permalink
add to vw_core
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmang committed Jun 3, 2024
1 parent 362b98b commit b778776
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ option(VW_BUILD_VW_C_WRAPPER "Enable building the c_wrapper project" ON)
option(vw_BUILD_NET_CORE "Build .NET Core targets" OFF)
option(vw_BUILD_NET_FRAMEWORK "Build .NET Framework targets" OFF)
option(VW_BUILD_WASM "Add WASM target" OFF)
option(STD_INV_SQRT "Use standard library inverse square root" OFF)

if(VW_INSTALL AND NOT VW_ZLIB_SYS_DEP)
message(WARNING "Installing with a vendored version of zlib is not recommended. Use VW_ZLIB_SYS_DEP to use a system dependency or specify VW_INSTALL=OFF to silence this warning.")
Expand Down
4 changes: 4 additions & 0 deletions vowpalwabbit/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ if (MSVC_IDE)
target_sources(vw_core PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/vw_types.natvis> )
endif()

if(STD_INV_SQRT)
target_compile_definitions(vw_core PUBLIC STD_INV_SQRT)
endif()

# Clang-cl on Windows has issues with our usage of SIMD types. Turn it off explicitly for Windows + clang-cl to mitigate.
# See issue #
if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down
1 change: 1 addition & 0 deletions vowpalwabbit/core/src/reductions/gd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ VW_WARNING_STATE_POP

static inline float inv_sqrt(float x)
{
return 1.f / std::sqrt(x);
#if defined(STD_INV_SQRT)
return 1.f / std::sqrt(x);
#endif
Expand Down

0 comments on commit b778776

Please sign in to comment.