## Summary

This is an alternative implementation of a subset of the TVM runtime API (and
graph runtime) that focuses entirely on reducing code size, at the expense of
functionality (no tvm.extern(..) calls via PackedFunc, CPU only, etc). It might
be worth incrementally expanding the surface area if there's interest.

## Motivation

The motivation for this work was seeing what the minimal useful subset of the
TVM runtime is. This is relevant for e.g. super code-size constrained
applications in e.g. embedded/mobile. The current runtime is more like O(100KiB)
or so, so this might be compelling for some users.

The smaller surface area for auditing might make this relevant for
https://github.com/dmlc/tvm/issues/3159, or the usecases I was thinking about in
https://github.com/dmlc/tvm/issues/2523#issuecomment-459165815 re: the Rust
runtime.

## Analysis

The symbols in the tvm::minimalruntime space (i.e. excluding std:: and
picojson::) are about 5KiB, so I think there's a bunch of room here (i.e. we
could replace picojson:: with [`jsmn`](https://zserge.com/jsmn.html) or
something, and we could replace more of the `std::unordered_map` usage, etc with
custom primitives as well (similar to the `DynArray`).
You can view, comment on, or merge this pull request online at:

  https://github.com/dmlc/tvm/pull/3567

-- Commit Summary --

  * [RFC] [Contrib] Minimal runtime (~12kb .text on ARMv7/x86) for subset of 
TVM models

-- File Changes --

    M CMakeLists.txt (2)
    A cmake/modules/contrib/MinimalRuntime.cmake (23)
    A include/tvm/contrib/minimalruntime.h (42)
    A src/contrib/minimalruntime/README.md (22)
    A src/contrib/minimalruntime/minimalgraphruntime.cc (399)
    A src/contrib/minimalruntime/minimalgraphruntime.h (131)
    A src/contrib/minimalruntime/minimalruntime.cc (53)
    A src/contrib/minimalruntime/minimalruntime_api.cc (53)
    A src/contrib/minimalruntime/minimalruntime_api.h (45)
    A src/contrib/minimalruntime/minimalvector.h (101)
    A src/contrib/minimalruntime/picojson.h (1204)
    A tests/cpp/contrib_minimalruntime_test.cc (135)

-- Patch Links --

https://github.com/dmlc/tvm/pull/3567.patch
https://github.com/dmlc/tvm/pull/3567.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dmlc/tvm/pull/3567

Reply via email to