Skip to content

Commit 6af3b97

Browse files
authored
Remove unnecessary static library installation for wheel packaging (#1436)
This PR addresses the issue of unnecessary static libraries (.lib files) being installed into the lib directory and subsequently included in the wheel package. Since wheel packages do not require .lib files, the related install statements have been removed to reduce the overall package size.
1 parent b275be6 commit 6af3b97

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/BuildOnWindows.cmake

+12-7
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ else()
254254
${ATen_XPU_MKL_SRCS}
255255
${ATen_XPU_NATIVE_CPP_SRCS}
256256
${ATen_XPU_GEN_SRCS})
257-
install(TARGETS torch_xpu_ops DESTINATION "${TORCH_INSTALL_LIB_DIR}")
258257
target_compile_definitions(torch_xpu_ops PRIVATE TORCH_XPU_BUILD_MAIN_LIB)
259258
# Split SYCL kernels into 2 libraries as categories 1) Common (Unary+Binary+Reduce+Pow+Copy+Activation+Foreach) 2) Others.
260259
set(ATen_XPU_SYCL_COMMON_SRCS)
@@ -267,6 +266,10 @@ else()
267266
string(REGEX MATCH "Reduce" IS_REDUCE ${sycl_src})
268267
string(REGEX MATCH "Activation" IS_ACTIVATION ${sycl_src})
269268
string(REGEX MATCH "Foreach" IS_FOREACH ${sycl_src})
269+
string(REGEX MATCH "Norm" IS_NORM ${sycl_src})
270+
string(REGEX MATCH "Loss" IS_LOSS ${sycl_src})
271+
string(REGEX MATCH "Resize" IS_RESIZE ${sycl_src})
272+
string(REGEX MATCH "Distribution" IS_DISTRIBUTION ${sycl_src})
270273

271274
if(NOT IS_FOREACH STREQUAL "")
272275
list(APPEND ATen_XPU_SYCL_COMMON_SRCS ${sycl_src})
@@ -278,6 +281,14 @@ else()
278281
list(APPEND ATen_XPU_SYCL_COMMON_SRCS ${sycl_src})
279282
elseif(NOT IS_ACTIVATION STREQUAL "")
280283
list(APPEND ATen_XPU_SYCL_COMMON_SRCS ${sycl_src})
284+
elseif(NOT IS_NORM STREQUAL "")
285+
list(APPEND ATen_XPU_SYCL_COMMON_SRCS ${sycl_src})
286+
elseif(NOT IS_LOSS STREQUAL "")
287+
list(APPEND ATen_XPU_SYCL_COMMON_SRCS ${sycl_src})
288+
elseif(NOT IS_RESIZE STREQUAL "")
289+
list(APPEND ATen_XPU_SYCL_COMMON_SRCS ${sycl_src})
290+
elseif(NOT IS_DISTRIBUTION STREQUAL "")
291+
list(APPEND ATen_XPU_SYCL_COMMON_SRCS ${sycl_src})
281292
else()
282293
list(APPEND ATen_XPU_SYCL_OTHERS_SRCS ${sycl_src})
283294
endif()
@@ -291,9 +302,6 @@ else()
291302
target_compile_definitions(${sycl_common_lib} PRIVATE TORCH_XPU_BUILD_MAIN_LIB)
292303
list(APPEND TORCH_XPU_OPS_LIBRARIES ${sycl_common_lib})
293304

294-
# Decouple with PyTorch cmake definition.
295-
install(TARGETS ${sycl_common_lib} DESTINATION "${TORCH_INSTALL_LIB_DIR}")
296-
297305
# Other kernel lib
298306
set(sycl_lib torch_xpu_ops_sycl_kernels)
299307
sycl_add_library(
@@ -303,9 +311,6 @@ else()
303311
target_compile_definitions(${sycl_lib} PRIVATE TORCH_XPU_BUILD_MAIN_LIB)
304312
list(APPEND TORCH_XPU_OPS_LIBRARIES ${sycl_lib})
305313

306-
# Decouple with PyTorch cmake definition.
307-
install(TARGETS ${sycl_lib} DESTINATION "${TORCH_INSTALL_LIB_DIR}")
308-
309314
target_link_libraries(torch_xpu_ops
310315
PUBLIC
311316
${sycl_common_lib}

0 commit comments

Comments
 (0)