diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index a5836e8d..ba4b251c 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -72,7 +72,6 @@ else --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" \ --extra-meta flow_run_id="${flow_run_id:-}" remote_url="${remote_url:-}" sha="${sha:-}" - ( startgroup "Inspecting artifacts" ) 2> /dev/null # inspect_artifacts was only added in conda-forge-ci-setup 4.6.0 diff --git a/README.md b/README.md index bc77e498..30e6f853 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,8 @@ Current release info | Name | Downloads | Version | Platforms | | --- | --- | --- | --- | +| [![Conda Recipe](https://img.shields.io/badge/recipe-bolt-green.svg)](https://anaconda.org/conda-forge/bolt) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/bolt.svg)](https://anaconda.org/conda-forge/bolt) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/bolt.svg)](https://anaconda.org/conda-forge/bolt) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/bolt.svg)](https://anaconda.org/conda-forge/bolt) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-libbolt-green.svg)](https://anaconda.org/conda-forge/libbolt) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libbolt.svg)](https://anaconda.org/conda-forge/libbolt) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libbolt.svg)](https://anaconda.org/conda-forge/libbolt) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libbolt.svg)](https://anaconda.org/conda-forge/libbolt) | | [![Conda Recipe](https://img.shields.io/badge/recipe-libllvm--c18-green.svg)](https://anaconda.org/conda-forge/libllvm-c18) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libllvm-c18.svg)](https://anaconda.org/conda-forge/libllvm-c18) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libllvm-c18.svg)](https://anaconda.org/conda-forge/libllvm-c18) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libllvm-c18.svg)](https://anaconda.org/conda-forge/libllvm-c18) | | [![Conda Recipe](https://img.shields.io/badge/recipe-libllvm18-green.svg)](https://anaconda.org/conda-forge/libllvm18) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libllvm18.svg)](https://anaconda.org/conda-forge/libllvm18) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libllvm18.svg)](https://anaconda.org/conda-forge/libllvm18) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libllvm18.svg)](https://anaconda.org/conda-forge/libllvm18) | | [![Conda Recipe](https://img.shields.io/badge/recipe-lit-green.svg)](https://anaconda.org/conda-forge/lit) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/lit.svg)](https://anaconda.org/conda-forge/lit) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/lit.svg)](https://anaconda.org/conda-forge/lit) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/lit.svg)](https://anaconda.org/conda-forge/lit) | @@ -100,41 +102,41 @@ conda config --add channels conda-forge conda config --set channel_priority strict ``` -Once the `conda-forge` channel has been enabled, `libllvm-c18, libllvm18, lit, llvm, llvm-tools, llvmdev` can be installed with `conda`: +Once the `conda-forge` channel has been enabled, `bolt, libbolt, libllvm-c18, libllvm18, lit, llvm, llvm-tools, llvmdev` can be installed with `conda`: ``` -conda install libllvm-c18 libllvm18 lit llvm llvm-tools llvmdev +conda install bolt libbolt libllvm-c18 libllvm18 lit llvm llvm-tools llvmdev ``` or with `mamba`: ``` -mamba install libllvm-c18 libllvm18 lit llvm llvm-tools llvmdev +mamba install bolt libbolt libllvm-c18 libllvm18 lit llvm llvm-tools llvmdev ``` -It is possible to list all of the versions of `libllvm-c18` available on your platform with `conda`: +It is possible to list all of the versions of `bolt` available on your platform with `conda`: ``` -conda search libllvm-c18 --channel conda-forge +conda search bolt --channel conda-forge ``` or with `mamba`: ``` -mamba search libllvm-c18 --channel conda-forge +mamba search bolt --channel conda-forge ``` Alternatively, `mamba repoquery` may provide more information: ``` # Search all versions available on your platform: -mamba repoquery search libllvm-c18 --channel conda-forge +mamba repoquery search bolt --channel conda-forge -# List packages depending on `libllvm-c18`: -mamba repoquery whoneeds libllvm-c18 --channel conda-forge +# List packages depending on `bolt`: +mamba repoquery whoneeds bolt --channel conda-forge -# List dependencies of `libllvm-c18`: -mamba repoquery depends libllvm-c18 --channel conda-forge +# List dependencies of `bolt`: +mamba repoquery depends bolt --channel conda-forge ``` diff --git a/recipe/bld.bat b/recipe/bld.bat index 105af19c..0aac8361 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -16,6 +16,7 @@ cmake -G "Ninja" ^ -DLLVM_USE_INTEL_JITEVENTS=ON ^ -DLLVM_ENABLE_DUMP=ON ^ -DLLVM_ENABLE_LIBXML2=FORCE_ON ^ + -DLLVM_ENABLE_PROJECTS="bolt" ^ -DLLVM_ENABLE_RTTI=ON ^ -DLLVM_ENABLE_ZLIB=FORCE_ON ^ -DLLVM_ENABLE_ZSTD=FORCE_ON ^ @@ -25,6 +26,7 @@ cmake -G "Ninja" ^ -DLLVM_INCLUDE_TESTS=ON ^ -DLLVM_INCLUDE_UTILS=ON ^ -DLLVM_INSTALL_UTILS=ON ^ + -DLLVM_TARGETS_TO_BUILD="X86;AArch64" ^ -DLLVM_USE_SYMLINKS=OFF ^ -DLLVM_UTILS_INSTALL_DIR=libexec\llvm ^ -DLLVM_BUILD_LLVM_C_DYLIB=ON ^ @@ -39,5 +41,7 @@ if %ERRORLEVEL% neq 0 exit 1 REM bin\opt -S -vector-library=SVML -mcpu=haswell -O3 %RECIPE_DIR%\numba-3016.ll | bin\FileCheck %RECIPE_DIR%\numba-3016.ll REM if %ERRORLEVEL% neq 0 exit 1 -cd ..\llvm\test -python ..\..\build\bin\llvm-lit.py -vv Transforms ExecutionEngine Analysis CodeGen/X86 +:: :: takes ~30min; disabled due to timeouts +:: cd ..\llvm\test +:: python ..\..\build\bin\llvm-lit.py -vv Transforms ExecutionEngine Analysis CodeGen/X86 +:: if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipe/build.sh b/recipe/build.sh index 615dc40b..d2965b98 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -1,4 +1,5 @@ -set -x +#!/bin/bash +set -ex # Make osx work like linux. sed -i.bak "s/NOT APPLE AND ARG_SONAME/ARG_SONAME/g" llvm/cmake/modules/AddLLVM.cmake @@ -14,7 +15,7 @@ elif [[ "$target_platform" == osx-* ]]; then # https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/llvm/tools/llvm-shlib/CMakeLists.txt#L82-L85 # currently off though, because it doesn't build yet # CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_BUILD_LLVM_C_DYLIB=ON" - true + CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_TARGETS_TO_BUILD=X86;AArch64" fi if [[ "$CC_FOR_BUILD" != "" && "$CC_FOR_BUILD" != "$CC" ]]; then @@ -38,6 +39,7 @@ cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DLLVM_ENABLE_DUMP=ON \ -DLLVM_ENABLE_LIBEDIT=OFF \ -DLLVM_ENABLE_LIBXML2=FORCE_ON \ + -DLLVM_ENABLE_PROJECTS="bolt" \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_TERMINFO=OFF \ -DLLVM_ENABLE_ZLIB=FORCE_ON \ @@ -67,17 +69,15 @@ else export TEST_CPU_FLAG="" fi -# should be [[ "$CONDA_BUILD_CROSS_COMPILATION" != "1" ]], -# but osx builds time out when building & running test suite -if [[ "$target_platform" == "linux-64" ]]; then +if [[ "$CONDA_BUILD_CROSS_COMPILATION" != "1" ]]; then # bin/opt -S -vector-library=SVML $TEST_CPU_FLAG -O3 $RECIPE_DIR/numba-3016.ll | bin/FileCheck $RECIPE_DIR/numba-3016.ll || exit $? if [[ "$target_platform" == linux* ]]; then ln -s $(which $CC) $BUILD_PREFIX/bin/gcc + # check-llvm takes >1.5h to build & run on osx + ninja -j${CPU_COUNT} check-llvm fi - ninja -j${CPU_COUNT} check-llvm - cd ../llvm/test python ../../build/bin/llvm-lit -vv Transforms ExecutionEngine Analysis CodeGen/X86 fi diff --git a/recipe/install_llvm.bat b/recipe/install_llvm.bat index b87e4cab..e3a2a23d 100644 --- a/recipe/install_llvm.bat +++ b/recipe/install_llvm.bat @@ -9,6 +9,19 @@ if "%PKG_NAME%" == "libllvm-c%PKG_VERSION:~0,2%" ( REM only libLLVM-C move .\temp_prefix\bin\LLVM-C.dll %LIBRARY_BIN% move .\temp_prefix\lib\LLVM-C.lib %LIBRARY_LIB% +) else if "%PKG_NAME%" == "libbolt" ( + cmake --install ./build --prefix=./temp_prefix + if %ERRORLEVEL% neq 0 exit 1 + REM only bolt libraries + mkdir %LIBRARY_LIB% + move .\temp_prefix\lib\LLVMBOLT*.lib %LIBRARY_LIB% +) else if "%PKG_NAME%" == "bolt" ( + cmake --install ./build --prefix=./temp_prefix + if %ERRORLEVEL% neq 0 exit 1 + REM only bolt binaries + mkdir %LIBRARY_BIN% + move .\temp_prefix\bin\llvm-bolt*.exe %LIBRARY_BIN% + move .\temp_prefix\bin\perf2bolt.exe %LIBRARY_BIN% ) else if "%PKG_NAME%" == "llvm-tools" ( cmake --install ./build --prefix=./temp_prefix if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipe/install_llvm.sh b/recipe/install_llvm.sh index 20a99dd2..f847c737 100644 --- a/recipe/install_llvm.sh +++ b/recipe/install_llvm.sh @@ -30,6 +30,19 @@ elif [[ "${PKG_NAME}" == libllvm* ]]; then mv ./temp_prefix/lib/libLLVM-${MAJOR_EXT}${SHLIB_EXT} $PREFIX/lib mv ./temp_prefix/lib/lib*.so.${SOVER_EXT} $PREFIX/lib || true mv ./temp_prefix/lib/lib*.${SOVER_EXT}.dylib $PREFIX/lib || true +elif [[ "${PKG_NAME}" == "libbolt" ]]; then + cmake --install ./build --prefix=./temp_prefix + # only bolt libraries + mkdir -p $PREFIX/lib + mv ./temp_prefix/lib/libLLVMBOLT* $PREFIX/lib + # only on linux + mv ./temp_prefix/lib/libbolt* $PREFIX/lib || true +elif [[ "${PKG_NAME}" == "bolt" ]]; then + cmake --install ./build --prefix=./temp_prefix + # only bolt binaries + mkdir -p $PREFIX/bin + mv ./temp_prefix/bin/llvm-bolt* $PREFIX/bin + mv ./temp_prefix/bin/perf2bolt $PREFIX/bin elif [[ "${PKG_NAME}" == "llvm-tools" ]]; then cmake --install ./build --prefix=./temp_prefix # everything in /bin & /share diff --git a/recipe/meta.yaml b/recipe/meta.yaml index deb5b46c..9c2860fa 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -22,7 +22,7 @@ source: - patches/0002-lljit-respect-codemodel.patch build: - number: 1 + number: 2 merge_build_host: false requirements: @@ -62,13 +62,17 @@ outputs: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - {{ pin_subpackage("libllvm-c" + major_ver, exact=True) }} # [win] - {{ pin_subpackage("llvm-tools", exact=True) }} - - libxml2 - zlib - zstd + # only here to avoid picking up the files twice + - {{ pin_subpackage("libbolt", exact=True) }} + - {{ pin_subpackage("bolt", exact=True) }} run: + # bolt is built in this feedstock, but intentionally not part of llvmdev - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - {{ pin_subpackage("libllvm-c" + major_ver, exact=True) }} # [win] - {{ pin_subpackage("llvm-tools", exact=True) }} + # we need to do this manually because clang_bootstrap has no run-export - libcxx >={{ cxx_compiler_version }} # [osx] run_constrained: - llvm {{ version }} @@ -111,10 +115,11 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - - libxml2 + - libxml2 # [unix] - zlib - zstd run: + # we need to do this manually because clang_bootstrap has no run-export - libcxx >={{ cxx_compiler_version }} # [osx] test: commands: @@ -149,6 +154,70 @@ outputs: commands: - echo "Hello World!" + # Contains bolt support libraries + - name: libbolt + script: install_llvm.sh # [unix] + script: install_llvm.bat # [win] + build: + activate_in_script: true + requirements: + build: + - {{ stdlib('c') }} + - {{ compiler('cxx') }} + - cmake + - ninja + - libcxx {{ cxx_compiler_version }} # [osx] + run_constrained: + - llvm {{ version }} + - llvmdev {{ version }} + - clang {{ version }} + - clang-tools {{ version }} + test: + commands: + {% for each_lib in [ + "Core", "Passes", "Profile", "Rewrite", "RuntimeLibs", + "TargetAArch64", "TargetX86", "Utils" + ] %} + - test -f $PREFIX/lib/libLLVMBOLT{{ each_lib }}.a # [unix] + - if not exist %LIBRARY_LIB%\LLVMBOLT{{ each_lib }}.lib exit 1 # [win] + {% endfor %} + # only on linux-64 + - test -f $PREFIX/lib/libbolt_rt_hugify.a # [linux64] + - test -f $PREFIX/lib/libbolt_rt_instr.a # [linux64] + + # Contains bolt + - name: bolt + script: install_llvm.sh # [unix] + script: install_llvm.bat # [win] + build: + activate_in_script: true + requirements: + build: + - {{ stdlib('c') }} + - {{ compiler('cxx') }} + - cmake + - ninja + - libcxx {{ cxx_compiler_version }} # [osx] + host: + - libcxx {{ cxx_compiler_version }} # [osx] + - zlib + - zstd + run: + - {{ pin_subpackage("libbolt", exact=True) }} + # we need to do this manually because clang_bootstrap has no run-export + - libcxx >={{ cxx_compiler_version }} # [osx] + run_constrained: + - llvm {{ version }} + - llvmdev {{ version }} + - clang {{ version }} + - clang-tools {{ version }} + test: + commands: + - llvm-bolt -version + - llvm-boltdiff -version + - llvm-bolt-heatmap -version + - perf2bolt -version + # Contains LLVM tools - name: llvm-tools script: install_llvm.sh # [unix] @@ -166,11 +235,15 @@ outputs: host: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - libxml2 + # bolt is only in host to avoid picking up the binary again in llvm-tools + - {{ pin_subpackage("bolt", exact=True) }} + - libxml2 # [win] - zlib - zstd run: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + # we need to do this manually because clang_bootstrap has no run-export + - libcxx >={{ cxx_compiler_version }} # [osx] run_constrained: - llvm {{ version }} - llvmdev {{ version }} @@ -178,9 +251,10 @@ outputs: - clang-tools {{ version }} test: commands: - - $PREFIX/bin/llc -version # [not win] - - if not exist "%LIBRARY_BIN%"\\llc.exe exit 1 # [win] - - llc -version # [win] + - llc -version + # absence of bolt + - test ! -f $PREFIX/bin/llvm-bolt # [unix] + - if exist %LIBRARY_BIN%\llvm-bolt.exe exit 1 # [win] # Contains LLVM-C shared library - name: libllvm-c{{ major_ver }} @@ -204,7 +278,6 @@ outputs: host: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - libxml2 - zlib - zstd run_constrained: