ggml-omega
aien-dev/ggml-omega
Brought by drakestapleton
ggml-omega / .github / workflows / ci.yml
| 1 | name: ggml-omega |
| 2 | on: |
| 3 | push: |
| 4 | pull_request: |
| 5 | workflow_dispatch: |
| 6 | permissions: |
| 7 | contents: read |
| 8 | defaults: |
| 9 | run: |
| 10 | shell: bash # bash -eo pipefail: a failing test before `| tee` fails the step |
| 11 | env: |
| 12 | OMEGA_MV_REF: e5b32567a7aff3ce594e3254a622a846a6cd190b # omc sha256 2c824805… (pinned in build.sh) |
| 13 | OMEGA_BRIDGE_REF: d8174eddf953ad53e16f19eb5841459df99e24bb # src/native.om sha256 e2077722… (pinned in build.sh) |
| 14 | LLAMA_REF: 7aca0d2ea8d92b56911233b822db01f9fbb1ae50 # pinned in build.sh |
| 15 | MODEL_URL: https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/resolve/9217f5db79a29953eb74d5343926648285ec7e67/qwen2.5-0.5b-instruct-q8_0.gguf |
| 16 | MODEL_SHA256: ca59ca7f13d0e15a8cfa77bd17e65d24f6844b554a7b6c12e07a5f89ff76844e |
| 17 | jobs: |
| 18 | test: |
| 19 | runs-on: ubuntu-24.04-arm |
| 20 | timeout-minutes: 300 |
| 21 | steps: |
| 22 | - uses: actions/checkout@v4 |
| 23 | - name: pinned sources |
| 24 | run: | |
| 25 | set -eu |
| 26 | mkdir -p deps && cd deps |
| 27 | curl -fsSL -o omc "https://raw.githubusercontent.com/aien-dev/omega-mv/$OMEGA_MV_REF/seed/out/omc" && chmod +x omc |
| 28 | curl -fsSL -o omc-bind "https://raw.githubusercontent.com/aien-dev/omega-mv/49d7961628ffbed5a8b013c7541995a24e64820f/evidence/SEED-0/omc/omc.elf" && chmod +x omc-bind |
| 29 | for r in omega-bridge:$OMEGA_BRIDGE_REF llama.cpp:$LLAMA_REF; do |
| 30 | n=${r%%:*}; s=${r#*:}; u=https://github.com/aien-dev/omega-bridge; [ "$n" = llama.cpp ] && u=https://github.com/ggml-org/llama.cpp |
| 31 | git init -q "$n" && git -C "$n" fetch -q --depth 1 "$u" "$s" && git -C "$n" checkout -q FETCH_HEAD |
| 32 | done |
| 33 | - name: llama.cpp (CPU backend, test-backend-ops) |
| 34 | run: | |
| 35 | cmake -S deps/llama.cpp -B deps/llama.cpp/build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \ |
| 36 | -DLLAMA_BUILD_TESTS=ON -DLLAMA_CURL=OFF -DGGML_NATIVE=ON -DGGML_OPENMP=OFF > /dev/null |
| 37 | cmake --build deps/llama.cpp/build -j"$(nproc)" --target test-backend-ops llama > /dev/null |
| 38 | - name: build libggml-omega.so and its two mutants (bin-add, math-exp) |
| 39 | run: | |
| 40 | export OMEGA_GGML_OMC=$PWD/deps/omc OMEGA_GGML_BIND_OMC=$PWD/deps/omc-bind OMEGA_BRIDGE=$PWD/deps/omega-bridge GGML_SRC=$PWD/deps/llama.cpp GGML_LIB=$PWD/deps/llama.cpp/build/bin |
| 41 | ./build.sh |
| 42 | OMEGA_GGML_OUT=$PWD/build-mut OMEGA_GGML_MUTANT=bin-add ./build.sh |
| 43 | OMEGA_GGML_OUT=$PWD/build-exp OMEGA_GGML_MUTANT=math-exp ./build.sh |
| 44 | - name: backend private-symbol isolation |
| 45 | run: | |
| 46 | sh tests/exports.sh build/libggml-omega.so |
| 47 | sh tests/exports.sh build-mut/libggml-omega.so |
| 48 | sh tests/exports.sh build-exp/libggml-omega.so |
| 49 | - name: empty model graph control (host only) |
| 50 | run: | |
| 51 | L=$PWD/deps/llama.cpp |
| 52 | cc -std=gnu11 -O2 -Wall -Wextra -Werror -I"$L/ggml/include" tests/empty-graph.c -L"$L/build/bin" -lggml -lggml-base -Wl,-rpath,"$L/build/bin" -o build/empty-graph |
| 53 | OMEGA_GGML_DEVICES=host build/empty-graph "$PWD/build/libggml-omega.so" Omega |
| 54 | - name: Omega math units against libm and _Float16 |
| 55 | run: | |
| 56 | cc -std=gnu11 -O2 -ffp-contract=off -Wall -Wextra -Werror -o build/test-kernels tests/kernels.c build/omega_ggml_kernels.o -lm |
| 57 | ./build/test-kernels | tee build/kernels.txt |
| 58 | cc -std=gnu11 -O2 -ffp-contract=off -o build/test-kernels-exp tests/kernels.c build-exp/omega_ggml_kernels.o -lm |
| 59 | if ./build/test-kernels-exp > build/kernels-mutant.txt; then echo "math-exp mutant NOT caught" >&2; exit 1; fi |
| 60 | echo "math-exp mutant CAUGHT: $(grep -c ' FAIL$' build/kernels-mutant.txt) failing checks" | tee -a build/kernels-mutant.txt |
| 61 | - name: test-backend-ops, Omega vs CPU, per op |
| 62 | run: tests/backend-ops.sh deps/llama.cpp/build/bin/test-backend-ops "$PWD/build/libggml-omega.so" "$PWD/build-mut/libggml-omega.so" | tee build/backend-ops.tsv |
| 63 | - name: model comparison failure controls (host only) |
| 64 | run: | |
| 65 | cc -std=gnu11 -O2 -Wall -Wextra -Werror -o build/cmp tests/cmp.c -lm |
| 66 | node tests/test-cmp.mjs build/cmp |
| 67 | node tests/test-e2e-gb10.mjs |
| 68 | - name: end to end, Qwen2.5-0.5B q8_0, CPU vs Omega |
| 69 | if: always() |
| 70 | run: | |
| 71 | set -eu |
| 72 | L=deps/llama.cpp |
| 73 | cc -std=gnu11 -O2 -Wall -Wextra -Werror -I$L/include -I$L/ggml/include -o build/e2e tests/e2e.c -L$L/build/bin -lllama -lggml -lggml-base -Wl,-rpath,$PWD/$L/build/bin |
| 74 | cc -std=gnu11 -O2 -Wall -Wextra -Werror -o build/cmp tests/cmp.c -lm |
| 75 | curl -fsSL -o model.gguf "$MODEL_URL" |
| 76 | echo "$MODEL_SHA256 model.gguf" | sha256sum -c |
| 77 | N=${E2E_TOKENS:-16} |
| 78 | ./build/e2e model.gguf $N build/cpu.logits 2 > build/e2e-cpu.jsonl |
| 79 | GGML_BACKEND_PATH=$PWD/build/libggml-omega.so ./build/e2e model.gguf $N build/omega.logits 2 > build/e2e-omega.jsonl 2> build/e2e-omega.err |
| 80 | cat build/e2e-omega.err |
| 81 | NV=$(tail -n1 build/e2e-cpu.jsonl | sed 's/.*"n_vocab":\([0-9]*\).*/\1/') |
| 82 | ./build/cmp "$NV" build/cpu.logits build/omega.logits "$N" | tee build/e2e-cmp.json |
| 83 | cat build/e2e-cpu.jsonl build/e2e-omega.jsonl |
| 84 | - uses: actions/upload-artifact@v4 |
| 85 | if: always() |
| 86 | with: |
| 87 | name: ggml-omega-logs |
| 88 | path: | |
| 89 | build/*.txt |
| 90 | build/*.tsv |
| 91 | build/*.json |
| 92 | build/*.jsonl |
| 93 | build/*.err |
| 94 | build/backend-ops/ |