interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / tests / omega / run.sh

75 lines · 2988 bytes Raw Blame History
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.
22set -eu
23PINNED_SOURCE=1accb93164ce68a2ac2e2c680acf54782f260d62
24FUZZ=${1:-120}
25W=${2:-${OMEGA_OSC_COMPILER_DIR:-}}
26R=$(cd "$(dirname "$0")/../.." && pwd)
27SLICES="doorbell.osc sequencer.osc nvrm.osc va.osc open_plan.osc kmod.osc mesa.osc launch.osc"
28
29for 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 }
34done
35
36if [ -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
40fi
41if [ ! -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
45fi
46SOURCE=$(env -u GIT_DIR -u GIT_WORK_TREE git -C "$W" rev-parse --verify HEAD 2>/dev/null || true)
47if [ "$SOURCE" != "$PINNED_SOURCE" ]; then
48 echo "omega-slices: wrong harness source at $W (expected $PINNED_SOURCE, found ${SOURCE:-unavailable})" >&2
49 exit 2
50fi
51if [ -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
54fi
55
56BIN=$W/build/compiler/test_osc_compiler
57if [ ! -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
60fi
61if [ ! -x "$BIN" ]; then
62 echo "omega-slices: compiler binary still missing after the build: $BIN" >&2
63 exit 2
64fi
65BIN_SHA=$(sha256sum "$BIN" | awk '{print $1}')
66printf 'omega harness source=%s binary_sha256=%s\n' "$SOURCE" "$BIN_SHA"
67
68T=$(mktemp -d)
69trap 'rm -rf "$T"' EXIT HUP INT TERM
70mkdir -p "$T/slices"
71ln -s "$W/tests/compiler/progs" "$T/progs"
72ln -s "$W/tests/compiler/neg" "$T/neg"
73for f in $SLICES; do cp "$R/omega/slices/$f" "$T/slices/"; done
74cd "$W"
75"$BIN" "$FUZZ" "$T"