interplane.Get Omega
Read in your language

omega-dnn

aien-dev/omega-dnn

Brought by drakestapleton

branch main Branches Tags History

omega-dnn / README.md

85 lines · 6028 bytes Raw Blame History Rendered
1# omega-dnn
2
3Open deep-learning primitives written in seeded Omega: one OM-2 unit, [`om/dnn.om`](om/dnn.om),
4with ONNX operator semantics and a small fusion-graph API. It is the Stack7 answer to NVIDIA
5layer #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`,
9and 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
30NOT_RUN: CUDApp has no kernel for these (header search of CUDApp `src/*.h` at `9841bb3a`):
31LayerNorm, GELU (erf and tanh), ReLU, Add, Mul, bias, RoPE interleaved, Conv2d (direct and
32im2col), MaxPool, AveragePool, GlobalAveragePool, the fusion graph, and standalone Softmax.
33
34Unsupported 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
43sh tools/build.sh # fetches the pins into .deps/, checks both compiler hashes, binds
44python tests/test_ops.py 200 # needs torch (CPU); randomized, compares against torch float64
45python tests/mutants.py # each mutant of om/dnn.om must fail the suite
46python 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
50CI: [`.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.
52The 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
56the arena and the descriptor ([docs/DESCRIPTOR.md](docs/DESCRIPTOR.md)); every value is computed by
57the Omega unit. Tensors enter through DLPack (`torch.from_dlpack`).
58
59## Numerics
60
61f32 in and out, f64 inside, one rounding per stored element. exp is Cody–Waite with a degree-13
62Taylor 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
64element by element in `tests/`.
65
66## Limits of the seeded compiler (and the proposals)
67
68The OM-2 compiler gives each function 16 registers with no spilling, has no vector or FMA words,
69and bounds every loop at 1,000,000 passes. The kernels are scalar and bounds-checked. The speed
70gap to oneDNN is NOT_RUN: no comparison against oneDNN has been measured. The Omega extensions that close it: f32x4
71vector words and FMA, a register allocator with spilling, and IR-mode floats plus a buffer ABI for
72the SPIR-V backend.
73
74Licence: Apache-2.0 WITH LLVM-exception.
75
76## Human-Directed Agentic Engineering
77
78Development follows Human-Directed Agentic Engineering (HDAE): humans define goals,
79architecture, constraints, acceptance criteria, and stopping points; agents implement,
80execute checks, diagnose failures, and revise within those boundaries. Human review
81retains responsibility for claims, acceptance, and release decisions.
82
83For the documented method and a systems-software case study, see Gregory M. Kurtzer,
84[*Ginux: Building an Independent Kernel That Runs Linux Userspace through
85Human-Directed Agentic Engineering* (2026)](https://doi.org/10.5281/zenodo.23682548).