CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / tests / omega / run.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Run the pinned Omega OSC compiler against this checkout's eight slices. |
| 18 | # Usage: tests/omega/run.sh [FUZZ [HARNESS_DIR]] |
| 19 | # or: OMEGA_OSC_COMPILER_DIR=/path/to/omega-osc-cubin tests/omega/run.sh [FUZZ] |
| 20 | # There is no default harness path. The checkout must be exactly PINNED_SOURCE |
| 21 | # and clean. Docs: docs/OMEGA_HOST_TESTS.md. |
| 22 | set -eu |
| 23 | PINNED_SOURCE=1accb93164ce68a2ac2e2c680acf54782f260d62 |
| 24 | FUZZ=${1:-120} |
| 25 | W=${2:-${OMEGA_OSC_COMPILER_DIR:-}} |
| 26 | R=$(cd "$(dirname "$0")/../.." && pwd) |
| 27 | SLICES="doorbell.osc sequencer.osc nvrm.osc va.osc open_plan.osc kmod.osc mesa.osc launch.osc" |
| 28 | |
| 29 | for f in $SLICES; do |
| 30 | [ -f "$R/omega/slices/$f" ] || { |
| 31 | echo "omega-slices: missing required slice $R/omega/slices/$f" >&2 |
| 32 | exit 1 |
| 33 | } |
| 34 | done |
| 35 | |
| 36 | if [ -z "$W" ]; then |
| 37 | echo "omega-slices: compiler harness not configured; set OMEGA_OSC_COMPILER_DIR to an Omega checkout" >&2 |
| 38 | echo "omega-slices: required source commit: $PINNED_SOURCE" >&2 |
| 39 | exit 2 |
| 40 | fi |
| 41 | if [ ! -d "$W/.git" ] && [ ! -f "$W/.git" ]; then |
| 42 | echo "omega-slices: harness directory is not a Git checkout: $W" >&2 |
| 43 | echo "omega-slices: required source commit: $PINNED_SOURCE" >&2 |
| 44 | exit 2 |
| 45 | fi |
| 46 | SOURCE=$(env -u GIT_DIR -u GIT_WORK_TREE git -C "$W" rev-parse --verify HEAD 2>/dev/null || true) |
| 47 | if [ "$SOURCE" != "$PINNED_SOURCE" ]; then |
| 48 | echo "omega-slices: wrong harness source at $W (expected $PINNED_SOURCE, found ${SOURCE:-unavailable})" >&2 |
| 49 | exit 2 |
| 50 | fi |
| 51 | if [ -n "$(env -u GIT_DIR -u GIT_WORK_TREE git -C "$W" status --porcelain)" ]; then |
| 52 | echo "omega-slices: harness checkout is modified or has untracked files; use a clean $PINNED_SOURCE checkout" >&2 |
| 53 | exit 2 |
| 54 | fi |
| 55 | |
| 56 | BIN=$W/build/compiler/test_osc_compiler |
| 57 | if [ ! -x "$BIN" ]; then |
| 58 | echo "omega-slices: compiler binary missing; build it with: make -C '$W' build/compiler/test_osc_compiler" >&2 |
| 59 | make -C "$W" build/compiler/test_osc_compiler |
| 60 | fi |
| 61 | if [ ! -x "$BIN" ]; then |
| 62 | echo "omega-slices: compiler binary still missing after the build: $BIN" >&2 |
| 63 | exit 2 |
| 64 | fi |
| 65 | BIN_SHA=$(sha256sum "$BIN" | awk '{print $1}') |
| 66 | printf 'omega harness source=%s binary_sha256=%s\n' "$SOURCE" "$BIN_SHA" |
| 67 | |
| 68 | T=$(mktemp -d) |
| 69 | trap 'rm -rf "$T"' EXIT HUP INT TERM |
| 70 | mkdir -p "$T/slices" |
| 71 | ln -s "$W/tests/compiler/progs" "$T/progs" |
| 72 | ln -s "$W/tests/compiler/neg" "$T/neg" |
| 73 | for f in $SLICES; do cp "$R/omega/slices/$f" "$T/slices/"; done |
| 74 | cd "$W" |
| 75 | "$BIN" "$FUZZ" "$T" |