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 / evidence / uxl-brief-20261113 / BRIEF.md

218 lines · 22077 bytes Raw Blame History Source

Note, 14 November 2026: run Level 3 only on hardware you control or with the host operator's agreement; Levels 1 and 2 need no GPU.

Omega running Qwen3.8-27B on an AMD Instinct MI300X

Technical brief for the UXL Open Source Working Group Drake Stapleton, drake@aienos.com, 13 November 2026

Source for the AMD side: Omega's GPU layer at commit dc536882c06a692991be97dc65cd2d037d82b129 and the Omega compiler repository omega-mv at commit 2ee0a70d1830581b706f288e722f3329d51f3583. The GPU layer still lives in a repository named CUDApp, from when it only targeted NVIDIA. I plan to move it into the Omega repository. If the clone URLs in section 6 move, the commit hashes stay the reference. The Spark engine binary (sha256 df9360112fdc815539f3e289fccfd8070845129ef4ccb466bb90c729ec71d0e5) was built, according to my build records, from my Core repository https://www.aienos.com/rad/z44GqrPVAPjZkhoD2MWVjqy18ighN.git at commit 46134247. The binary does not report its own version. The 1 November record is docs/qwen38/qualification-20261101/README.md there at 5c95594a. Code is Apache-2.0 WITH LLVM-exception. Measurement data is CC0-1.0.

The 10:12 UTC run used the launcher built at CUDApp commit ab58f171 with the compiler at omega-mv commit 64d6db3b. The commits above are later and rebuild the same bytes (same sha256), which Level 2 checks. The front page of the CUDApp repository is still about NVIDIA. For the AMD work, start at backend/amd/kfd/launch/README.md.

Summary

On 13 November 2026 a program written in Omega, my own language, ran the Qwen3.8-27B-FP8 model on an AMD Instinct MI300X with no AMD user-space runtime in its process: no HIP, no ROCr, no PyTorch. It talks to the Linux AMD compute interface (/dev/kfd) directly and runs 18 GPU kernels whose code objects my own Omega tooling wrote.

Median decode time was 26.7 ms per token. I measured it twice that day in two separate sessions (26.726 and 26.721 ms). The second time I followed only the public instructions in section 6. The same request on my DGX Spark takes 125.4 ms per token on a quiet machine (1 November). So the AMD run is 4.7 times faster per decode step (5.1 against a busier Spark the same evening).

That ratio is not a measure of the card. The Spark is a desktop machine and the MI300X is a data-centre card with 19 times its memory bandwidth. At one request at a time my AMD path uses under a fifth of that bandwidth, while my Spark engine uses about three quarters of its own (section 4). What the run shows is that a launcher and kernels written in one small language can drive an AMD card with nothing from the vendor above the kernel driver. Section 4 also puts my path beside other software on the same card in the same session.

Section 6 has the commands, at three levels of effort. Level 1 takes five minutes and needs no GPU. Level 2 needs no GPU either. The small example, a vector add on the card, is the first step of Level 3.

1. The machine

CardAMD Instinct MI300X, target gfx942. The machine reports it as "AMD Instinct MI300X VF", model 0x74b5, with 191.7 GiB of VRAM. The Linux KFD topology reports gfx_target_version 90402, vendor 4098, device 29877, 1216 SIMDs.
Whose machineAMD's. It is the hosted One-Click notebook "Qwen/Qwen3.8-27B on AMD Instinct MI300X" at notebooks.amd.com/oneclick, opened from my AMD developer sign-in. Not a rented box and not a card I own.
Sessionsjupyter-user-261113101013-76e03a28 (10:12 UTC, the published run) and jupyter-user-261113185025-46d1b9c5 (18:50 UTC, the repeat and the same-session comparisons)
SystemLinux 6.12.48+deb13-amd64, x86-64, glibc 2.39, ROCm 7.2.2. Root inside the notebook container, with /dev/kfd and the card's render node visible.
Not establishedThat I had the physical host to myself. The container's /dev/dri lists 64 cards. The KFD topology has ten nodes. My container can read the properties of one GPU node only, and my launcher uses that one and skips the rest (reading them returns "not permitted"). I did not try to open any other device.

