Skip to content
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
25 changes: 23 additions & 2 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .scripts/run_docker_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions .scripts/run_win_build.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions build-locally.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions recipe/build-llvm-openmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ fi
if [[ "${PKG_VERSION}" == *rc* ]]; then
export PKG_VERSION=${PKG_VERSION::${#PKG_VERSION}-4}
fi
# used in patch to construct path to libclang_rt.builtins
export PKG_VERSION_MAJOR=$(echo ${PKG_VERSION} | cut -d "." -f1)

cmake -G Ninja \
${CMAKE_ARGS} \
Expand Down
11 changes: 9 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "17.0.6" %}
{% set version = "18.1.1" %}
# check https://clang.llvm.org/docs/OpenMPSupport.html
# occasionally to see last fully supported openmp ver.
{% set openmp_ver = "4.5" %}
Expand All @@ -9,11 +9,16 @@ package:

source:
url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz
sha256: 58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
sha256: 8f34c6206be84b186b4b31f47e1b52758fa38348565953fad453d177ef34c0ad
# name folder for easier deletion; we do the equivalent of downloading
# the subproject sources, so the work folder then has openmp in it;
# for details see build scripts
folder: llvm-project
patches:
# backport https://github.com/llvm/llvm-project/pull/80174
- patches/0001-openmp-On-Windows-fix-standalone-cmake-build.patch
# intermediate fix for https://github.com/llvm/llvm-project/issues/54596
- patches/0002-link-libomp-to-compiler-rt-on-osx-arm.patch

build:
number: 0
Expand Down Expand Up @@ -43,6 +48,8 @@ outputs:
- llvmdev {{ version }}|{{ version }}.*
- zlib # [linux]
- zstd # [linux]
# see https://github.com/llvm/llvm-project/issues/54596
- compiler-rt # [osx and arm64]
run_constrained:
- openmp {{ version }}|{{ version }}.*
test:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From c553881877d57c30693ede93684851210ea78d30 Mon Sep 17 00:00:00 2001
From: Alexandre Ganea <[email protected]>
Date: Wed, 31 Jan 2024 13:22:19 -0500
Subject: [PATCH 1/2] [openmp] On Windows, fix standalone cmake build

This fixes: https://github.com/llvm/llvm-project/issues/80117
---
openmp/cmake/HandleOpenMPOptions.cmake | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake
index 201aeabbd3df..71346201129b 100644
--- a/openmp/cmake/HandleOpenMPOptions.cmake
+++ b/openmp/cmake/HandleOpenMPOptions.cmake
@@ -9,6 +9,14 @@ if (NOT COMMAND append_if)
endfunction()
endif()

+if (NOT COMMAND append)
+ function(append value)
+ foreach(variable ${ARGN})
+ set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
+ endforeach(variable)
+ endfunction()
+endif()
+
# MSVC and clang-cl in compatibility mode map -Wall to -Weverything.
# TODO: LLVM adds /W4 instead, check if that works for the OpenMP runtimes.
if (NOT MSVC)
26 changes: 26 additions & 0 deletions recipe/patches/0002-link-libomp-to-compiler-rt-on-osx-arm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 9fd9c8c26219bf8995321b7786e853d6c51e1dc8 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Thu, 1 Feb 2024 12:29:07 +0100
Subject: [PATCH 2/2] link libomp to compiler-rt on osx-arm

---
openmp/runtime/src/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 619d4f7ba458..11d9c969e381 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -161,6 +161,12 @@ if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMP_PROFILING))
add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES})
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS})
+ if(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
+ cmake_path(SET CLANG_RT_BUILTINS_LIBRARY
+ NORMALIZE
+ "$ENV{PREFIX}/lib/clang/$ENV{PKG_VERSION_MAJOR}/lib/libclang_rt.builtins_arm64_osx.a")
+ target_link_libraries(omp ${CLANG_RT_BUILTINS_LIBRARY})
+ endif()
else()
add_llvm_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES} PARTIAL_SOURCES_INTENDED
LINK_LIBS ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}