Omega under PyTorch: torch.compile(model, backend="omega") (milestone 1)
Status: IMPLEMENTED and EXERCISED on CPU only (AArch64, DGX Spark host), oracle = PyTorch eager, Omega-native codegen, Python glue. Not qualified, not merged, not a claim that Omega runs PyTorch in general: it runs the core-ATen ops listed below, float32, static shapes, inference only.
What runs where
| Layer | Implementation | Status |
|---|---|---|
Kernels (pytorch/kernels/*.om) | seeded Omega, compiled by omega-mv seed/out/omc in function mode to AArch64 words | first-party |
Binding (src/native.om) | Omega program that writes the C trampoline of native call ABI v1 (docs/NATIVE-ABI.md) | first-party; the C it writes is compiled by the host cc |
Backend glue (pytorch/omega_torch/__init__.py) | Python: registers the backend, walks the FX graph, allocates outputs, calls units through ctypes | interim migration step |
The glue computes no tensor value. Every value in an output was written by Omega machine code;
the glue only reads shapes, picks a kernel, supplies the shape constants as a const NAME ulong N
header in front of the fixed kernel text, and passes buffer addresses.
Ops
Covered (core ATen after core_aten_decompositions()): aten.mm, aten.addmm (1-D bias, beta = alpha
= 1), aten.permute (2-D, dims [1, 0]), aten.add.Tensor (equal shapes, alpha 1), aten.relu,
aten._softmax (2-D, last dim, half_to_float false). addmm(b, x, permute(W, [1, 0])) whose
permute has no other user is lowered to the linear kernel, which reads W in place.
Refused at compile time, with every refused node listed and nothing run: any other op, broadcasting,
non-float32 dtypes, non-CPU devices, symbolic shapes (dynamic=False is required), empty tensors,
tensors above the Omega array limit of 16,777,216 elements (OMEGESE 9.4), softmax rows above the 4 MiB
local-array limit, non-contiguous inputs (at run time), autograd (run under torch.no_grad()), and a
visible CUDA device. Eager fallback exists only for ops named in OMEGA_TORCH_FALLBACK (or
omega_torch.set_fallback), and every such call is counted in STATS["eager_fallback_calls"].
Numerics: each dot product and softmax sum is accumulated in f64 and rounded once to f32. exp is
written in Omega (expd in softmax.om): range reduction by ln 2, degree-13 Taylor polynomial
(truncation below 5.9e-18 relative), exponent bits for 2^k.
Use
export CUDA_VISIBLE_DEVICES= # TorchDynamo touches CUDA while tracing; milestone 1 is CPU only
export OMEGA_OMC=/path/to/omega-mv/seed/out/omc # sha256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f
python3 -m unittest -v pytorch/tests/test_omega_torch.py
import sys; sys.path.insert(0, "pytorch")
import omega_torch # registers backend "omega"
with torch.no_grad():
y = torch.compile(model, backend="omega", fullgraph=True, dynamic=False)(x)
Built units are cached under build/torch/<sha256 of unit source, compiler pin and native.om>.
Host dependencies
| Dependency | Version used | What it does here | Omega successor |
|---|---|---|---|
| PyTorch | 2.14.0+cu130 | TorchDynamo capture, AOTAutograd core-ATen decomposition, tensor allocation, the eager oracle | the oracle stays; capture moves behind a PrivateUse1 omega device whose dispatch is an Omega unit |
| CPython | 3.12.3 | runs the glue and ctypes | the glue's graph walk and dispatch move into an Omega unit called through the same C ABI |
cc (GCC) | system | compiles the C trampoline src/native.om writes | an Omega-emitted ELF shared object (the trampoline is a fixed instruction sequence) |
Successor
The Python glue is interim. The successor is a PrivateUse1 out-of-tree device omega
(torch.utils.rename_privateuse1_backend("omega")) whose operator registrations are a fixed C ABI
table generated by the bridge, with lowering, shape specialisation and dispatch done by an Omega unit.
That keeps the PyTorch-required registration as the only foreign code and lets eager ops and
torch.compile graphs share one Omega dispatcher. Later targets (GB10 SASS, SPIR-V, StableHLO,
Tenstorrent, NKI) plug in at the kernel layer, unchanged above it. GPU runs are NOT_RUN: they need an
authorized window.