From 842d24e16c8ae83f711b263361e1e04364763afe 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 & testcase bugfix --- build.sh | 12 +++++++++++- clang/CMakeLists.txt | 4 ++++ clang/test/Autotuning/BaselineConfig/lit.local.cfg | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 clang/test/Autotuning/BaselineConfig/lit.local.cfg diff --git a/build.sh b/build.sh index dc28732e239d..07c789d43dd9 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="1" 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 Disable 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="0" + ;; 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.*") diff --git a/clang/test/Autotuning/BaselineConfig/lit.local.cfg b/clang/test/Autotuning/BaselineConfig/lit.local.cfg new file mode 100644 index 000000000000..33afa7c31e0f --- /dev/null +++ b/clang/test/Autotuning/BaselineConfig/lit.local.cfg @@ -0,0 +1,2 @@ +if config.host_arch in ["x86", "X86", "x86_64"]: + config.unsupported = True \ No newline at end of file -- Gitee