interplane.Get Omega
Read in your language

omega-blas

aien-dev/omega-blas

Brought by drakestapleton

branch main Branches Tags History

omega-blas / README.md

93 lines · 5984 bytes Raw Blame History Rendered
1# omega-blas
2
3BLAS in Omega: the open replacement track for layer #6 of the NVIDIA stack (cuBLAS).
4
5- **Parent:** [aien-dev/omega-mv](https://github.com/aien-dev/omega-mv) at `e5b32567a7aff3ce594e3254a622a846a6cd190b` (language, compiler, gates). Exact pins: [PINS](PINS).
6- **Binding:** [aien-dev/omega-bridge](https://github.com/aien-dev/omega-bridge) `tools/native`, ABI v2.
7- **GPU execution:** [aien-dev/CUDApp](https://github.com/aien-dev/CUDApp) (ADR 0042: Omega owns compute, CUDApp owns GPU execution, omega-bridge owns compatibility).
8
9## What is here
10
11| Path | Role | Status |
12|---|---|---|
13| `om/blas.om` | the compute unit: f16/bf16/e4m3/e5m2 widening and RNE narrowing, panel packing, the 2x2 f32 gemm macro-kernel, the fused epilogue (alpha, beta, bias by row or column, relu, gelu-tanh), gemv, strided copy, reference argument checks | Omega (OM-2) |
14| `src/omegablas.c`, `include/omegablas.h` | **interim** C layer: CBLAS and Fortran 77 entry points, xerbla routing, workspace, cache blocking, batch loops, and (built only with `GB10=1`) the GB10 device dispatch | C, retired by the extensions in [docs/EXTENSIONS.md](docs/EXTENSIONS.md) |
15| `python/omegablas` | DLPack binding (numpy, torch, any `__dlpack__` producer) | Python over ctypes |
16| `tests/smoke.py`, `tests/convert.py` | numpy checks of cblas_sgemm and cblas_sgemv; exhaustive format-conversion check against ml_dtypes | Python |
17| `tests/netlib/` | `run.sh`: the unmodified netlib BLAS/CBLAS SGEMV/SGEMM test drivers (sblat2, sblat3, c_sblat2, c_sblat3) against a build, on the host or the GB10 path; `fetch.sh`: the pinned LAPACK source | shell |
18| `tests/gb10/` | `batched.c` + `run.sh`: strided, pointer-array and single products, route predictions and untouched padding, on either device; `hooks.c`: test-only HMMA-model backend and CUDApp mutants | C test drivers (migration-pending, docs/EXTENSIONS.md) |
19| `receipts/` | dated run receipts with their logs | |
20
21On the host path every floating-point operation runs in Omega; the C layer moves no numbers except
22the bias copy into the workspace and the batch pointer arithmetic. On the GB10 path the f32
23products run in CUDApp (see below), not in Omega.
24
25## Routines
26
27- `cblas_sgemm`, `sgemm_`, `cblas_sgemv`, `sgemv_` (standard CBLAS / F77 ABI, LP64).
28- `omb_gemm_ex`: A and B in f32, f16, bf16, OCP FP8 e4m3 or e5m2; C in f32, f16 or bf16; f32
29 accumulation; fused `C = act(alpha op(A) op(B) + beta C + bias)` with bias per row or column and
30 act none, relu or gelu-tanh.
31- `omb_hgemm`, `omb_bfgemm`, `omb_gemm_batched`, `omb_gemm_strided_batched`, `omb_widen`, `omb_narrow`.
32
33Numerics: no FMA (one rounding per operation); see [docs/TOLERANCE.md](docs/TOLERANCE.md) for the
34bound the tests enforce.
35
36## Build
37
38```sh
39make BRIDGE=/path/to/omega-bridge OMC=/path/to/seeded/omc OMC2=/path/to/om2/omc
40python3 tests/smoke.py
41```
42
43CI: [`.github/workflows/gates.yml`](.github/workflows/gates.yml) runs these two steps on a GitHub arm64
44runner, with both compilers born from the seed there. The GB10 path and the netlib drivers are not run in CI.
45
46Limits: each dimension below 1,000,000 (the seeded compiler's loop bound); calls are serialised by
47one lock (the bound Omega runtime has one stack).
48
49## GB10 device path
50
51Status: EXERCISED on the GB10 chip (netlib SGEMV/SGEMM, 2026-10-27,
52[receipts/netlib-gb10-20261027.md](receipts/netlib-gb10-20261027.md); rerun 2026-10-31 against
53CUDApp#214, [receipts/netlib-gb10-20261031.md](receipts/netlib-gb10-20261031.md)). Not QUALIFIED.
54It depends on CUDApp `omega_gpu_gemm_ex` (aien-dev/CUDApp#214, merged; EXPERIMENTAL,
55pinned in [PINS](PINS) at the CUDApp main merge commit).
56Large-shape throughput is NOT_RUN (small-shape latency: receipts/netlib-gb10-20261027.md). The
57reference to beat is cuBLAS on spark-b87b's GB10, 2026-11-14:
58[receipts/cublas-gb10-20261114.md](receipts/cublas-gb10-20261114.md).
59
60```sh
61make GB10=1 CUDAPP=/path/to/CUDApp BRIDGE=... OMC=... OMC2=... # builds into build-gb10/
62OMEGABLAS_DEVICE=gb10 ./your_program # unset or host: the Omega host path
63```
64
65- Scope: f32 A, B and C with no bias and no activation, through `sgemm_`, `cblas_sgemm`, `sgemv_`,
66 `cblas_sgemv`, `omb_gemm_ex`, `omb_gemm_batched` and `omb_gemm_strided_batched`. A strided batch
67 with disjoint C is one `omega_gpu_gemm_ex` call. Every other call stays on the host path and is
68 counted as such. `omb_set_device` / `omb_get_device` switch at run time.
69- Numerics: CUDApp's bf16x3 route on the tensor cores, not bit-exact fp32. The derived netlib
70 ratio bound is 11.2 for the decks' k <= 9 ([docs/TOLERANCE.md](docs/TOLERANCE.md)).
71- No silent fallback: a device error aborts the process with the gemm_ex code. So does
72 `OMEGABLAS_DEVICE=gb10` on a library built without `GB10=1`, and any value other than `host` or
73 `gb10`.
74- `omb_get_route_counts` and `OMEGABLAS_ROUTE_REPORT=1` (one stderr line at unload) report host
75 products, gemm_ex calls, tensor-core calls, and outputs CUDApp recomputed on the host, plus the
76 CUDApp revision linked in.
77- Tests: `OMB_BUILD=build-gb10 OMEGABLAS_DEVICE=gb10 LAPACK=... sh tests/netlib/run.sh` and
78 `OMEGABLAS_DEVICE=gb10 sh tests/gb10/run.sh`. With `GB10_HOOKS=/path/to/CUDApp
79 OMB_TEST_BACKEND=model`, both run the device glue on CUDApp's chip-exact HMMA model without a
80 GPU.
81
82Licence: Apache-2.0 WITH LLVM-exception.
83
84## Human-Directed Agentic Engineering
85
86Development follows Human-Directed Agentic Engineering (HDAE): humans define goals,
87architecture, constraints, acceptance criteria, and stopping points; agents implement,
88execute checks, diagnose failures, and revise within those boundaries. Human review
89retains responsibility for claims, acceptance, and release decisions.
90
91For the documented method and a systems-software case study, see Gregory M. Kurtzer,
92[*Ginux: Building an Independent Kernel That Runs Linux Userspace through
93Human-Directed Agentic Engineering* (2026)](https://doi.org/10.5281/zenodo.23682548).