Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit fb021b7

Browse files
authored
Numerics Support (#1127)
* build: always enable swift-numerics This is now possible to build on all platforms, just always enable it. * build: link against swift-numerics When building against the stock toolchain, explicitly link against swift numerics.
1 parent 1bc2373 commit fb021b7

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,14 @@ option(USE_BUNDLED_CTENSORFLOW
2929
"Use the CTensorFlow module bundled in the active Swift toolchain" OFF)
3030
option(ENABLE_PYTHON_SUPPORT
3131
"Enable Python interop using PythonKit" ON)
32-
33-
# FIXME: disable swift-numerics on Darwin as `-force-autoload-symbol` and
34-
# `-incremental` do not play well together on Darwin.
35-
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
36-
set(ENABLE_SWIFT_NUMERICS_default NO)
37-
else()
38-
set(ENABLE_SWIFT_NUMERICS_default YES)
39-
endif()
4032
option(ENABLE_SWIFT_NUMERICS
41-
"Enable integrating swift-numerics" ${ENABLE_SWIFT_NUMERICS_default})
33+
"Enable integrating swift-numerics" YES)
34+
35+
include(CMakeDependentOption)
36+
cmake_dependent_option(TENSORFLOW_USE_STANDARD_TOOLCHAIN
37+
"Experimental support to use a standard toolchain" OFF
38+
"ENABLE_SWIFT_NUMERICS"
39+
NO)
4240

4341
if(ENABLE_SWIFT_NUMERICS)
4442
include(ExternalProject)

Sources/TensorFlow/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ target_link_libraries(TensorFlow PUBLIC
9797
CTensorFlow
9898
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
9999
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
100+
$<$<AND:$<BOOL:${ENABLE_SWIFT_NUMERICS}>,$<BOOL:${TENSORFLOW_USE_STANDARD_TOOLCHAIN}>>:Numerics>
100101
Tensor)
101102
if(ENABLE_PYTHON_SUPPORT)
102103
target_link_libraries(TensorFlow PUBLIC

Sources/x10/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ add_library(x10_optimizers_optimizer SHARED
1313
set_target_properties(x10_optimizers_optimizer PROPERTIES
1414
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
1515
target_link_libraries(x10_optimizers_optimizer PUBLIC
16+
$<$<AND:$<BOOL:${ENABLE_SWIFT_NUMERICS}>,$<BOOL:${TENSORFLOW_USE_STANDARD_TOOLCHAIN}>>:Numerics>
1617
x10_optimizers_tensor_visitor_plan
1718
TensorFlow)
1819

0 commit comments

Comments
 (0)