Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-7950][VL] Keep Core module's build flag consistent with Velox #8027

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions cpp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,29 @@ include(FindPkgConfig)
include(GNUInstallDirs)
include(CheckCXXCompilerFlag)

# Only set arch=native for non-AppleClang compilers.
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-attributes")
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess")
endif()

if(NOT DEFINED VELOX_HOME)
set(VELOX_HOME ${GLUTEN_HOME}/ep/build-velox/build/velox_ep)
message(STATUS "Set VELOX_HOME to ${VELOX_HOME}")
endif()

# Keep same compile option with Velox.
execute_process(
COMMAND
bash -c
"( source ${VELOX_HOME}/scripts/setup-helper-functions.sh && echo -n $(get_cxx_flags $ENV{CPU_TARGET}))"
OUTPUT_VARIABLE SCRIPT_CXX_FLAGS
RESULT_VARIABLE COMMAND_STATUS)
if(COMMAND_STATUS EQUAL "1")
message(FATAL_ERROR "Unable to determine compiler flags!")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}")
message("Core module final CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

set(BOOST_MIN_VERSION "1.42.0")
find_package(Boost REQUIRED)
Expand Down Expand Up @@ -99,11 +118,6 @@ set_source_files_properties(${GLUTEN_PROTO_OUTPUT_FILES} PROPERTIES GENERATED
TRUE)
get_filename_component(GLUTEN_PROTO_DIR ${GLUTEN_PROTO_SRC_DIR}/ DIRECTORY)

set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-attributes")

message("Core module final CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

set(SPARK_COLUMNAR_PLUGIN_SRCS
${SUBSTRAIT_PROTO_SRCS}
${GLUTEN_PROTO_SRCS}
Expand Down
1 change: 0 additions & 1 deletion ep/build-velox/src/get_velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ function setup_linux {
local LINUX_VERSION_ID=$(. /etc/os-release && echo ${VERSION_ID})

# apply patches
sed -i 's/-mavx2 -mfma -mavx -mf16c -mlzcnt -std=c++17/-march=native -std=c++17 -mno-avx512f/g' scripts/setup-helper-functions.sh
sed -i 's/SUDO="${SUDO:-""}"/SUDO="${SUDO:-"sudo --preserve-env"}"/g' scripts/setup-helper-functions.sh
if [[ "$LINUX_DISTRIBUTION" == "ubuntu" || "$LINUX_DISTRIBUTION" == "debian" || "$LINUX_DISTRIBUTION" == "pop" ]]; then
process_setup_ubuntu
Expand Down
Loading