Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 6e3a514

Browse files
a32543254DDEle
andauthored
[LLM Runtime] dynamic link the layer to compress binary size (#1059)
Co-authored-by: Ding, Yi <[email protected]>
1 parent 3115926 commit 6e3a514

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

intel_extension_for_transformers/llm/runtime/graph/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ if (NE_GELU_VEC)
9191
endif()
9292
option(NE_PYTHON_API "neural_engine: use python api" OFF)
9393
option(NE_SIMD_VEC_DOT_F16 "neural_engine: enable vec_dot_fp16 SIMD optimization" ON)
94+
95+
option(BUILD_SHARED_LIBS "If build as shared libs" ON)
96+
9497
if (NE_SIMD_VEC_DOT_F16)
9598
add_compile_definitions(NE_SIMD_VEC_DOT_F16)
9699
endif()

intel_extension_for_transformers/llm/runtime/graph/cmake/Common.cmake

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,25 @@ function(add_executable_w_warning TARGET)
3636
warning_check(${TARGET})
3737
endfunction()
3838

39-
function(add_library_w_warning TARGET)
40-
add_library(${TARGET} STATIC ${ARGN})
39+
function(add_library_w_warning_ TARGET)
40+
add_library(${TARGET} ${ARGN})
4141
set_target_properties(${TARGET} PROPERTIES C_STANDARD 11 C_STANDARD_REQUIRED ON C_EXTENSIONS OFF)
4242
set_target_properties(${TARGET} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
4343
warning_check(${TARGET})
4444
endfunction()
45+
46+
function(add_library_w_warning TARGET)
47+
add_library_w_warning_(${TARGET} STATIC ${ARGN})
48+
endfunction()
49+
50+
function(add_shared_library_w_warning TARGET)
51+
add_library_w_warning_(${TARGET} SHARED ${ARGN})
52+
endfunction()
53+
54+
function(add_shareable_library_w_warning TARGET)
55+
if (BUILD_SHARED_LIBS)
56+
add_library_w_warning_(${TARGET} SHARED ${ARGN})
57+
else()
58+
add_library_w_warning_(${TARGET} STATIC ${ARGN})
59+
endif()
60+
endfunction()

intel_extension_for_transformers/llm/runtime/graph/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ find_package(Threads REQUIRED)
1616
file(GLOB layers_srcs "layers/*.cpp")
1717
set(sources ne_layers.c ${layers_srcs})
1818

19-
add_library_w_warning(ne_layers "${sources}")
19+
add_shareable_library_w_warning(ne_layers "${sources}")
2020

2121
target_include_directories(ne_layers PUBLIC .)
2222
target_compile_features(ne_layers PUBLIC c_std_11) # don't bump

0 commit comments

Comments
 (0)