The comparison machine is my own NVIDIA DGX Spark (GB10).

2. What ran

At run time the process contains only Omega code. The model step itself is laid out by that Python script, so the Omega part today is the launcher and the kernels, not the model description. Python, PyTorch and C are otherwise test and measurement tools outside the process: they check the plan on the CPU, and they replay the same step through AMD's HIP loader to compare token IDs against.

This is a command-line program. It is not an HTTP server, and I have not built the serving layer on AMD.

On the Spark the same request goes to a different program: my own engine (Rust and C, its own GB10 code path) running as an HTTP server. It is not the launcher above. The same engine binary served both Spark measurements.

3. The model

Qwen/Qwen3.8-27B-FP8 from Hugging Face, revision 017b9c7af6b5689d5dd426a76e0bc077eb5ca20a. Text path only, no vision tensors loaded. The run downloads about 30 GB and checks the sha256 of all 68 files against a pinned list before using them. The Spark runs used the same checkpoint and revision, also hash-checked (the 1 November record lists 81 files checked there).

4. The numbers

Same request on every Omega row and on the Spark: the prompt "Write a detailed essay about the history of lighthouses, from ancient times to today.", thinking off, greedy decoding, 30 prompt tokens in, 256 tokens out. The AMD runs were fed the exact prompt token IDs recorded from the Spark.

Omega on the MI300X against my Spark

AMD MI300X, 13 Nov 10:12 UTC (published run)AMD MI300X, 13 Nov 19:07 UTC (repeat)DGX Spark, 13 Nov 19:16 UTCDGX Spark, 1 Nov
Timed runs, plus 1 warmup left out5555
Decode time per token, median26.726 ms26.721 ms135.6 ms125.4 ms
The same as tokens per second (1000 / the row above)37.4237.427.377.97
Prefill, 30 tokens, median779 ms780 ms607 ms507 ms

The run medians behind those rows, in ms: published AMD run 26.731, 26.642, 26.675, 26.726, 26.760. AMD repeat 26.743, 26.803, 26.706, 26.671, 26.721. Spark on 13 November 135.7, 135.5, 135.6, 135.2, 135.9.

Ratio of decode times, Spark over AMD: 4.69 against the Spark's quiet 1 November run, 5.07 with both sides measured the same evening. I quote the smaller one. On 13 November the Spark was shared with other CPU work: its one-minute load was 10.5 to 16.3 during the warmup and timed requests, where the public 1 November record holds one sample, 3.7. Two small GPU processes were also resident. It ran 8 percent slower than its own earlier number. The first 24-token requests in the same server log, about a minute earlier, ran at 125 to 127 ms per token, the 1 November speed, and the last two before the timed runs were already at 134 to 135. So I read the slowdown as contention and not a slower build. I have not tested that.

The Spark server's own end-to-end figures are a little lower than 1000 / graph time: 7.93 tokens per second on 1 November and 7.30 to 7.34 on 13 November.

AMD prefill is 1.3 to 1.5 times slower than the Spark. My AMD path feeds the prompt one token at a time.

What is not the same on the two sides:

How far each side is from its hardware, as an estimate: one decode step reads at most about 26.9 GB of weights (less the 2.5 GB input embedding table, which is read one row per token). At 26.721 ms that is at most about 1.0 TB/s on a card whose peak memory bandwidth is 5.3 TB/s (AMD's figure): 17 to 19 percent. At 125.4 ms it is at most about 215 GB/s on a machine whose bandwidth is 273 GB/s (NVIDIA's figure): 71 to 79 percent. My Spark engine is close to its limit. My AMD path is not.

The same card, the same session, four ways

All four ran in session jupyter-user-261113185025-46d1b9c5 between 19:07 and 19:18 UTC. The first three ran the same token IDs. The stock pipeline call ran the same prompt text through its own template and settings.

