Skip to content

Commit f8b860e

Browse files
authored
Eliminate the boring warning if no AOT enabled (#2180)
# Motivation I would like to clarify that, according to the [FP64 Partial Emulation Proposal](https://intel.sharepoint.com/:w:/s/MLTSHdGPU/EaroFZY371hOqNL9182g2_EBOe83qGYTriAavPB6WTWXYg?e=XSRnKt), the SYCL compiler and IGC only perform FP64 conversion on the DG2 and ATS-M architectures, and this is only available when AOT is enabled. If AOT is not enabled, many warnings like the following will be emitted: ```bash icx: warning: '-fsycl-fp64-conv-emu' option is supported only for AOT compilation of Intel GPUs. It will be ignored for other targets ``` To avoid these warnings, the `-fsycl-fp64-conv-emu` flag should only be added when AOT is enabled for the specific target architectures.
1 parent 2713310 commit f8b860e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cmake/BuildFlags.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
101101
endif()
102102

103103
CHECK_SYCL_FLAG("-fsycl-fp64-conv-emu" SUPPORTS_FP64_CONV_EMU)
104-
if(SUPPORTS_FP64_CONV_EMU)
105-
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fsycl-fp64-conv-emu)
106-
else()
104+
if(NOT SUPPORTS_FP64_CONV_EMU)
107105
message(WARNING "The compiler does not support the '-fsycl-fp64-conv-emu' flag, \
108106
will disable it. On some platforms that don't support FP64, \
109107
running operations with the FP64 datatype will raise a Runtime error: Required aspect fp64 is not supported on the device \
@@ -128,7 +126,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
128126
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-fp32-correctly-rounded-divide-sqrt")
129127
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -options -cl-intel-greater-than-4GB-buffer-required")
130128

131-
132129
if(WIN32)
133130
set(AOT_TARGETS "mtl,mtl-h,bmg,dg2,arl-h,lnl-m")
134131
else()
@@ -140,6 +137,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
140137
if(AOT_TARGETS STREQUAL "none")
141138
set(TORCH_XPU_ARCH_LIST "" PARENT_SCOPE)
142139
else()
140+
# Enable FP64 conversion emulation for DG2 / ATS-M targets
141+
if(SUPPORTS_FP64_CONV_EMU)
142+
string(FIND "${AOT_TARGETS}" "dg2" _dg2_index)
143+
string(FIND "${AOT_TARGETS}" "ats-m" _atsm_index)
144+
if(_dg2_index GREATER_EQUAL 0 OR _atsm_index GREATER_EQUAL 0)
145+
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fsycl-fp64-conv-emu)
146+
endif()
147+
endif()
143148
set(SYCL_TARGETS_OPTION -fsycl-targets=spir64_gen,spir64)
144149
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} ${SYCL_TARGETS_OPTION})
145150
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} ${SYCL_TARGETS_OPTION})

0 commit comments

Comments
 (0)