Skip to content

Add ARM NEON int8 qgemm acceleration, quantized kernel selection, and S8 context storage unification for CoNgram on macOS ARM #471

Add ARM NEON int8 qgemm acceleration, quantized kernel selection, and S8 context storage unification for CoNgram on macOS ARM

Add ARM NEON int8 qgemm acceleration, quantized kernel selection, and S8 context storage unification for CoNgram on macOS ARM #471

Workflow file for this run

name: macOS
on:
pull_request:
branches: [ main ]
jobs:
build-macos:
strategy:
matrix:
include:
- name: "macOS 15 Arm64 + Xcode 16.0"
os: macos-15
arch: arm64
compiler: xcode
version: "16.0"
- name: "macOS 15 + Xcode 16.0"
os: macos-15-intel
arch: x86_64
compiler: xcode
version: "16.0"
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Configure Compiler
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
- name: Configure Build
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DKIWI_JAVA_BINDING=1 ..
- name: Build
run: cd build && make -j2
- name: Run Unit Test
run: ./build/test/kiwi-test
- name: Run Unit Test in Debug mode
if: failure()
run: |
mkdir build_debug && cd build_debug && cmake -DCMAKE_BUILD_TYPE=Debug .. && make -j2
cd .. && lldb -o run -o bt ./build_debug/test/kiwi-test
- name: Run Java Unit Test
run: |
cd bindings/java
curl -OL https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
curl -OL https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
javac -cp "*:../../build/bindings/java/*:." -encoding utf-8 test/KiwiTest.java
java -cp "*:../../build/bindings/java/*:." org.junit.runner.JUnitCore test.KiwiTest
- name: Run Evaluator
run: |
mkdir eval_results
./build/kiwi-evaluator -m ./models/cong/base --morph eval_data/*.txt -t cong -o eval_results/
./build/kiwi-evaluator -m ./models/cong/base --morph eval_data/*.txt -t cong-global -o eval_results/
- name: Run Benchmark
run: |
curl -OL https://latina.bab2min.pe.kr/_data/kowiki1000.txt
./build/kiwi-cli-* -m ./models/cong/base -e -o test.out kowiki1000.txt
KIWI_ARCH_TYPE=none ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out kowiki1000.txt
KIWI_ARCH_TYPE=balanced ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out kowiki1000.txt
if [ "${{ matrix.arch }}" = "x86_64" ]; then
KIWI_ARCH_TYPE=sse2 ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out kowiki1000.txt
KIWI_ARCH_TYPE=sse4_1 ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out kowiki1000.txt
KIWI_ARCH_TYPE=avx2 ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out kowiki1000.txt
KIWI_ARCH_TYPE=sse2 ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out --model-type largest kowiki1000.txt
KIWI_ARCH_TYPE=sse4_1 ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out --model-type largest kowiki1000.txt
KIWI_ARCH_TYPE=avx2 ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out --model-type largest kowiki1000.txt
else
KIWI_ARCH_TYPE=neon ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out kowiki1000.txt
KIWI_ARCH_TYPE=neon ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out --model-type largest kowiki1000.txt
KIWI_ARCH_TYPE=neon ./build/kiwi-cli-* -m ./models/cong/base -e -o test.out --typo 6 kowiki1000.txt
fi
- name: Archive binaries
uses: actions/upload-artifact@v4
with:
name: Artifacts ${{ matrix.name }}
path: |
build/*kiwi*
build/test/*kiwi*
eval_results/*.txt
build/bindings/java/*.jar