mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[CMake] Move xpu flag to xpu.cmake (#158542)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158542 Approved by: https://github.com/gujinghui, https://github.com/ezyang
This commit is contained in:
parent
9894d43b6c
commit
cbe1cb7018
|
|
@ -1190,10 +1190,6 @@ if(APPLE)
|
||||||
append_cxx_flag_if_supported("-Wno-missing-braces" CMAKE_CXX_FLAGS)
|
append_cxx_flag_if_supported("-Wno-missing-braces" CMAKE_CXX_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_XPU)
|
|
||||||
string(APPEND CMAKE_CXX_FLAGS " -DUSE_XPU")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EMSCRIPTEN)
|
if(EMSCRIPTEN)
|
||||||
string(
|
string(
|
||||||
APPEND
|
APPEND
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ set(XPU_HOST_CXX_FLAGS)
|
||||||
find_package(SYCLToolkit REQUIRED)
|
find_package(SYCLToolkit REQUIRED)
|
||||||
if(NOT SYCL_FOUND)
|
if(NOT SYCL_FOUND)
|
||||||
set(PYTORCH_FOUND_XPU FALSE)
|
set(PYTORCH_FOUND_XPU FALSE)
|
||||||
|
# Exit early to avoid populating XPU_HOST_CXX_FLAGS.
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
set(PYTORCH_FOUND_XPU TRUE)
|
set(PYTORCH_FOUND_XPU TRUE)
|
||||||
|
|
@ -36,6 +37,8 @@ torch_xpu_get_arch_list(XPU_ARCH_FLAGS)
|
||||||
# propagate to torch-xpu-ops
|
# propagate to torch-xpu-ops
|
||||||
set(TORCH_XPU_ARCH_LIST ${XPU_ARCH_FLAGS})
|
set(TORCH_XPU_ARCH_LIST ${XPU_ARCH_FLAGS})
|
||||||
|
|
||||||
|
# Ensure USE_XPU is enabled.
|
||||||
|
string(APPEND XPU_HOST_CXX_FLAGS " -DUSE_XPU")
|
||||||
string(APPEND XPU_HOST_CXX_FLAGS " -DSYCL_COMPILER_VERSION=${SYCL_COMPILER_VERSION}")
|
string(APPEND XPU_HOST_CXX_FLAGS " -DSYCL_COMPILER_VERSION=${SYCL_COMPILER_VERSION}")
|
||||||
|
|
||||||
if(DEFINED ENV{XPU_ENABLE_KINETO})
|
if(DEFINED ENV{XPU_ENABLE_KINETO})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user