This experimental sample demonstrates one way to target the web platform with IREE. The output artifact is a web page containing an interactive MNIST digits classifier.
install
target with CMake)emsdk_env.bat
)bash ./build_static_emscripten_demo.sh
To rebuild most parts of the demo (C runtime, sample HTML, CMake config, etc.), just control + C
to stop the local webserver and rerun the script.
This MNIST model, also used in the Vision sample, is compiled using the “static library” output setting of IREE's compiler (see the Static library sample). The resulting .h
and .o
files are compiled together with main.c
, while the .vmfb
is embedded into a C file that is similarly linked in.
Emscripten is used (via the emcmake
CMake wrapper) to compile the output binary into WebAssembly and JavaScript files.
The provided index.html
file can be served together with the output .js
and .wasm
files.
TODO(scotttodd): this is incomplete - more changes are needed to the C runtime