From 37a8babe0b4c6afb1c403bf8f9ee53a158aafb60 Mon Sep 17 00:00:00 2001 From: nscipione Date: Thu, 11 Apr 2024 10:51:09 +0100 Subject: [PATCH] Add compilation flags to increase icpx support --- CMakeLists.txt | 6 ++++++ cmake/Modules/FindDPCPP.cmake | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c3462e3f..1be0860fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,12 @@ if (INSTALL_HEADER_ONLY) set_target_properties(portblas PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PORTBLAS_INCLUDE};$" ) + set(non_intel_target "AMD_GPU" "NVIDIA_GPU") + if((${CMAKE_CXX_COMPILER_ID} STREQUAL "IntelLLVM") AND + (TUNING_TARGET IN_LIST non_intel_target) ) + target_compile_options(portblas INTERFACE -fno-fast-math) + target_compile_options(portblas INTERFACE -mllvm -loopopt=0 ) + endif() else() add_subdirectory(src) build_library(portblas ${BLAS_ENABLE_EXTENSIONS}) diff --git a/cmake/Modules/FindDPCPP.cmake b/cmake/Modules/FindDPCPP.cmake index f8eec161b..8c7d11624 100644 --- a/cmake/Modules/FindDPCPP.cmake +++ b/cmake/Modules/FindDPCPP.cmake @@ -85,6 +85,7 @@ endif() add_definitions(-DSB_ENABLE_USM=1) set(SB_ENABLE_USM 1) list(APPEND DPCPP_FLAGS "-DSB_ENABLE_USM=1") +set(non_intel_target "AMD_GPU" "NVIDIA_GPU") function(add_sycl_to_target) set(options) @@ -96,6 +97,11 @@ function(add_sycl_to_target) "${multi_value_args}" ${ARGN} ) + if((${CMAKE_CXX_COMPILER_ID} STREQUAL "IntelLLVM") AND + (TUNING_TARGET IN_LIST non_intel_target) ) + target_compile_options(${SB_ADD_SYCL_TARGET} PRIVATE -fno-fast-math) + target_compile_options(${SB_ADD_SYCL_TARGET} PRIVATE -mllvm -loopopt=0 ) + endif() target_compile_options(${SB_ADD_SYCL_TARGET} PUBLIC ${DPCPP_FLAGS}) get_target_property(target_type ${SB_ADD_SYCL_TARGET} TYPE) if (NOT target_type STREQUAL "OBJECT_LIBRARY")