Skip to content

Commit

Permalink
Add package: whisper-noavx
Browse files Browse the repository at this point in the history
Disable AVX, FMA and F16C features.

This appears to be when these processor features were introduced:
- AVX
  - Intel Sandy Bridge (Q1 2011)
  - Intel Celeron and Pentium Tiger Lake (Q3 2020)
- AVX2
  - Intel Haswell (2013)
  - AMD (not supported as of April 2022?)
- FMA3
  - Intel Broadwell (2014)
  - AMD Piledriver (2014)
- F16C
  - Intel Ivy Bridge (2013)
  - AMD Bulldozer (Q4 2011)
  • Loading branch information
mike-malburg committed Jun 10, 2024
1 parent 2e41b0b commit 8fa4abe
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 8 deletions.
1 change: 1 addition & 0 deletions .pipelines/build-package-preconfigured.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parameters:
- sqlite-modern-cpp
- tinyxml
- whispercpp
- whispercpp-noavx

- name: publishToGitHubRelease
displayName: Publish built package artifacts to a tagged release in the GitHub repo (A package name + version tag will be created like "somepackage-1.2.3")
Expand Down
39 changes: 39 additions & 0 deletions custom-ports/whispercpp-noavx/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# whispercpp-noavx
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ggerganov/whisper.cpp
REF "v${VERSION}"
SHA512 17e0485fb93fdea1a89f584a64db35f05371e0b8710a539f0dffca30bd3a2fff44c72ea754556566ca3cc55415b1e8f2bb868665437f5c93b9ce666b4fe53fb3
HEAD_REF master
)

if(APPLE)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DWHISPER_METAL_EMBED_LIBRARY=ON
-DWHISPER_METAL_NDEBUG=ON
)
else()
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DWHISPER_NO_AVX=ON
-DWHISPER_NO_AVX2=ON
-DWHISPER_NO_FMA=ON
-DWHISPER_NO_F16C=ON
)
endif()

vcpkg_install_cmake()
vcpkg_copy_pdbs()

# Store all .libs in the root lib directory. For Windows SHARED builds, these will be import libraries (not static libs).
file(GLOB_RECURSE LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/static/*.lib")
foreach(LIB_FILE ${LIB_FILES})
get_filename_component(LIB_NAME ${LIB_FILE} NAME)
file(RENAME ${LIB_FILE} "${CURRENT_PACKAGES_DIR}/lib/${LIB_NAME}")
endforeach()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/static")

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
17 changes: 17 additions & 0 deletions custom-ports/whispercpp-noavx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "whispercpp-noavx",
"version": "1.6.2",
"port-version": 1,
"description": "A high-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model.",
"homepage": "https://github.com/ggerganov/whisper.cpp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
19 changes: 19 additions & 0 deletions custom-steps/whispercpp-noavx/post-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
param (
[Parameter(Mandatory=$true)][string]$BuildArtifactsPath,
[Parameter(Mandatory=$false)][string]$PackageAndFeatures,
[Parameter(Mandatory=$false)][string]$LinkType,
[Parameter(Mandatory=$false)][string]$BuildType,
[Parameter(Mandatory=$false)][string]$ModulesRoot
)

$moduleName = "Build"
if(-not (Get-Module -Name $moduleName)) {
Import-Module "$ModulesRoot/$moduleName" -Force -DisableNameChecking
}

if ((Get-IsOnMacOS)) {
Remove-DylibSymlinks -BuildArtifactsPath $BuildArtifactsPath
}
elseif((Get-IsOnWindowsOS)) {
Update-VersionInfoForDlls -buildArtifactsPath $buildArtifactsPath -versionInfoJsonPath "$PSScriptRoot/version-info.json"
}
12 changes: 12 additions & 0 deletions custom-steps/whispercpp-noavx/version-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"files": [
{
"filename": "bin/whisper.dll",
"fileDescription": "High-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model. This dll is built without AVX support.",
"fileVersion": "1.6.2",
"productName": "WhisperCpp",
"productVersion": "1.6.2",
"copyright": "Copyright (c) 2023-2024 The ggml authors"
}
]
}
29 changes: 21 additions & 8 deletions preconfigured-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"package": "ffmpeg[avcodec,avdevice,avfilter,avformat,avresample,swscale,swresample,mp3lame]",
"linkType": "dynamic",
"buildType": "release",
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
},
"win": {
"package": "ffmpeg[avcodec,avdevice,avfilter,avformat,avresample,swscale,swresample,mp3lame]",
"linkType": "dynamic",
"buildType": "release",
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
}
},
{
Expand Down Expand Up @@ -73,13 +73,13 @@
"package": "pango",
"linkType": "dynamic",
"buildType": "release",
"vcpkgHash": "fba75d09065fcc76a25dcf386b1d00d33f5175af"
"vcpkgHash": "fba75d09065fcc76a25dcf386b1d00d33f5175af"
},
"win": {
"package": "pango",
"linkType": "dynamic",
"buildType": "release",
"vcpkgHash": "fba75d09065fcc76a25dcf386b1d00d33f5175af"
"vcpkgHash": "fba75d09065fcc76a25dcf386b1d00d33f5175af"
}
},
{
Expand All @@ -101,13 +101,13 @@
"package": "libzip[core]",
"linkType": "static",
"buildType": "release",
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
},
"win": {
"package": "libzip[core]",
"linkType": "static",
"buildType": "release",
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
}
},
{
Expand All @@ -116,13 +116,13 @@
"package": "libzip[core]",
"linkType": "dynamic",
"buildType": "release",
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
},
"win": {
"package": "libzip[core]",
"linkType": "dynamic",
"buildType": "release",
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
"vcpkgHash": "66b4b34d99ab272fcf21f2bd12b616e371c6bb31"
}
},
{
Expand Down Expand Up @@ -190,6 +190,19 @@
"buildType": "release"
}
},
{
"name": "whispercpp-noavx",
"mac": {
"package": "whispercpp-noavx",
"linkType": "dynamic",
"buildType": "release"
},
"win": {
"package": "whispercpp-noavx",
"linkType": "dynamic",
"buildType": "release"
}
},
{
"name": "minizip",
"mac": {
Expand Down

0 comments on commit 8fa4abe

Please sign in to comment.