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/omega-bridge/blob/main/max-cpu/mogg-cache-repro.sh # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings 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 `omega-bridge / max-cpu / mogg-cache-repro.sh` 32 lines ยท 1954 bytes Raw Blame History 1 #!/bin/sh 2 # MAX 26.7.0 observation: a custom-op kernel compiled from one Mojo source is reused after that 3 # source changes, when the package path and MODULAR_CACHE_DIR stay the same. Needs max-cpu/run.sh 4 # to have built $BUILD first (lib/ and extcall/kernels). Prints one line per step; exit 0 always 5 # reports what it saw, it does not gate anything. 6 # TMPDIR=/dev/shm taskset -c 5-9 nice -n 19 ionice -c3 max-cpu/mogg-cache-repro.sh 7 set -eu 8 export CUDA_VISIBLE_DEVICES= # MAX 26.7.0 Graph() opens a visible GPU; see run.sh 9 cd "$(dirname "$0")/.." 10 MAXPY=${MAXPY:-$HOME/workspace/maxinterop/venv/bin/python} 11 BUILD=${BUILD:-/dev/shm/omega-max-cpu} 12 R=$BUILD/mogg-repro 13 L=$BUILD/lib/libomega_native.so 14 rm -rf "$R" 15 mkdir -p "$R/pkg/kernels" "$R/other/kernels" 16 step() { # step NAME CACHE KERNELS: prints the error or "ran" 17 MODULAR_CACHE_DIR=$3 "$MAXPY" max-cpu/omega_max.py neg-load --lib "$L" --kernels "$2" \ 18 --want 'Failed to materialize symbols' >"$R/$1.log" 2>&1 || true 19 printf '%-26s %s\n' "$1" "$(grep '^got:' "$R/$1.log" | cut -c1-90)" 20 } 21 cp "$BUILD/extcall/kernels/__init__.mojo" "$R/pkg/kernels/" 22 step 1-extcall-cacheA "$R/pkg/kernels" "$R/cacheA" 23 find "$R/cacheA" -type f | sed "s|$R/||" | sort >"$R/cacheA-after-1.txt" 24 cp max-cpu/kernels/__init__.mojo "$R/pkg/kernels/" # the fixed glue, same path 25 step 2-fixed-cacheA "$R/pkg/kernels" "$R/cacheA" 26 find "$R/cacheA" -type f | sed "s|$R/||" | sort >"$R/cacheA-after-2.txt" 27 step 3-fixed-cacheB-fresh "$R/pkg/kernels" "$R/cacheB" 28 cp max-cpu/kernels/__init__.mojo "$R/other/kernels/" # the fixed glue, another path 29 step 4-fixed-otherpath-cacheA "$R/other/kernels" "$R/cacheA" 30 sha256sum "$R/pkg/kernels/__init__.mojo" "$BUILD/extcall/kernels/__init__.mojo" 31 if diff "$R/cacheA-after-1.txt" "$R/cacheA-after-2.txt" >/dev/null; then echo "cacheA: no new files in step 2" 32 else echo "cacheA: step 2 added $(comm -13 "$R/cacheA-after-1.txt" "$R/cacheA-after-2.txt" | wc -l) files"; fi