interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / docs / DEEPINFER.md

152 lines · 12616 bytes Raw Blame History Source

DeepInfer as a bridge target

Status: PROPOSED target. The inventory and the import verdicts below are EXERCISED on the host (AArch64, no GPU). No DeepInfer function is converted today. Nothing here is QUALIFIED, MERGED or DEPLOYED.

Ownership follows ARCH-0042: Omega owns computation, CUDA++ (aien-dev/CUDApp) owns GPU execution, Omega Bridge owns compatibility. Source translation adapters live in omega-mv; the Python front end of the porting tool lives in aien-dev/babel.

Pins

itempin
deepseek-ai/DeepInfer553741557a57df44a46fb3ab72b6aafeaf945337 (2026-10-25), Apache-2.0, package 0.1.0, Python >= 3.12
vendor submodules (gitlinks, not fetched)DeepEP f6aa38fe, DeepEP-Ascend 3b25377d, DeepGEMM 1fc9c669, DeepGEMM-Ascend 3a353262, DeepSelect bfa4507d, FlashMLA 2e5429fc
omega-bridge1958a189 (main)
omega-mv adaptersPR #839 head 656192e0: build/L627/import/python-import sha256 4c74b1f7…, build/S2/c-i64-import 4cd9f018…, build/L739/cpp-import ed90e640…
aien-dev/babel156360f8 (adapter pin omega-mv 2d4c6407)
aien-dev/CUDAppb5746b94

Upstream targets NVIDIA SM100 and Huawei Ascend 950 (README lines 35-36). The Spark GPU is GB10 (sm_121). Running any DeepInfer kernel on GB10 is NOT_RUN and outside upstream's stated support.

Three layers

