Platform Support
A reference that gathers, on one page, “how far each target has been verified” for the targets generated by
griffith deploy codegen-c / codegen-cuda / codegen-metal / codegen-web. For how to use the deploy kit as a whole, see the
Deploy Kit Quickstart, and for the bundle format see the Deploy bundle spec.
Verification levels
Section titled “Verification levels”The “verification” columns on this page use three levels. They exist so that we never write “it works” for something we have not verified.
| Level | Meaning |
|---|---|
| Measured and verified | Built and run on real hardware, with integer-exact agreement with ir/simulate.py (the golden model) confirmed by a test or a verify command |
| Build confirmed only | Cross-compilation is confirmed to succeed, but nothing was run in that environment (integer agreement is unverified) |
| Theoretically possible by standards conformance (unverified) | The code handles it through branches or macros, but there is no build or run record |
Supported compilers (C runtime, C99)
Section titled “Supported compilers (C runtime, C99)”| Compiler | Verification level | Basis |
|---|---|---|
clang (environments where cc resolves to clang; macOS by default) | Measured and verified | Host runs and benchmark measurements, plus cross-compilation (table below) |
gcc (environments where cc / gcc resolves to gcc) | Build confirmed only | Confirmed that a host build with -Wall -Wextra -Werror succeeds (reconfirmed on Linux with gcc 9.4.0). Cross targets (-target <triple>) are out of scope because that is clang-only syntax |
clang (cross for Windows: x86_64-pc-windows-msvc / x86_64-w64-windows-gnu) | Build confirmed only | Confirmed down to object generation from Apple clang with -ffreestanding -DMDL_NO_LIBC. Running under a real cl.exe / MinGW is unverified |
MSVC (real cl.exe) / real MinGW gcc | Theoretically possible by standards conformance (unverified) | mdl_simd.h only has an SSE2 detection branch for the MSVC dialect (_M_IX86_FP). There is no build or run record on real machines |
The C runtime’s dependencies are just two C99 standard headers (<stdint.h> / <stddef.h>), and the only libc functions are memcpy / memset
(-DMDL_NO_LIBC switches to our own implementations, so libc is not needed at all).
The range of compilers available for verification is also limited. The clang at hand (Apple clang 21.0.0) has cross backends only for the ARM / AArch64 family and the x86 family, with no backend for RISC-V / MIPS / WASM / Xtensa / MSP430. These are “unverified” not because of any constraint in the code but because there was no verification environment.
Supported OSes and execution environments
Section titled “Supported OSes and execution environments”| Environment | Verification level | Basis |
|---|---|---|
| macOS (Apple Silicon) | Measured and verified | Host runs and benchmark measurements on an Apple M3. Also the verification environment for the Metal and Web runtimes |
| Linux (x86_64 / i386, native execution) | Measured and verified | Cross-compiled, run, and confirmed down to numeric agreement |
Bare metal (Cortex-M0 / M0+ / M3 / M4 / M4F / M7 / M33, Cortex-A family, -ffreestanding -DMDL_NO_LIBC) | Build confirmed only | Cross-compilation passes only (nothing run on hardware) |
Windows (core inference only: mdl_kernels.c + the generated model) | Build confirmed only | Down to object generation via the clang cross above. The parallel helper mdl_threads.c is pthread-only and not supported on Windows |
| Browser (Chromium, WASM) | Measured and verified | griffith deploy verify-web. The only verified browser is Chromium. This is the TS / AssemblyScript Web runtime, a different thing from the C runtime’s freestanding WASM build |
| ESP32 (Xtensa, ESP-IDF) | Measured and verified (activity-recognition dense). The 128px convolutional face detector does not fit (DRAM overflow) | Run on a real ESP32-D0WDQ6 (240 MHz, 4MB flash, no PSRAM) with ESP-IDF v5.4-dev. All 50 samples of activity recognition k600 / k2400 / k6000 and MNIST matched as integers (default compression = lut_flat: k600 290.7 µs, k2400 782.2 µs, k6000 12.69 ms, MNIST 324.7 µs; uncompressed: k600 410.9 µs, k6000 26.60 ms). The output still matches the uncompressed one as integers. Face detection overflows dram0_0_seg by 1,394,696 B |
| iOS simulator (iPhone 17, iOS 26.5) | Measured and verified | Output matched as integers on five models (XOR, two activity-recognition models, face detection, MNIST). Times are host CPU (Apple Silicon) values, not real-device values |
| iOS device (iPhone 17, iOS 26.6.2) | Integer match confirmed on a real device | The outputs of five models (XOR, activity recognition k600 / k6000, MNIST, face detection) matched ir/simulate.py as integers (Release). Medians: activity recognition k6000 (lut_flat, 15,124 gates) 8.07 µs, face detection (1,279 gates, 8 synthetic images) 0.803 ms. One measurement per model. An unsigned Release build (generic/platform=iOS) also succeeds |
| Android | Theoretically possible by standards conformance (unverified) | Intended to be embedded via the NDK, but there is no real-device build or run record yet |
Supported CPU architectures: the portability contract
Section titled “Supported CPU architectures: the portability contract”The conclusion first. Any target that has a C99 (cross) compiler should work, in principle. The “supported architectures” are not a list of separate implementations prepared per instruction set; they are merely a list of the verification record of whether the same single C99 source goes through as is. The grounds are as follows.
- The core is strict C99. The only headers it depends on are
<stdint.h>/<stddef.h>, both of which the C standard obliges even freestanding implementations to provide.-DMDL_NO_LIBCalso removes the need for libc (it builds without host headers under-ffreestanding) - Architecture-specific code (NEON / SSE2 / AVX2 intrinsics and detection macros) is isolated in the single file
mdl_simd.h. On unsupported architectures, or with-DMDL_NO_SIMD, it automatically falls back to a bit-identical scalar implementation - No endianness or alignment assumptions are introduced. Bit-plane word operations are all defined by bit position (
x>>5,x&31), and the core contains not a single pointer cast that reinterprets a byte sequence in memory as another integer width - SIMD only makes it faster and does not affect correctness. That the SIMD path and a scalar-forced build agree bit for bit on real models is pinned by a test
- It is pinned likewise that the generated code (
model.c/model.h) contains no architecture-specific code
The contract is enforced mechanically by the following checks.
| What is checked | Corresponding test |
|---|---|
Architecture detection macros and inline asm do not exist outside mdl_simd.h | TestSIMDContract |
| The core has no byte-reinterpreting casts | TestSIMDContract |
| The SIMD path and the scalar path agree bit for bit on real models | TestSIMDContract |
| The generated code also has no architecture-specific code | TestSIMDContract |
| Only two dependency headers | TestFreestanding |
| No heap allocation, floating point, or I/O | TestFreestanding |
A libc-free build (-DMDL_NO_LIBC -ffreestanding) goes through | TestFreestanding |
The tests are in tests/deploy/test_c_portability.py.
Verification record (by use case)
Section titled “Verification record (by use case)”Of the range that “should in principle work” under the contract, this groups what was actually confirmed down to a build or a run by use case.
The source of truth is CROSS_TARGETS in the same test, and backends the clang at hand does not have are skipped automatically.
| Use-case group | Verification level | Target triples included | Representative devices |
|---|---|---|---|
| Embedded ARM (Cortex-M family / Cortex-A family) | Build confirmed only | thumbv6m-none-eabi, armv7m-none-eabi, armv7a-none-eabi, thumbv7em-none-eabi, armv8m.main-none-eabi, aarch64-none-elf, aarch64_be-none-elf (big-endian) | Cortex-M0 / M0+ / M3 / M4 / M4F / M7 / M33 (STM32 and others), Cortex-A family |
| Linux x86 (i386 / x86_64) | Run and confirmed down to numeric agreement | i386-unknown-linux-gnu, x86_64-unknown-linux-gnu | PCs / servers |
| aarch64 host native | Run and confirmed down to numeric agreement (including NEON versus scalar agreement) | (host aarch64) | Apple Silicon (measured on M3); iPhone / Android / Raspberry Pi are the same architecture |
| Windows (core inference only) | Build confirmed only (cross, -ffreestanding -DMDL_NO_LIBC) | x86_64-pc-windows-msvc, x86_64-w64-windows-gnu | Windows (MSVC / MinGW ABI). Running on real machines is unverified |
| RISC-V / MIPS / WASM (C version) | Unverified because no verification environment exists (expected to work under the contract) | riscv32-unknown-elf, riscv64-unknown-elf, riscv64-unknown-linux-gnu, mipsel-unknown-linux-gnu, wasm32-unknown-unknown | RISC-V embedded / Linux, MIPS Linux, freestanding WASM |
| Xtensa (ESP32) | Run, integer agreement confirmed (activity-recognition dense; the 128px convolutional model does not fit, DRAM overflow) | (xtensa-esp-elf 13.2.0 bundled with ESP-IDF v5.4-dev) | ESP32-D0WDQ6 (no PSRAM). PSRAM boards are unverified |
About the Windows parallel helper: mdl_threads.c (mdl_run_pool and others) is pthread-only and not supported on Windows.
The core (mdl_kernels.c + the generated model) cross-builds on Windows too, but to use multiple cores you call mdl_infer_ctx
(re-entrant when the contexts differ) directly from the caller’s own threads (CreateThread and the like).
SIMD paths (by detection macro)
Section titled “SIMD paths (by detection macro)”The SIMD path is selected automatically by macros at compile time, and falls back to scalar where disabled (mdl_simd.h).
The integer output is exactly identical on every path, which is pinned by a test as part of the portability contract above.
| Path | Detection macro | Verification level | Basis |
|---|---|---|---|
| NEON | __ARM_NEON / __ARM_NEON__ | Measured and verified | Run on an Apple M3. Integer-output agreement with the scalar path is pinned by a test (this Mac’s default build is NEON) |
| SSE2 | __SSE2__, or _M_IX86_FP >= 2 (MSVC dialect) | Build confirmed only | The x86_64 cross-compile goes through, but there is no record of running the SSE2 path itself on real hardware |
| Scalar (fallback) | When neither of the above is present, or -DMDL_NO_SIMD | Measured and verified | The baseline path for all measurements. Also the comparison target for the SIMD path |
| AVX2 | __AVX2__ (MSVC unsupported) | Measured and verified | Real Xeon W-1270P (Comet Lake, 8C16T), gcc 9.4.0. For dense and conv models alike, the AVX2 build and the scalar / SSE2 builds produce byte-identical output. This verification is a manual A/B and is not a standing test. You can go back to SSE2 with -DMDL_NO_AVX2 / -mno-avx2 |
| AVX-512 | — | Not implemented | The verification machine has no AVX-512 and cannot run it, so implementation was put off |
What is unsupported compared with similar libraries
Section titled “What is unsupported compared with similar libraries”An honest inventory of what runtimes in the class of ONNX Runtime / TFLite / llama.cpp usually have, but this one does not at present. “Unsupported” is not “impossible” (we write only standard C99, so if a verification environment is available the build will likely go through).
| Item | Status | Reason |
|---|---|---|
| Run verification on RISC-V / MIPS hardware (or QEMU) | Unsupported | No cross toolchain at hand. Running also needs an emulator or real hardware |
Build and run on real Windows (cl.exe / MinGW) | Unsupported | Confirmed down to object generation via clang cross, but no Windows machine is at hand |
| Real Android device (via the NDK) | Unsupported | An embedding procedure is envisioned, but there is no real-device or NDK build record |
| A convolutional model (128px face detection) on ESP32 | Not supported yet | On a plain ESP32 without PSRAM, MDL_CTX_BYTES of 1,544,000 B does not fit in static DRAM (180,736 B). PSRAM boards are unverified (Run on ESP32) |
| MSP430 | Unsupported | Needs TI’s toolchain |
WASM (C version, freestanding build for wasm32-unknown-unknown) | Unsupported | emcc / wasi-sdk are not at hand. WASM for browsers is already measured and verified, but that is a different source from the C runtime |
| Prebuilt binaries distributed via npm / pip | Unsupported | This repository is source-only distribution (also by design: distributables are not split per instruction set) |
GPU: CUDA
Section titled “GPU: CUDA”| Item | Contents | Verification level |
|---|---|---|
| Verified GPU | RTX 4070 Ti (compute capability 8.9 = sm_89) | Measured and verified |
| Verified CUDA version | CUDA 12.8 | Measured and verified |
| Example build command | nvcc -O2 -arch=sm_89 -I. model_cuda.cu mdl_cuda.cu your_main.cu -o app | — |
| Other compute capabilities / CUDA versions | No minimum-requirement check in the code; it goes through if nvcc can interpret it | Theoretically possible by standards conformance (unverified) |
| Verify command | codegen-cuda only generates code; there is no subcommand equivalent to verify-cuda | — |
Flattened netlist lut_flat (--dense-flat auto / on) | Can be generated, but has not been run on real NVIDIA hardware (only a syntax check of the generated code; on Metal, integer agreement was confirmed on real hardware) | Unverified |
CUDA kernels’ formulas are shared with Metal (the __device__ / device difference is absorbed by a macro),
and integer agreement with the C version is pinned by a test.
GPU: Metal
Section titled “GPU: Metal”| Item | Contents | Verification level |
|---|---|---|
| Verified environment | Apple M3, macOS 26 series | Measured and verified |
| Toolchain requirements | clang++ and Metal.framework are enough (detected by being on macOS, clang++, and the existence of the runtime directory) | Measured and verified |
| Xcode’s metal toolchain | Not needed. Shaders are compiled from source at run time, so precompiling a .metallib is just an optional optimization (shorter cold start) | Measured and verified (run-time compile path) |
| Other Apple silicon (M1 / M2 / M4 and so on) | Expected to work since it is the same Metal API | Theoretically possible by standards conformance (unverified) |
The verify command is griffith deploy verify-metal (needs macOS + an Apple GPU + clang++).
Web (browser)
Section titled “Web (browser)”| Item | Contents | Verification level |
|---|---|---|
| Verified browser | Chromium | Measured and verified (griffith deploy verify-web) |
wasm-SIMD (release-simd.wasm) | The engine preferred by default. Where unsupported, it records the reason and automatically falls back to pure TS (js) | Measured and verified (output agreement of both engines, including the fallback, is pinned by a test) |
| Firefox / Safari alone | No individual measurement record | Theoretically possible by standards conformance (unverified) |
| Serving requirements | threads=1 is the default, so no SharedArrayBuffer is needed. Plain static serving without COOP/COEP headers works | Measured and verified |
HDL (FPGA / ASIC)
Section titled “HDL (FPGA / ASIC)”Output to Verilog / VHDL is a separate path from the deploy kit’s C / GPU / Web (griffith export-hdl), but it starts from the same IR.
It is verified by three-way equivalence (PyTorch hard eval, ir/simulate.py, HDL simulation).
| Item | Contents | Verification level |
|---|---|---|
| Verilog | Checks the generated output with iverilog (can run locally) | Measured and verified |
| VHDL | Checks the generated output with ghdl (ghdl is officially verified in CI / cloud containers) | Measured and verified |
| Real FPGA | Tang Nano 20K / DE0-CV and others | See the supported-boards table in Deploy to FPGA |
The procedure and the details of the check are in HDL Export.
Supported node kinds and unsupported features
Section titled “Supported node kinds and unsupported features”The IR node kinds the C runtime supports are conv2d / or_pool2d / upsample2d / permute / concat / group_sum /
lut_layer (n_inputs<=5) / flatten. Shapes outside the range raise at generation time (UnsupportedNode),
and nothing silently falls back to another path (so that unverified code is not shipped).
| Node | Supported range |
|---|---|
conv2d | General (any stride / padding; stride=1 with equal width takes the shared-shift-plane fast path) |
or_pool2d | kernel=2, stride=2, padding=0 only |
upsample2d | scale=2 (nearest neighbor) only |
permute | Channel axis only / the SpatialGroupSum form ([0,2,3,1] + group_sum fusion) |
concat | Channel axis (bit planes) / score vectors (a detection model’s multi-head output) |
group_sum | Plain sum / SpatialGroupSum fusion |
lut_layer | n_inputs <= 5 |
lut_flat | The flat dense netlist. griffith deploy codegen-c builds it at C-generation time with the default --dense-flat auto when the effective-gate reduction is at or above the threshold (bundle --dense-flat can also bake it into the bundle). Now it also runs on the Web (codegen-web flattens by default) and on CUDA / Metal (executing level by level in parallel; codegen-cuda / codegen-metal default to off, opt in with --dense-flat auto / on). It does not appear with --dense-flat off |
flatten | Pass-through |
The unsupported features that deserve particular attention are as follows.
- Box decoding for detection models (CenterNet peak extraction plus NMS) is not included. What the runtime returns is up to the score map, and everything after that is post-processing on the application side (see Prepare demo models for the procedure)
add/binarize/constant/ generic pool / generic upsample are not implemented (they do not appear in real models)
Related pages
Section titled “Related pages”- Deploy Kit Quickstart — the end-to-end procedure from IR through bundling and C generation to running
- Deploy bundle spec — the bundle format
- griffith CLI — all
griffith deploysubcommands - Run on ESP32 / Run on iPhone — on-device procedures