[WEB][RUNTIME] TVM WebAssembly JS Runtime (#5506)
authorTianqi Chen <tqchen@users.noreply.github.com>
Thu, 7 May 2020 20:47:36 +0000 (13:47 -0700)
committerGitHub <noreply@github.com>
Thu, 7 May 2020 20:47:36 +0000 (13:47 -0700)
commit702fd0f0f4ef283dedac3e65e71455ca4661a8e3
treeec533af6f3c7dc190b0c8a269cdc69de9f44ef4e
parent54d47cc372b3b1165649e1b2e52c8f683b799c14
[WEB][RUNTIME] TVM WebAssembly JS Runtime (#5506)

* [WEB] Remove the old web runtime

* [WEB][RUNTIME] TVM WebAssembly Runtime

This PR introduces a brand new TVM web runtime based on the WASM standard API.
Main highlights:

- The new runtime is rewritten using the Typescript.
- The new runtime now directly interfaces with WebAssembly's standard API,
  instead of relying on emscripten's API.
  This change will make the js runtime more portable to runtime variants.
  For example, we could also try to make it interface with the tvm's rust runtime implementation.
- System library can be provided through WASI
  - We also build a hack to enable Emscripten to generate a WASI like
    bundle for runtime environment on the Web.
- The wasm generation now uses the mainlin LLVM.
- Dynamic link(dlopen) is not used due to limitation of wasm,
  instead we rely on the recent new RPC refactor to directly
  restart a new session for each wasm binary sent to the RPC.

* Address review comments

* Skip tensorcore test
51 files changed:
docs/api/python/contrib.rst
python/tvm/_ffi/libinfo.py
python/tvm/contrib/emcc.py [moved from python/tvm/contrib/emscripten.py with 65% similarity]
python/tvm/exec/rpc_proxy.py
tests/lint/check_file_type.py
tests/lint/rat-excludes
tests/scripts/task_python_docs.sh
tests/web/test_packed_func.js [deleted file]
tests/webgl/README.md [deleted file]
tests/webgl/test_local_gemm.py [deleted file]
tests/webgl/test_local_save_load.py [deleted file]
tests/webgl/test_local_topi_conv2d_nchw.py [deleted file]
tests/webgl/test_local_topi_dense.py [deleted file]
tests/webgl/test_local_topi_pooling.py [deleted file]
tests/webgl/test_local_topi_softmax.py [deleted file]
tests/webgl/test_remote_save_load.py [deleted file]
tests/webgl/test_static_webgl_library.html [deleted file]
tests/webgl/test_static_webgl_library.py [deleted file]
topi/tests/python/test_topi_conv2d_nhwc_winograd.py
web/.eslintignore [new file with mode: 0644]
web/.gitignore [new file with mode: 0644]
web/.jsdoc_conf.json [deleted file]
web/Makefile [new file with mode: 0644]
web/README.md
web/apps/browser/rpc_server.html [new file with mode: 0644]
web/apps/node/example.js [new file with mode: 0644]
web/apps/node/wasi_example.js [new file with mode: 0644]
web/apps/node/wasi_rpc_server.js [moved from web/example_rpc_node.js with 60% similarity]
web/emcc/decorate_as_wasi.py [moved from tests/webgl/test_local_multi_stage.py with 50% similarity]
web/emcc/preload.js [new file with mode: 0644]
web/emcc/tvmjs_support.cc [new file with mode: 0644]
web/emcc/wasm_runtime.cc [new file with mode: 0644]
web/example_rpc.html [deleted file]
web/package.json [new file with mode: 0644]
web/rollup.config.js [moved from web/.eslintrc.js with 69% similarity]
web/src/ctypes.ts [new file with mode: 0644]
web/src/environment.ts [new file with mode: 0644]
web/src/index.ts [new file with mode: 0644]
web/src/memory.ts [new file with mode: 0644]
web/src/rpc_server.ts [new file with mode: 0644]
web/src/runtime.ts [new file with mode: 0644]
web/src/support.ts [new file with mode: 0644]
web/src/types.ts [new file with mode: 0644]
web/tests/node/test_module_load.js [moved from tests/web/test_module_load.js with 64% similarity]
web/tests/node/test_ndarray.js [moved from tests/web/test_basic.js with 55% similarity]
web/tests/node/test_packed_func.js [new file with mode: 0644]
web/tests/python/prepare_test_libs.py [moved from tests/web/prepare_test_libs.py with 69% similarity]
web/tests/python/websock_rpc_test.py [moved from tests/web/websock_rpc_test.py with 55% similarity]
web/tsconfig.json [new file with mode: 0644]
web/tvm_runtime.js [deleted file]
web/web_runtime.cc [deleted file]