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 / AGENTS.md

111 lines · 14693 bytes Raw Blame History Source

CUDA++ (GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit)

CUDA++ is the GPU half of the Omega runtime. It writes sm_121 machine code (SASS) directly, launches it through its own client for NVIDIA's open kernel module ioctls, and ships matrix multiply, attention, elementwise and mixture-of-experts libraries on top. Its build and runtime use no CUDA toolkit, nvcc, PTX, libcuda or cuBLAS. Host verification uses NVIDIA's offline nvdisasm as an independent instruction oracle, never as an implementation dependency. It builds with make and a C compiler; it runs only on the NVIDIA GB10 (DGX Spark, sm_121) with the 580.173.02 open kernel module. The repository on GitHub is CUDApp; the project name is written CUDA++.

Shared rules: read https://www.aienos.com/agents/RULES.md first. This file adds what is specific to this repository; where the two differ, this file wins here.

Scope

Installation

git clone https://github.com/aien-dev/CUDApp.git
cd CUDApp
make -j8          # build/libomega_gpu.a, copied to build/libcudapp.a

Needs Linux, git, make and gcc (the Makefile uses CC ?= gcc and builds with -Wall -Wextra -Werror). Nothing from the CUDA toolkit is needed to build or run. The complete host test suite additionally requires offline nvdisasm for independent encoder operand checks and the pinned Omega verification tools; missing required tools are NOT_RUN, not PASS. The host build and host tests need no GPU. Running a kernel on the chip needs a DGX Spark (GB10) with NVIDIA's open kernel module 580.173.02 loaded and /dev/nvidia0 and /dev/nvidia-uvm present.

Configuration

Usage

Host commands (no GPU opened):

make test                     # portable host suite, x86-64 and AArch64: about 7 minutes
make test-native-artifact     # offline native artifact export test
make zero-cuda-gate           # the built programs need no CUDA library (self-test first)
make doctor                   # is this machine ready? reads /proc, /sys and /dev only
build/hello_gpu --sim         # the first kernel on the host warp simulator
make test-omega-slices        # eight OSC slices; needs OMEGA_OSC_COMPILER_DIR; not part of make test
python3 tools/figures/make_figures.py --check   # README figures match the code
python3 tools/figures/test_stack_legend.py -v   # rendered legend check; needs Inkscape

GPU commands (need a GB10; do not run from an agent session unless the maintainer has given you a GPU window on the DGX Spark):

make hello-gpu                              # runs make doctor, then examples/hello_gpu on the GPU
./build/gpu_<name>_test --out receipt.json  # chip gates; each test's comment in the Makefile says how it is run

make cubin-probe (tools/interop/cubin_probe.c) links NVIDIA's libcuda and refuses to run unless SPARK_WINDOW is set. It is an interop check, not part of CUDA++; never add it to a host target.

Conventions

Safety and approvals

Further reading

Cursor Cloud specific instructions

Cloud Agent VMs are x86_64. make decides the host from uname -m (Makefile L24-31): on x86_64 it sets CC := gcc unless CC came from the command line or the environment, compiles the same checked portable C units emitted by om/units.sh (src/cudapp_om_*.c, src/cudapp_freest_*.c) that AArch64 compiles, and, unless OMEGA_OMC is given explicitly, makes the three rows that execute the pinned AArch64 omc (test-om-spec-encoder, test-portable-receipts, test-model-capacity) exit 2. gcc is whatever PATH finds first; on these VMs /usr/local/bin/gcc and /usr/local/bin/cc are the aarch64 cross compiler, so the built binaries are aarch64 and run under qemu-user. qemu-user is registered against /usr/aarch64-linux-gnu at boot, and again by /usr/local/bin/make if that boot hook did not run. If a binary exits with Exec format error, run any make target once, then retry it. On AArch64 CC stays make's built-in cc and the seeded binding is linked.

make test is the host suite. Judge the exit code and the last line, CUDA++ HOST TESTS PASS (<count> targets). The log contains intentional FAIL lines. Under qemu it is slower than the arm64 CI runner. The attention simulator is one slow part. test-codegen-freestanding sweeps every 2^32 bf16 input; a 20 million iteration cast loop took 18 seconds here, so that sweep is on the order of an hour. build/hello_gpu --sim is the simulator hello world. python3 tools/figures/make_figures.py --check checks the README figures.

Pinned tools sit where the Makefile looks, next to the checkout:

/usr/local/bin/make exports CUDAPP_MEM_RESERVE_MIB=0 when the variable is unset. MemAvailable on this VM under-reports because of the hypervisor balloon, and the default 4 GiB reserve then refuses the Qwen-shaped upload in test-gpu-serving-alloc. The platform test unsets the variable and still checks the 4096 default against a fake meminfo. Do not copy that 0 onto a Spark.

make doctor prints NOT READY here: no NVIDIA module and no /dev/nvidia*. That is the expected diagnostic. The doctor binary is aarch64, so its system line says aarch64; uname -m in the shell is x86_64. Do not run make hello-gpu or open /dev/nvidia*.