From 58323bf8eddd27f327411e1c3febe95a37eca8c2 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 8 Aug 2024 14:27:16 +0300 Subject: [PATCH] build : fix aarch64 (#0) --- Package.swift | 1 + bindings/ruby/ext/extconf.rb | 2 ++ .../app/src/main/jni/whisper/CMakeLists.txt | 1 + .../whisper.android/lib/src/main/jni/whisper/CMakeLists.txt | 1 + .../whisper.objc/whisper.objc.xcodeproj/project.pbxproj | 6 ++++++ 5 files changed, 11 insertions(+) diff --git a/Package.swift b/Package.swift index fc472493..f3893262 100644 --- a/Package.swift +++ b/Package.swift @@ -32,6 +32,7 @@ let package = Package( sources: [ "ggml/src/ggml.c", "src/whisper.cpp", + "ggml/src/ggml-aarch64.c", "ggml/src/ggml-alloc.c", "ggml/src/ggml-backend.c", "ggml/src/ggml-quants.c", diff --git a/bindings/ruby/ext/extconf.rb b/bindings/ruby/ext/extconf.rb index f22c550e..d791c413 100644 --- a/bindings/ruby/ext/extconf.rb +++ b/bindings/ruby/ext/extconf.rb @@ -5,6 +5,8 @@ system("cp #{File.join(File.dirname(__FILE__),'..','..','..','whisper-mel.hpp')} system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.h')} .") system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.c')} .") system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-impl.h')} .") +system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-aarch64.h')} .") +system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-aarch64.c')} .") system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-alloc.h')} .") system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-alloc.c')} .") system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-backend-impl.h')} .") diff --git a/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt b/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt index c53672e4..9e5bebf9 100644 --- a/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt +++ b/examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt @@ -7,6 +7,7 @@ set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../../) set(SOURCE_FILES ${WHISPER_LIB_DIR}/ggml/src/ggml.c + ${WHISPER_LIB_DIR}/ggml/src/ggml-aarch64.c ${WHISPER_LIB_DIR}/ggml/src/ggml-alloc.c ${WHISPER_LIB_DIR}/ggml/src/ggml-backend.c ${WHISPER_LIB_DIR}/ggml/src/ggml-quants.c diff --git a/examples/whisper.android/lib/src/main/jni/whisper/CMakeLists.txt b/examples/whisper.android/lib/src/main/jni/whisper/CMakeLists.txt index cb8c8811..81dd7ed8 100644 --- a/examples/whisper.android/lib/src/main/jni/whisper/CMakeLists.txt +++ b/examples/whisper.android/lib/src/main/jni/whisper/CMakeLists.txt @@ -19,6 +19,7 @@ if (NOT GGML_HOME) SOURCE_FILES ${SOURCE_FILES} ${WHISPER_LIB_DIR}/ggml/src/ggml.c + ${WHISPER_LIB_DIR}/ggml/src/ggml-aarch64.c ${WHISPER_LIB_DIR}/ggml/src/ggml-alloc.c ${WHISPER_LIB_DIR}/ggml/src/ggml-backend.c ${WHISPER_LIB_DIR}/ggml/src/ggml-quants.c diff --git a/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj b/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj index 044e9fc0..deb82b85 100644 --- a/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj +++ b/examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 18133C802C64E342005CEAAC /* ggml-aarch64.c in Sources */ = {isa = PBXBuildFile; fileRef = 18133C7F2C64E342005CEAAC /* ggml-aarch64.c */; }; 1844471A2AB211A2007D6BFE /* ggml-alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 184447182AB211A2007D6BFE /* ggml-alloc.c */; }; 1844471C2AB21655007D6BFE /* ggml-metal.m in Sources */ = {isa = PBXBuildFile; fileRef = 1844471B2AB21655007D6BFE /* ggml-metal.m */; settings = {COMPILER_FLAGS = "-framework Foundation -framework Metal -framework MetalKit -fno-objc-arc"; }; }; 18627C7B29052BDF00BD2A04 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18627C7A29052BDF00BD2A04 /* AppDelegate.m */; }; @@ -44,6 +45,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 18133C7E2C64E342005CEAAC /* ggml-aarch64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-aarch64.h"; path = "../../../ggml/src/ggml-aarch64.h"; sourceTree = ""; }; + 18133C7F2C64E342005CEAAC /* ggml-aarch64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ggml-aarch64.c"; path = "../../../ggml/src/ggml-aarch64.c"; sourceTree = ""; }; 184447182AB211A2007D6BFE /* ggml-alloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ggml-alloc.c"; path = "../../../ggml/src/ggml-alloc.c"; sourceTree = ""; }; 184447192AB211A2007D6BFE /* ggml-alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-alloc.h"; path = "../../../ggml/include/ggml-alloc.h"; sourceTree = ""; }; 1844471B2AB21655007D6BFE /* ggml-metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ggml-metal.m"; path = "../../../ggml/src/ggml-metal.m"; sourceTree = ""; }; @@ -112,6 +115,8 @@ 18627C7829052BDF00BD2A04 /* whisper.objc */ = { isa = PBXGroup; children = ( + 18133C7F2C64E342005CEAAC /* ggml-aarch64.c */, + 18133C7E2C64E342005CEAAC /* ggml-aarch64.h */, 18A275FF2C2A9563001C8D37 /* ggml-common.h */, 18A275FE2C2A94DE001C8D37 /* ggml-metal.h */, 18ABE1562AF556340044A204 /* ggml-backend-impl.h */, @@ -236,6 +241,7 @@ files = ( 18627C8129052BDF00BD2A04 /* ViewController.m in Sources */, 18ABE15B2AF556340044A204 /* ggml-quants.c in Sources */, + 18133C802C64E342005CEAAC /* ggml-aarch64.c in Sources */, 7FE3424C2A0C3FA20015A058 /* whisper-encoder.mm in Sources */, 18627C9429052C4900BD2A04 /* whisper.cpp in Sources */, 18627C9629052C5800BD2A04 /* ggml.c in Sources */,