OpenEmbedded recipes for the Modular Platform: the Mojo compiler, the MAX inference engine, and the MAX Python API, plus a packagegroup and a sample image for exercising them on target.
Two different things are licensed here and conflating them would be a mistake.
The layer metadata — the recipes, the packagegroup, the image, the oeqa test
and the samples — is MIT, per COPYING.MIT.
The binaries these recipes fetch are proprietary. Modular publishes no
source for the Mojo compiler or the MAX engine; the upstream Bazel build itself
downloads prebuilt wheels. Redistribution is governed by the Modular Community
License Terms in licenses/LicenseRef-MAX-Platform-Software-License. Nothing in
this layer builds until you have read those terms and opted in:
LICENSE_FLAGS_ACCEPTED:append = " modular-community-license"
The flag is deliberately not spelled commercial_modular: OE's
license_flag_matches() tests underscore-separated prefixes, so any flag
starting with commercial is satisfied by a bare commercial entry, which many
distros already accept. modular-community-license contains no underscore, so
only itself matches, and opting in is always explicit.
Because there is no source, there is no patching. Any defect in these binaries is not fixable in-layer; the only remedy is a version bump.
URI: git://github.com/openembedded/openembedded-core.git layer: meta
URI: git://github.com/openembedded/meta-openembedded.git layer: meta-python
meta-python supplies python3-rich and python3-msgspec; everything else
comes from oe-core.
x86-64 and aarch64, glibc only. Upstream publishes manylinux_2_34 wheels for
those two architectures and nothing else; musl and the x32 ABI are excluded
explicitly.
The manylinux tag is misleading. These wheels are compiled for raised ISA
baselines, measured by disassembling the mojo driver:
| Arch | Minimum | Evidence |
|---|---|---|
| aarch64 | ARMv8.2-A plus FEAT_LRCPC and dotprod — Cortex-A76 / Neoverse-N1 and newer | ~30,700 LDAPR, ~4,600 LSE atomics, 532 UDOT |
| x86-64 | about x86-64-v3 |
45,599 inline BMI1/BMI2 sites |
COMPATIBLE_HOST cannot express this — it matches architecture, not CPU
features — so a too-old CPU is not caught at build time. The rootfs builds and
installs cleanly and then mojo dies with Illegal instruction (core dumped)
on its first instruction, which reads like a corrupt binary rather than an
unsupported CPU.
For aarch64, "ARMv8.2-A" alone is not a sufficient description: a64fx is
ARMv8.2-A but lacks FEAT_LRCPC and still faults, while cortex-a76 and
neoverse-n1 run. LDAPR is the binding constraint. This is what an upstream
build targeting Neoverse-N1 (AWS Graviton2) looks like.
This is why mojo-image sets QB_CPU:aarch64 = "-cpu cortex-a76": qemuarm64
defaults to -cpu cortex-a57, which is ARMv8.0-A and cannot run the driver at
all. Real aarch64 hardware must genuinely be Cortex-A76-class or newer; since
there is no source, there is nothing to rebuild for an older part.
| Recipe | What it is |
|---|---|
mojo-compiler |
The Mojo driver, its bundled lld, and the precompiled Mojo stdlib |
python3-mojo |
Small pure-Python shim from the compiler wheel, needed by max.graph |
max-core |
The MAX engine: libmax.so, kernel libraries, C API headers |
max-core-gpu |
libNVPTX.so, the NVIDIA PTX backend, dlopened and droppable |
max-core-nixl |
RDMA / KV-cache transfer plugins (x86-64 only; the aarch64 wheel ships none) |
python3-max |
The MAX Python API: max.graph and max.nn |
mojo-samples |
A Mojo program and a MAX import check, in /usr/share/mojo/samples |
packagegroup-mojo |
Umbrella over -runtime and -toolchain |
mojo-image |
Sample image; boots under qemu and is verified by the oeqa case below |
max.pipelines and max.serve are on disk but deliberately not importable:
they need the wheel's serve and benchmark pip extras, which this layer does
not satisfy.
bitbake mojo-image
On a qemu machine with TESTIMAGE_AUTO = "1" that also runs the on-target test
suite. To run it by itself:
bitbake -c testimage mojo-image
The suite is TEST_SUITES = "ping ssh mojo". The mojo module lives in
lib/oeqa/runtime/cases/mojo.py and checks that mojo --version works without
a Crashpad warning, that mojo build compiles and runs a real program, that
import max.graph succeeds, and that the 114MB private lld has not leaked
onto PATH where it would collide with meta-clang's.
To try the same things by hand after runqemu:
mojo --version
mojo build /usr/share/mojo/samples/hello.mojo -o /tmp/hello && /tmp/hello
python3 /usr/share/mojo/samples/max_graph_smoke.py
mojo build on target needs a target toolchain that the wheel cannot bundle —
packagegroup-core-buildessential, which packagegroup-mojo-toolchain pulls
in. glibc-dev and libgcc-dev alone are not enough: the wheel ships lld but
no compiler driver for it to be invoked from. Images that only need to run
inference should install packagegroup-mojo-runtime and skip the toolchain.
mojo-image enables empty-root-password ssh login so the test harness can
reach it. It is a sample and test image; do not copy that configuration into a
production image.
Khem Raj khem.raj@oss.qualcomm.com
Send patches as pull requests to
qualcomm-linux/meta-mojo; see
CONTRIBUTING.md.