omega-dnn
aien-dev/omega-dnn
Brought by drakestapleton
omega-dnn / README.md
| 1 | # omega-dnn |
| 2 | |
| 3 | Open deep-learning primitives written in seeded Omega: one OM-2 unit, [`om/dnn.om`](om/dnn.om), |
| 4 | with ONNX operator semantics and a small fusion-graph API. It is the Stack7 answer to NVIDIA |
| 5 | layer #12 (cuDNN): no NVIDIA headers, no cuDNN API names, only ONNX operator definitions. |
| 6 | |
| 7 | **Parent:** [aien-dev/omega-mv](https://github.com/aien-dev/omega-mv) at |
| 8 | `e5b32567a7aff3ce594e3254a622a846a6cd190b` (the OM-2 compiler `seed/out/omc`, sha256 `2c824805…029f`, |
| 9 | and the seeded OM-1 compiler `evidence/SEED-0/omc/omc.elf`, sha256 `734f0a39…6b61`). |
| 10 | **Binding:** [aien-dev/omega-bridge](https://github.com/aien-dev/omega-bridge) native ABI v2 |
| 11 | (PR [#15](https://github.com/aien-dev/omega-bridge/pull/15), `2b59387`). Both pins are in [`PINS`](PINS). |
| 12 | |
| 13 | ## Status (evidence labels kept separate) |
| 14 | |
| 15 | | item | label | |
| 16 | |---|---| |
| 17 | | RMSNorm, LayerNorm, Softmax, RoPE (split and interleaved), SiLU, GELU (erf, tanh), SwiGLU, Add, Mul, bias, ReLU | IMPLEMENTED in .om, EXERCISED on AArch64 (host): [tests/test_ops.py](tests/test_ops.py), receipt [evidence/HOST-01dc3de2](evidence/HOST-01dc3de2) | |
| 18 | | MatMul (+bias, transposed B), flash-tiled attention prefill (GQA, causal), paged-KV decode | IMPLEMENTED in .om, EXERCISED on AArch64 (host), same receipt | |
| 19 | | Conv2d (direct and im2col + GEMM, stride, pad, dilation, groups), MaxPool, AveragePool, GlobalAveragePool | IMPLEMENTED in .om, EXERCISED on AArch64 (host), same receipt | |
| 20 | | Fusion graph (producer + elementwise chain, one store) | IMPLEMENTED, EXERCISED on AArch64 (host): pass counts and values in [tests/test_ops.py](tests/test_ops.py) | |
| 21 | | Mutants of om/dnn.om | 14 of 14 killed by the host suite: [tests/mutants.py](tests/mutants.py), same receipt | |
| 22 | | GB10 GPU tier: RMSNorm, RoPE (split), SwiGLU, SiLU, Softmax (c ≤ 64, through the attention kernel), GQA decode attention, causal prefill attention, paged-KV decode (single and batch), MatMul (f32, +bias, transposed B) | EXERCISED on the GB10 chip through CUDApp's native kernels, gated against this repo's .om host result: [tests/test_gpu.py](tests/test_gpu.py), receipts [evidence/GPU-9841bb3a](evidence/GPU-9841bb3a) (elementwise, attention; CUDApp main `9841bb3a`) and [evidence/GPU-b28372d1](evidence/GPU-b28372d1) (MatMul; CUDApp PR #139 `b28372d1`, not merged). Not QUALIFIED: one seed, 32 cases per op. Failed earlier runs: [evidence/GPU-9841bb3a/LOSSES.md](evidence/GPU-9841bb3a/LOSSES.md) | |
| 23 | | No GPU path | see "Not on the GPU" below | |
| 24 | | Earlier GB10 measurement (2026-10-26) | omega-mv's interim C SASS codegen measured against torch/cuDNN: [evidence/STACK7-GPU-20261026/GPU.md](evidence/STACK7-GPU-20261026/GPU.md). Those kernels are not the CUDApp kernels above | |
| 25 | | SPIR-V | PROPOSED, blocked: omega-mv IR mode has no floats or memory | |
| 26 | | GEMM from aien-dev/omega-blas | PROPOSED (the MatMul here is an interim f64-accumulating GEMM in .om) | |
| 27 | |
| 28 | ### Not on the GPU |
| 29 | |
| 30 | NOT_RUN: CUDApp has no kernel for these (header search of CUDApp `src/*.h` at `9841bb3a`): |
| 31 | LayerNorm, GELU (erf and tanh), ReLU, Add, Mul, bias, RoPE interleaved, Conv2d (direct and |
| 32 | im2col), MaxPool, AveragePool, GlobalAveragePool, the fusion graph, and standalone Softmax. |
| 33 | |
| 34 | Unsupported shapes, refused by the CUDApp kernels and not tested: |
| 35 | - RMSNorm: dim % 128 ≠ 0, or dim > 16384. |
| 36 | - Attention: head_dim ∉ {64, 128}; more than 64 query heads; a GQA ratio that is not a power of two; context above 4096. |
| 37 | - RoPE: rotary width below head_dim. |
| 38 | - Softmax: more than 64 logits. |
| 39 | |
| 40 | ## Build and test |
| 41 | |
| 42 | ```sh |
| 43 | sh tools/build.sh # fetches the pins into .deps/, checks both compiler hashes, binds |
| 44 | python tests/test_ops.py 200 # needs torch (CPU); randomized, compares against torch float64 |
| 45 | python tests/mutants.py # each mutant of om/dnn.om must fail the suite |
| 46 | python tests/test_gpu.py --lib <CUDApp>/build-pic/libcudapp_dnn.so --group ew|attn|gemm \ |
| 47 | --cudapp-sha <sha> --out <receipt.json> [--hold] # GB10; without --hold only the host side runs |
| 48 | ``` |
| 49 | |
| 50 | CI: [`.github/workflows/gates.yml`](.github/workflows/gates.yml) runs `tools/build.sh`, the host suite |
| 51 | (200 cases) and the mutants on a GitHub arm64 runner, with both compilers born from the seed there. |
| 52 | The GB10 tier is not run in CI. |
| 53 | |
| 54 | `build/` gets `libomega_native.so`, the generated `omega_native.{py,h,c,rs,zig,go}` and |
| 55 | `omega_api.h`. The Python package [`python/omega_dnn`](python/omega_dnn/__init__.py) only lays out |
| 56 | the arena and the descriptor ([docs/DESCRIPTOR.md](docs/DESCRIPTOR.md)); every value is computed by |
| 57 | the Omega unit. Tensors enter through DLPack (`torch.from_dlpack`). |
| 58 | |
| 59 | ## Numerics |
| 60 | |
| 61 | f32 in and out, f64 inside, one rounding per stored element. exp is Cody–Waite with a degree-13 |
| 62 | Taylor polynomial, erf a positive series (|x| ≥ 6 gives ±1). Tolerances are derived in |
| 63 | [docs/TOLERANCE.md](docs/TOLERANCE.md), the GPU-tier bounds in its "GPU tier" section, and checked |
| 64 | element by element in `tests/`. |
| 65 | |
| 66 | ## Limits of the seeded compiler (and the proposals) |
| 67 | |
| 68 | The OM-2 compiler gives each function 16 registers with no spilling, has no vector or FMA words, |
| 69 | and bounds every loop at 1,000,000 passes. The kernels are scalar and bounds-checked. The speed |
| 70 | gap to oneDNN is NOT_RUN: no comparison against oneDNN has been measured. The Omega extensions that close it: f32x4 |
| 71 | vector words and FMA, a register allocator with spilling, and IR-mode floats plus a buffer ABI for |
| 72 | the SPIR-V backend. |
| 73 | |
| 74 | Licence: Apache-2.0 WITH LLVM-exception. |
| 75 | |
| 76 | ## Human-Directed Agentic Engineering |
| 77 | |
| 78 | Development follows Human-Directed Agentic Engineering (HDAE): humans define goals, |
| 79 | architecture, constraints, acceptance criteria, and stopping points; agents implement, |
| 80 | execute checks, diagnose failures, and revise within those boundaries. Human review |
| 81 | retains responsibility for claims, acceptance, and release decisions. |
| 82 | |
| 83 | For the documented method and a systems-software case study, see Gregory M. Kurtzer, |
| 84 | [*Ginux: Building an Independent Kernel That Runs Linux Userspace through |
| 85 | Human-Directed Agentic Engineering* (2026)](https://doi.org/10.5281/zenodo.23682548). |