Skip to content

Commit ebbe481

Browse files
tqchenAWS Neo
authored and
AWS Neo
committed
Fix Web Build after CMake transition. (apache#2407)
1 parent f09a151 commit ebbe481

File tree

8 files changed

+19
-18
lines changed

8 files changed

+19
-18
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cpptest:
3232
EMCC_FLAGS= -std=c++11 -DDMLC_LOG_STACK_TRACE=0\
3333
-Oz -s RESERVED_FUNCTION_POINTERS=2 -s MAIN_MODULE=1 -s NO_EXIT_RUNTIME=1\
3434
-s TOTAL_MEMORY=1073741824\
35-
-s EXTRA_EXPORTED_RUNTIME_METHODS="['cwrap','getValue','setValue','addFunction']"\
35+
-s EXTRA_EXPORTED_RUNTIME_METHODS="['addFunction','cwrap','getValue','setValue']"\
3636
-s USE_GLFW=3 -s USE_WEBGL2=1 -lglfw\
3737
$(INCLUDE_FLAGS)
3838

python/tvm/exec/rpc_proxy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def find_example_resource():
1717
index_page = os.path.join(base_path, "web/example_rpc.html")
1818
js_files = [
1919
os.path.join(base_path, "web/tvm_runtime.js"),
20-
os.path.join(base_path, "lib/libtvm_web_runtime.js"),
21-
os.path.join(base_path, "lib/libtvm_web_runtime.js.mem")
20+
os.path.join(base_path, "build/libtvm_web_runtime.js"),
21+
os.path.join(base_path, "build/libtvm_web_runtime.js.mem")
2222
]
2323
for fname in [index_page] + js_files:
2424
if not os.path.exists(fname):

tests/web/prepare_test_libs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def prepare_test_libs(base_path):
1818

1919
if __name__ == "__main__":
2020
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
21-
prepare_test_libs(os.path.join(curr_path, "../../lib"))
21+
prepare_test_libs(os.path.join(curr_path, "../../build"))

tests/web/test_basic.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Load Emscripten Module, need to change path to root/lib
1+
// Load Emscripten Module, need to change path to root/build
22
const path = require("path");
3-
process.chdir(path.join(__dirname, "../../lib"));
4-
var Module = require("../../lib/libtvm_web_runtime.js");
3+
process.chdir(path.join(__dirname, "../../build"));
4+
var Module = require("../../build/libtvm_web_runtime.js");
55
// Bootstrap TVMruntime with emscripten module.
66
const tvm_runtime = require("../../web/tvm_runtime.js");
77
const tvm = tvm_runtime.create(Module);

tests/web/test_module_load.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Load Emscripten Module, need to change path to root/lib
22
const path = require("path");
3-
process.chdir(path.join(__dirname, "../../lib"));
4-
var Module = require("../../lib/test_module.js");
3+
process.chdir(path.join(__dirname, "../../build"));
4+
var Module = require("../../build/test_module.js");
55
// Bootstrap TVMruntime with emscripten module.
66
const tvm_runtime = require("../../web/tvm_runtime.js");
77
const tvm = tvm_runtime.create(Module);

tests/web/test_packed_func.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Load Emscripten Module, need to change path to root/lib
1+
// Load Emscripten Module, need to change path to root/build
22
const path = require("path");
3-
process.chdir(path.join(__dirname, "../../lib"));
4-
var Module = require("../../lib/libtvm_web_runtime.js");
3+
process.chdir(path.join(__dirname, "../../build"));
4+
var Module = require("../../build/libtvm_web_runtime.js");
55
// Bootstrap TVMruntime with emscripten module.
66
const tvm_runtime = require("../../web/tvm_runtime.js");
77
const tvm = tvm_runtime.create(Module);

web/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ to do so, make sure we set the environment correctly as in previous section and
5959
make web
6060
```
6161

62-
This will create ```lib/libtvm_web_runtime.bc``` and ```lib/libtvm_web_runtime.js```.
62+
This will create ```build/libtvm_web_runtime.bc``` and ```build/libtvm_web_runtime.js```.
6363

6464
## Use TVM to Generate Javascript Library
6565

@@ -87,11 +87,11 @@ def prepare_test_libs(base_path):
8787

8888
if __name__ == "__main__":
8989
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
90-
prepare_test_libs(os.path.join(curr_path, "../../lib"))
90+
prepare_test_libs(os.path.join(curr_path, "../../build"))
9191
```
9292

9393
In this workflow, we use TVM to generate a ```.bc``` file and statically link
94-
that with the ```lib/libtvm_web_runtime.bc```(emscripten.create_js will help you do that).
94+
that with the ```build/libtvm_web_runtime.bc```(emscripten.create_js will help you do that).
9595
The result js library is a library that contains both TVM runtime and the compiled function.
9696

9797

@@ -101,10 +101,10 @@ The following code snippet from [tests/web/test_module_load.js](https://github.c
101101
how to run the compiled library.
102102

103103
```js
104-
// Load Emscripten Module, need to change path to root/lib
104+
// Load Emscripten Module, need to change path to root/build
105105
const path = require("path");
106-
process.chdir(path.join(__dirname, "../../lib"));
107-
var Module = require("../../lib/test_module.js");
106+
process.chdir(path.join(__dirname, "../../buld"));
107+
var Module = require("../../build/test_module.js");
108108
// Bootstrap TVMruntime with emscripten module.
109109
const tvm_runtime = require("../../web/tvm_runtime.js");
110110
const tvm = tvm_runtime.create(Module);

web/web_runtime.cc

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "../src/runtime/module_util.cc"
1212
#include "../src/runtime/system_lib_module.cc"
1313
#include "../src/runtime/module.cc"
14+
#include "../src/runtime/ndarray.cc"
1415
#include "../src/runtime/registry.cc"
1516
#include "../src/runtime/file_util.cc"
1617
#include "../src/runtime/dso_module.cc"

0 commit comments

Comments
 (0)