-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable the following paths. 1. google/ruy for `aarch64` int8*int8 matmul (affine) - Mac M1, Android Phones. 2. google/ruy for android `aarch64` float32*float32 matmul (attention). 3. Apple Accelerate for Mac M1 float32*float32 matmul (attention) Effectively, this supports Mac (x86_64 Intel, `aarch64` M1) and Android (untested, `aarch64`) now. There are obvious optimizations pending on some fronts in the newly created branches. PR: #2
- Loading branch information
1 parent
82ebf9a
commit 774fbc7
Showing
34 changed files
with
1,362 additions
and
613 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
sudo apt-get -y install ccache cmake | ||
wget -c --quiet https://dl.google.com/android/repository/android-ndk-r23b-linux.zip | ||
unzip -qq android-ndk-r23b-linux.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
function cmake-configure { | ||
NDK=android-ndk-r23b | ||
ABI="arm64-v8a" | ||
MINSDK_VERSION=28 | ||
ANDROID_PLATFORM=android-28 | ||
|
||
mkdir -p build | ||
pushd build | ||
|
||
SLIMT_ARGS=( | ||
-DWITH_RUY=ON | ||
-DWITH_INTGEMM=OFF | ||
-DWITH_BLAS=OFF | ||
) | ||
|
||
OTHER_ANDROID_ARGS=( | ||
-DANDROID_ARM_NEON=TRUE | ||
) | ||
# Additionally list variables finally configured. | ||
set -x | ||
cmake -L \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \ | ||
-DANDROID_TOOLCHAIN=clang \ | ||
-DANDROID_ABI=$ABI \ | ||
-DANDROID_PLATFORM=$ANDROID_PLATFORM \ | ||
-DANDROID_NATIVE_API_LEVEL=$MINSDKVERSION \ | ||
-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.8 \ | ||
-DANDROID_STL=c++_static \ | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
"${SLIMT_ARGS[@]}" \ | ||
"${OTHER_ANDROID_ARGS[@]}" \ | ||
.. | ||
set +x | ||
popd | ||
} | ||
|
||
cmake-configure | ||
cmake --build build --target all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
echo "Android is cross-compiled, no tests for now." |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
brew install cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
# Configure | ||
cmake -B build -S $PWD -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_INTGEMM=ON -DWITH_RUY=OFF | ||
|
||
# Build | ||
cmake --build build --target all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Install `bergamot` CLI via pip. | ||
python3 -m pip install bergamot -f https://github.com/jerinphilip/bergamot-translator/releases/expanded_assets/latest | ||
|
||
# Download en-de-tiny and de-en-tiny models. | ||
bergamot download -m en-de-tiny | ||
|
||
BROWSERMT="$HOME/Library/Application Support/bergamot/models/browsermt/" | ||
PREFIX="$BROWSERMT/ende.student.tiny11" | ||
|
||
MODEL=model.intgemm.alphas.bin | ||
VOCAB=vocab.deen.spm | ||
SHORTLIST=lex.s2t.bin | ||
|
||
./build/bin/slimt --root "${PREFIX}" \ | ||
--model ${MODEL} --vocab ${VOCAB} --shortlist ${SHORTLIST} \ | ||
< data/sample.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y build-essential cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
# Configure | ||
cmake -B build -S $PWD -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_INTGEMM=ON -DWITH_RUY=OFF | ||
|
||
# Build | ||
cmake --build build --target all |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.