From ab7e47f5a00dc650f9d10daa77c3cc1fc7b0535e Mon Sep 17 00:00:00 2001 From: liyunfei Date: Wed, 21 Aug 2024 14:48:36 +0800 Subject: [PATCH] Fix for missing -DENABLE_AUTOTUNER & Add BiSheng Autotuner support in build.sh --- build.sh | 12 +++++++++++- clang/CMakeLists.txt | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index dc28732e239d..c4c98c4a2a83 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,7 @@ C_COMPILER_PATH=gcc CXX_COMPILER_PATH=g++ # Initialize our own variables: +enable_autotuner="0" buildtype=RelWithDebInfo backends="ARM;AArch64;X86" build_for_openeuler="0" @@ -47,6 +48,7 @@ Usage: $0 [options] Build the compiler under $build_prefix, then install under $install_prefix. Options: + -a Enable BiSheng-Autotuner. -b type Specify CMake build type (default: $buildtype). -c Use ccache (default: $use_ccache). -e Build for embedded cross tool chain. @@ -67,8 +69,11 @@ EOF # Process command-line options. Remember the options for passing to the # containerized build script. -while getopts :b:ceEhiI:j:orstvfX: optchr; do +while getopts :ab:ceEhiI:j:orstvfX: optchr; do case "$optchr" in + a) + enable_autotuner="1" + ;; b) buildtype="$OPTARG" case "${buildtype,,}" in @@ -197,6 +202,11 @@ if [ $build_for_openeuler == "1" ]; then CMAKE_OPTIONS="$CMAKE_OPTIONS -DBUILD_FOR_OPENEULER=ON" fi +if [ $enable_autotuner == "1" ]; then + echo "enable BiSheng-Autotuner" + CMAKE_OPTIONS="$CMAKE_OPTIONS -DLLVM_ENABLE_AUTOTUNER=ON" +fi + # Build and install if [ $clean -eq 1 -a -e "$install_prefix" ]; then rm -rf "$install_prefix" diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 949f12d3ce8c..98fcb6ea1a07 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -322,6 +322,10 @@ if (BUILD_FOR_OPENEULER) add_definitions( -DBUILD_FOR_OPENEULER ) endif() +if (LLVM_ENABLE_AUTOTUNER) + add_definitions( -DENABLE_AUTOTUNER ) +endif() + # Determine HOST_LINK_VERSION on Darwin. set(HOST_LINK_VERSION) if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*") -- Gitee