PathDecode time per token, median
Omega launcher and Omega kernels, direct to /dev/kfd26.721 ms
The same Omega kernels, loaded and replayed by AMD's HIP runtime24.741 ms
PyTorch 2.10.0 on ROCm 7.2.2 with transformers 5.12.1, the same FP8 checkpoint, plain greedy loop131.011 ms
The notebook's stock pipeline call inside my timing script (uxl-stock.py), the unquantised BF16 checkpoint70.628 ms

How to read it:

5. How I know the output is right

6. Repeat it

Every level below has been run as printed. Level 1 ran on a Mac, on arm64 Linux and on the AMD machine. Level 2 ran from fresh public clones on arm64 Linux. Level 3 is the 19:07 UTC repeat in section 4, done from a public clone on a fresh AMD notebook.

I work with AI coding agents. They write much of the code and tooling, and they ran these measurements under my direction. The commands and logs in the archive are what ran. One long trace log is trimmed, with a note beside it.

Level 1: check my numbers (any machine with git and Python 3, five minutes)

git clone https://interplane.io/drakestapleton/CUDApp.git CUDApp
cd CUDApp
git checkout dc536882c06a692991be97dc65cd2d037d82b129
python3 -I evidence/amd-qwen38-native-refusal-20261113/verify.py

Expected output:

EVIDENCE PASS 65 hashed files; raw steps/IDs; independent graph; reference coding24; calculations

It checks the published files against their hashes and recomputes the medians and the ratio from the raw per-step timings of the published run. This level shows that the published record is consistent with itself and that the numbers follow from it; it cannot show where the logs were recorded. Only Level 3, on a card, does that. The raw output of each run is in evidence/amd-qwen38-native-refusal-20261113/native/sample1.stdout to sample5.stdout. The write-up beside it is README.md in the same folder, also at https://interplane.io/drakestapleton/CUDApp/blob/dc536882c06a692991be97dc65cd2d037d82b129/evidence/amd-qwen38-native-refusal-20261113/README.md

Level 2: rebuild the launcher and kernels from source (Linux on arm64, no GPU)

cd ..    # back to the folder that holds CUDApp, which stays at dc536882
git clone https://interplane.io/drakestapleton/omega-mv.git omega-mv
git -C omega-mv checkout 2ee0a70d1830581b706f288e722f3329d51f3583
sha256sum omega-mv/seed/out/omc
#   26540e6de62402d5784b30b24d7c6faae488137c1f8a4b3e784fd0b5d5528991

cd CUDApp
python3 -I tests/amd-kfd-launch/check.py "$(realpath ../omega-mv/seed/out/omc)"
#   second-to-last line: AMD-KFD-LAUNCH CPU PASS {...}
#   last line: NOT_RUN every AMD device row ... (expected: this level has no GPU)
sha256sum build/amd-kfd-launch/gate/launch-x86
#   08a504911ec6e87a9746632a14d22245155597e3a8ed384c93c0e5260bb691e1

The last hash is the executable that ran on the card. The same check rebuilds all 18 kernels and fails unless each is byte-identical to the one the card ran. It runs 274 checks in under a minute. The run is good only if check.py exits 0 and prints the AMD-KFD-LAUNCH CPU PASS line. The hash line alone is not enough.

It needs python3, cc with the C library and Linux kernel headers (it includes linux/kfd_ioctl.h), and qemu-x86_64, which it uses to run the x86-64 launcher on the arm64 host. On Ubuntu 24.04 that is sudo apt-get install gcc libc6-dev linux-libc-dev qemu-user. The check itself needs no root and no GPU. The one setup I tested is Ubuntu 24.04 on arm64 with 4 KiB pages, Python 3.12.3, gcc 13.3.0, Linux headers 6.8.0 and qemu-user 8.2.2. Other setups are untested.

The Omega compiler runs on arm64 Linux only today, which is why this level needs that host. The launcher it produces is cross-compiled for x86-64. To rebuild the compiler from its hand-written seed instead of trusting the checked-in binary, run sh seed/omega-from-seed.sh in omega-mv. It takes about a second, ends with RC=0, and leaves seed/out/omc with the same hash.

