Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/MojoLlama/blob/main/mojollama-bench-engine # MojoLlama Archived Mojo/MAX quantizer and serving research repository (read-only history) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `MojoLlama / mojollama-bench-engine` 48 lines · 1871 bytes Raw Blame History 1 #!/bin/bash 2 # mojollama-bench-engine — Real model inference benchmark 3 # WHAT: Builds and runs mojollama_engine_bench.mojo with configurable 4 # architecture params for any dense LLaMA-style model. 5 # Reports thread sweep, component breakdown, batch sweep, memory BW. 6 # WHY: Find optimal deployment config for any model on any hardware. 7 # WHEN: May 2026 — v1 engine benchmark. 8 set -e 9 10 MOJO_ENGINE="/onedev-workspace/work/src/mojollama/mojo_engine" 11 MODEL_DIR="${MODEL_DIR:-/tmp/tinyllama}" 12 13 # Architecture config (override via env for different models) 14 NE="${NE:-2048}"; NH="${NH:-32}"; NK="${NK:-4}" 15 HD="${HD:-64}"; NL="${NL:-22}"; FF="${FF:-5632}" 16 NV="${NV:-32000}" 17 18 echo '[DOC] Building engine bench with:' 19 echo " NE=$NE NH=$NH NK=$NK HD=$HD NL=$NL FF=$FF NV=$NV" 20 echo " Model: $MODEL_DIR" 21 22 # Generate Mojo source with overridden comptime constants 23 SRC="$MOJO_ENGINE/mojollama_engine_bench.mojo" 24 TMP=$(mktemp) 25 cp "$SRC" "$TMP" 26 27 # Replace comptime constants 28 sed -i "s/comptime NE: Int = [0-9]*/comptime NE: Int = $NE/" "$TMP" 29 sed -i "s/comptime NH: Int = [0-9]*/comptime NH: Int = $NH/" "$TMP" 30 sed -i "s/comptime NK: Int = [0-9]*/comptime NK: Int = $NK/" "$TMP" 31 sed -i "s/comptime HD: Int = [0-9]*/comptime HD: Int = $HD/" "$TMP" 32 sed -i "s/comptime NL: Int = [0-9]*/comptime NL: Int = $NL/" "$TMP" 33 sed -i "s/comptime FF: Int = [0-9]*/comptime FF: Int = $FF/" "$TMP" 34 sed -i "s/comptime NV: Int = [0-9]*/comptime NV: Int = $NV/" "$TMP" 35 36 # Build 37 cp "$TMP" "$MOJO_ENGINE/_bench_custom.mojo" 38 cd "$MOJO_ENGINE" 39 if mojo build _bench_custom.mojo -o mojollama_engine_bench_custom 2>/dev/null; then 40 echo '[DONE] Build OK. Running benchmark...' 41 timeout 120 ./mojollama_engine_bench_custom 2>/dev/null 42 rm -f _bench_custom.mojo mojollama_engine_bench_custom 43 else 44 echo '[ERR] Build failed' 45 rm -f _bench_custom.mojo 46 exit 1 47 fi 48 rm -f "$TMP"