Skip to content

Commit

Permalink
Add AOT build option for arc device (#787)
Browse files Browse the repository at this point in the history
Cherry-picked from 

#785
#792

- Add AOT build option for arc device.
- Add a message if the user don't need.
  • Loading branch information
Stonepia authored Aug 22, 2024
1 parent 9cd4595 commit 9995c77
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmake/BuildFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -cl-intel-enable-auto-large-GRF-mode")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -cl-fp32-correctly-rounded-divide-sqrt")
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "-options '${SYCL_OFFLINE_COMPILER_CG_OPTIONS}'")

set(AOT_TARGETS "pvc,xe-lpg,ats-m150")
if((DEFINED ENV{TORCH_XPU_ARCH_LIST}) AND NOT ("$ENV{TORCH_XPU_ARCH_LIST}" STREQUAL ""))
set(SYCL_OFFLINE_COMPILER_AOT_OPTIONS "-device $ENV{TORCH_XPU_ARCH_LIST}")
else()
set(SYCL_OFFLINE_COMPILER_AOT_OPTIONS "-device pvc,xe-lpg")
set(AOT_TARGETS "$ENV{TORCH_XPU_ARCH_LIST}")
endif()

set(SYCL_OFFLINE_COMPILER_AOT_OPTIONS "-device ${AOT_TARGETS}")
message(STATUS "Compile Intel GPU AOT Targets for ${AOT_TARGETS}")

set(SYCL_OFFLINE_COMPILER_FLAGS "${SYCL_OFFLINE_COMPILER_AOT_OPTIONS} ${SYCL_OFFLINE_COMPILER_CG_OPTIONS}")
else()
message("Not compiling with XPU. Currently only support GCC compiler on Linux and MSVC compiler on Windows as CXX compiler.")
Expand Down

0 comments on commit 9995c77

Please sign in to comment.