Level 3: run it on an MI300X

You need x86-64 Linux with an MI300X, root, /dev/kfd (KFD 1.14 or later), about 30 GB of disk for the weights, about 36 GiB of free VRAM, git, and Python with PyTorch and safetensors for the plan script. The comparison commands at the end also need ROCm's HIP library (libamdhip64). AMD's One-Click MI300X notebook has all of that. My sessions there ended after 30 to 40 minutes and the download took 12 of them, so start it first.

The small example first. It adds two vectors on the card and checks every output bit. Copy launch-x86 and vadd.hsaco from the Level 2 output folder (build/amd-kfd-launch/gate/). They are the only two files that do not come from the public clone. If you have no arm64 Linux machine, the same two files are in the evidence archive under level2-rebuild/. Check them against these hashes: launch-x86 is the sha256 printed in Level 2, and vadd.hsaco is 10eb12e019ff2117ddc0190650899d4254589375c62e5ebb970b1bbb7e67e55f.

chmod +x launch-x86

./launch-x86 vadd vadd.hsaco vadd 10000000000
#   OMEGA vadd=PASS count=256

Then the model, from the CUDApp folder at dc536882:

cd evidence/amd-qwen38-native-20261113
export AMDSERVE_WEIGHTS=/tmp/qwen3.8-27b-fp8

# download the checkpoint and check all 68 file hashes
python3 -c "import runpy; runpy.run_path('oracle/driver-real2.py', run_name='prepare-import')['prepare']()"

# write the plan and the kernels, then check the plan against the checkpoint on the CPU
mkdir out    # in a fresh clone; remove an old out folder first
python3 oracle/emit-plan.py oracle/driver-real2.py "$AMDSERVE_WEIGHTS" out/real2.plan \
    --capacity=131072 --fixture-json=oracle/lighthouse256.json
python3 oracle/check-plan.py out/real2.plan "$AMDSERVE_WEIGHTS"
sha256sum out/real2.plan
#   2a292dadc236f224005ed4e2d8ac2ba8b33dc71d79dabcc8497d177561f9c012

# run it (the plan's command file expects the launcher to be called omega-launch)
cp /path/to/launch-x86 out/omega-launch
cd out && PATH="$PWD:$PATH" sh real2.plan.cmd > run1.txt

run1.txt holds one OMEGA_STEP i tok=T us=U line per step and ends with OMEGA_PLAN ids=[...]. The first 30 steps are the prompt. The median us over the 255 steps after that is the decode number in section 4, and each run takes about 27 seconds. The 256 IDs should equal the ids list in evidence/amd-qwen38-native-refusal-20261113/numerical/graph.json.

At this level the 18 kernels are written out by emit-plan.py from bytes carried inside oracle/driver-real2.py. Level 2 is what ties those bytes to the Omega source: its check rebuilds each kernel and compares the hash.

Two of the same-session comparisons from section 4 are one command each, run one level up from out. The PyTorch one also needs transformers and the kernels package, and it fetches an FP8 kernel package from the Hugging Face Hub at run time. The script for the stock notebook row is amd-repeat-20261113T1907Z/uxl-stock.py in the evidence archive. It expects the clone at /workspace/uxl/CUDApp. Edit its lines 4 and 8 otherwise.

cd ..
python3 oracle/lighthouse-oracle.py oracle/driver-real2.py "$AMDSERVE_WEIGHTS" \
    oracle/lighthouse256.json graph out/graph.json --capacity=131072       # my kernels through AMD's HIP runtime
python3 oracle/lighthouse-oracle.py oracle/driver-real2.py "$AMDSERVE_WEIGHTS" \
    oracle/lighthouse256.json reference out/reference.json --capacity=131072   # PyTorch on ROCm, same checkpoint

Each prints a line with decode_ms_median.

7. What this does not show

8. What would help