Skip to content
Closed
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
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,9 @@ jobs:
matrix:
include:
- arch: 'x64'
openmp_dll: 'C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\Llvm\x64\bin\libomp.dll'
- arch: 'arm64'
openmp_dll: 'C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\Llvm\ARM64\bin\libomp.dll'

steps:
- name: Clone
Expand Down Expand Up @@ -739,7 +741,7 @@ jobs:
- name: Pack artifacts
id: pack_artifacts
run: |
Copy-Item "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Redist\MSVC\14.51.36231\debug_nonredist\${{ matrix.arch }}\Microsoft.VC145.OpenMP.LLVM\libomp140.${{ matrix.arch == 'x64' && 'x86_64' || 'aarch64' }}.dll" .\build\bin\Release\
Copy-Item "${{ matrix.openmp_dll }}" .\build\bin\Release\

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use something like the below to avoid hardcoding the Visual Studio path, which can vary across machines?

$vswhere = "${env:ProgramFiles}\Microsoft Visual Studio\Installer\vswhere.exe"
if (-not (Test-Path $vswhere)) {
  $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
}

$vsInstall = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath

Copy-Item (Join-Path $vsInstall "VC\Tools\Llvm\${{ matrix.arch }}\bin\libomp.dll") .\build\bin\Release\

7z a -snl llama-bin-win-cpu-${{ matrix.arch }}.zip .\build\bin\Release\*

- name: Upload artifacts
Expand Down
25 changes: 25 additions & 0 deletions cmake/arm64-windows-llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ set( CMAKE_CXX_COMPILER clang++ )
set( CMAKE_C_COMPILER_TARGET ${target} )
set( CMAKE_CXX_COMPILER_TARGET ${target} )

if (NOT DEFINED GGML_OPENMP OR GGML_OPENMP)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this supposed to be just:

Suggested change
if (NOT DEFINED GGML_OPENMP OR GGML_OPENMP)
if (GGML_OPENMP)

file(TO_CMAKE_PATH
"$ENV{VCINSTALLDIR}/Tools/Llvm/ARM64"
llvm_arm64_root
)

set( LLVM_ARM64_ROOT
"${llvm_arm64_root}"
CACHE PATH
"ARM64 LLVM installation containing the target OpenMP runtime"
)

if (EXISTS "${LLVM_ARM64_ROOT}/lib/libomp.lib")
# Prefer the target LLVM OpenMP library over the MSVC import library.
set( OpenMP_libomp_LIBRARY
"${LLVM_ARM64_ROOT}/lib/libomp.lib"
CACHE FILEPATH
"ARM64 LLVM OpenMP import library"
FORCE
)
else()
message(WARNING "LLVM ARM64 OpenMP library not found: ${LLVM_ARM64_ROOT}/lib/libomp.lib")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we always package LLVM's OpenMP, CI has to fail if this is absent

endif()
endif()

set( arch_c_flags "-march=armv8.7-a -fvectorize -ffp-model=fast -fno-finite-math-only" )
set( warn_c_flags "-Wno-format -Wno-unused-variable -Wno-unused-function -Wno-gnu-zero-variadic-macro-arguments" )

Expand Down
25 changes: 25 additions & 0 deletions cmake/x64-windows-llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,28 @@ set( CMAKE_SYSTEM_PROCESSOR x86_64 )

set( CMAKE_C_COMPILER clang )
set( CMAKE_CXX_COMPILER clang++ )

if (NOT DEFINED GGML_OPENMP OR GGML_OPENMP)
file(TO_CMAKE_PATH
"$ENV{VCINSTALLDIR}/Tools/Llvm/x64"
llvm_X64_root
)

set( LLVM_X64_ROOT
"${llvm_X64_root}"
CACHE PATH
"x64 LLVM installation containing the target OpenMP runtime"
)

if (EXISTS "${LLVM_X64_ROOT}/lib/libomp.lib")
# Prefer the target LLVM OpenMP library over the MSVC import library.
set( OpenMP_libomp_LIBRARY
"${LLVM_X64_ROOT}/lib/libomp.lib"
CACHE FILEPATH
"x64 LLVM OpenMP import library"
FORCE
)
else()
message(WARNING "LLVM x64 OpenMP library not found: ${LLVM_X64_ROOT}/lib/libomp.lib")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we always package LLVM's OpenMP, CI has to fail if this is absent

endif()
endif()