Every DeepInfer component falls in one or more of these layers, each owned by an existing component.

  1. Source translation: a function is imported by an omega-mv adapter (directly or through babel) into OMSA, lowered to .om, and called through bridge bindings. Bounded by the import profiles.
  2. Operator mapping: a tensor kernel (TileLang, DeepGEMM, FlashMLA, DeepEP, DeepSelect) is matched to an Omega computation and a CUDA++ realization. Nothing converts these automatically today.
  3. Framework attachment: torch and deepinfer._C callers are switched to Omega-generated code through bridge bindings (tools/native) or the PyTorch attachment (bridge #23, #30, both open drafts).

Component inventory

Python sizes are file and line counts at the pin; csrc is C/C++.

componentsizelayertoday
model_executor/layers/tilelang_ops (30 kernel families, each a cuda/ and an asc/ file)93 files, 23,331 lines2no Omega or CUDA++ counterpart; extension E
model_executor/models (deepseek, 23 v4_modules: attn, mla_attn, index_attn, compress, engram, hc, mhc, moe, mlp, rope, norm, yoco, linear, heads, …)34 files, 7,051 lines2routed-expert FP4 decode exists as a seeded-Omega host port in aien-sovereign-core-mv #780 (draft, om/dsv4/fp4dq.om); MLA, index attention, compress, engram, hc/mhc have no Omega port
other model_executor (top-level files, layers outside tilelang_ops, eplb, input_metadata, parallel_utils)30 files, 4,925 lines2, 3CUDApp codegen covers attn, attn256, pattn, gdn, gemm, bf16, qmma, moe, moe2, router, dec, pf, tc, tern, qg at Qwen3.6-35B shapes; DeepSeek shapes NOT_RUN
csrc/engine (scheduler 1,329 lines, prepare_tensor_input_v4, sequence, block_manager, flops_estimator, mtp_varlen, zos, outputs, prepare_sample) + graph_timer, cuda_utils, asc_utils33 files, 5,908 lines1, 30 functions import (below); FlopsEstimator pair counts are extension D
deepinfer._C (pybind11, 15 Python importers)22 classes, 153 def entries3the bridge native ABI carries scalars and flat arrays only; no class or handle form (extension F)
engine, worker, distributed, entrypoints20 files, 5,421 lines1, 30 functions import
structure_output (xgrammar)5 files, 595 lines3no Omega counterpart
hugging_face, ve, npu_ops, deep_cluster29 files, 3,221 lines1, 3no Omega counterpart; npu_ops is Ascend-only
tests19 files, 3,117 linesoracleneed torch and an SM100 or Ascend device; NOT_RUN

External dependencies

"Files" counts DeepInfer Python files that import the module at the pin.

dependencyversionfilesroleOmega replacement
torch2.13.0+cu132129tensors, CUDA streams and graphs, distributedCUDA++ runtime plus Omega computation; attachment is bridge #23 (CPU, torch.compile backend) and #30 (CUDA++, pending)
tilelang0.1.1560JIT kernel DSL for every tilelang_ops familynone; extension E
tile-kernels2.1.046prebuilt TileLang kernelsnone; extension E
DeepGEMM1fc9c6699FP8/FP4 dense and grouped-MoE GEMMCUDApp gemm/qmma/moe/moe2 at Qwen shapes; FP4 expert decode in core-mv #780 (host, draft)
FlashMLA2e5429fc4MLA attentionnone
flash-attn-44.0.0b341prefill attentionCUDApp attn/attn256/pattn at Qwen shapes
DeepEPf6aa38fe5expert-parallel all-to-all across GPUsnone; a single GB10 has no expert-parallel peer [INFERENCE]
DeepSelectbfa4507d4sparse index selectionnone
xgrammar0.2.23grammar token masksnone
transformers, tokenizers4.50.0, 0.21.44, 1config and tokenizernone
safetensors0.8.02weight filesnone recorded here
pybind113.0.1(csrc)deepinfer._Ctools/native bindings, scalars and arrays only (extension F)
pyzmq, posix_ipc27.1.0, 1.3.21, 1process messagingnone
torch-npu, CANN, DeepGEMM-Ascend, DeepEP-Ascend2.13.0rc1, 9.2, 3a353262, 3b25377d2 (torch_npu)Ascend backendout of scope: no Ascend device
einops, numpy, scipy, sympy, orjson, pillow, psutil, requests, huggingface_hub, tabulate, tqdm, ninjarequirements.txt pinshost supportnot on the conversion path; none

Measured translation coverage (layer 1)

Replay: OMEGA_MV=<built omega-mv> sh evidence/deepinfer/run.sh re-runs all 32 inputs below and prints DEEPINFER-COVERAGE REPLAY PASS when every exit status matches. Negative control: replacing ctrl_pos.py with the unmasked control makes that row FAIL and the script prints DEEPINFER-COVERAGE REPLAY FAIL. Both outcomes were observed on 2026-10-31.

Python (profile python-u64-v1)

evidence/deepinfer/select_candidates.py walks all 270 .py files (1,915 functions) and keeps functions whose body is one return over parameters and integer literals. Six qualify; the remaining 1,909 are outside every Python profile by shape (statements, calls, tensors, attributes) and were not sent to the adapter. The six were sent verbatim (py-verbatim/) and then with annotations, docstrings and leading underscores removed (py-stripped/) to expose the next refusal.

functionlocationverbatimstripped
is_power_of_twomodel_executor/layers/tilelang_ops/common.py:3066 TYPE (annotation)68 ARITHMETIC (&, ==)
ceil_divtilelang_ops/common.py:3466 TYPE68 ARITHMETIC (//, unmasked)
i64tilelang_ops/random_sampling.py:4966 TYPE69 CONSTRUCT (conditional expression)
expanded_image_token_lenve/processor/image_processor.py:7672 SOURCE_FORM (non-ASCII docstring)68 ARITHMETIC (unmasked + *)
_align_to_multipleworker/cache_engine.py:3672 SOURCE_FORM (non-ASCII docstring)68 ARITHMETIC (//)
_needs_compress_stateworker/cache_engine.py:11971 SIGNATURE (leading _)68 ARITHMETIC (comparison)

Controls: ctrl_pos.py (one masked u64 add) imports, rc 0, 324 bytes; ctrl_unmasked.py refuses 68. Cause probes: the same positive body with an ASCII docstring refuses 69 CONSTRUCT (probe_doc_ascii.py) and with a non-ASCII comment refuses 72 (probe_nonascii_comment.py), so the two 72 verdicts come from the Chinese text, and an ASCII docstring would still refuse.

The refusals are the profile working as specified, not adapter bugs. python-u64-v1 refuses unmasked arithmetic because Python int is unbounded; idiomatic DeepInfer integer code is unmasked. The S2 Python form (python-i64-select-v1) requires the _ck(...) range helper and also excludes //, %, & and shifts (translation-s2-v1 section 1), so S2 would not accept these either.

C and C++ (FlopsEstimator, csrc/engine/flops_estimator.hpp)

floor_prefix, capped_prefix and pairs (lines 239-257) were chosen by reading the file as the csrc functions closest to the integer profiles. No systematic csrc scan was run; the babel splitter covers Python only.

inputadapterrcrefusal
verbatim, no headerc-i64-import, cpp-import72UNSUPPORTED_PREPROCESSOR (missing required header line)
verbatim + #include <stdint.h> (*.hdr-c)c-i64-import66UNSUPPORTED_TYPE (static, default argument)
verbatim + #include <cstdint>, std::int64_t (*.hdr-cpp)cpp-import69UNSUPPORTED_CONSTRUCT (specifiers)
floor_prefix rewritten as one C17 expression (floor_prefix.c17)c-i64-import68UNSUPPORTED_ARITHMETIC (division)

Controls: ctrl_pos.c17 rc 0 (345 bytes); ctrl_pos.hdr-cpp (calc, std::uint64_t) rc 0 (361 bytes); ctrl_name.hdr-cpp (same body, name f) rc 71, because cpp17 profiles accept only calc or omega_* names.

Result

No DeepInfer function imports with the current adapters: 1,909 Python functions fall outside every profile by shape, the 6 in-shape Python functions refuse, and the 3 C/C++ functions tried refuse in every form. The gaps, in order of reach: integer division and remainder with each language's rounding, unbounded Python int, comparisons and selects outside the _ck form, docstrings and non-ASCII source text, specifiers and default arguments, classes, and every tensor operation.

Extensions

Each gap becomes reusable work in the component that already owns that layer. No DeepInfer-specific converter is added.

idextensionownerstatus
APython splitter in babel: split a module into functions, route each to python-import, record per-function verdicts and a refusal histogramaien-dev/babelPAUSED: aien-dev/babel#4 (C→Rust completion gate) owns the babel driver files first; resumes after that lands
BS2.1 integer profile: i64 division and remainder with C/C++ truncation and Python floor rounding as distinct ops, min/max, trap on divisor 0 and on INT64_MIN / -1. Reaches floor_prefix, capped_prefix, pairs, ceil_div, _align_to_multipleomega-mv translationPROPOSED (protocol change; needs the S2 owner's review)
Cpython-int-checked-i64 profile: idiomatic Python int (annotations int/bool, docstrings, //, %, &, comparisons, conditional expressions) imported as i64 whose realization traps whenever CPython's exact result leaves -2^63..2^63-1. Wrapping is not a refinement here, because out-of-range Python results are defined values, not errors. Reaches 5 of the 6 Python candidates; i64 stays refused (literal 2^63 is outside i64)omega-mv translationPROPOSED; depends on B for //. The trapping long realization exists: omc 734f0a39 and 2c824805 exit with trap 1 on long add/sub/mul overflow (measured in omega-bridge#49 evidence/deepinfer-flops-pairs/overflow-measurement.log; S2 spec addendum A1 at omega-mv 656192e0 records the same for 734f0a39)
DFlopsEstimator pair counts as native .om with domain contracts, bridge bindings, a differential against the upstream functions and a caller-switch patchomega-bridgeIMPLEMENTED, EXERCISED on host AArch64: omega-bridge#49 (draft, d7cc8856). A DeepInfer build with the patch and the upstream pytest are NOT_RUN
ETileLang kernel importer: TileLang T.prim_func bodies to Omega computation plus CUDA++ kernels, family by family (start with norm, gather, quant)CUDApp with omega-mvPROPOSED; parity needs a GPU window; upstream kernels target SM100, GB10 is sm_121
FHandle ABI for bindings: opaque object handles with constructor, method and destructor entries so py::class_ surfaces such as Scheduler, BlockManager and Sequence can be served by Omega unitsomega-bridge src/native.omPROPOSED

Switching callers

A caller moves to Omega only after its .om unit is differentially checked against the pinned upstream function and its bindings pass tests/native/run.sh (NATIVE-CALL PASS with all seven callers). The switch is a patch against the DeepInfer pin, kept in this repository (examples/deepinfer/), not a fork. Every dependency in the table above stays listed until its replacement is EXERCISED in that way.