Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
794bf7fe
Unverified
Commit
794bf7fe
authored
Jan 09, 2019
by
Tianqi Chen
Committed by
GitHub
Jan 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Web Build after CMake transition. (#2407)
parent
64e5681d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
18 deletions
+19
-18
Makefile
+1
-1
python/tvm/exec/rpc_proxy.py
+2
-2
tests/web/prepare_test_libs.py
+1
-1
tests/web/test_basic.js
+3
-3
tests/web/test_module_load.js
+2
-2
tests/web/test_packed_func.js
+3
-3
web/README.md
+6
-6
web/web_runtime.cc
+1
-0
No files found.
Makefile
View file @
794bf7fe
...
...
@@ -32,7 +32,7 @@ cpptest:
EMCC_FLAGS
=
-std
=
c++11
-DDMLC_LOG_STACK_TRACE
=
0
\
-Oz
-s
RESERVED_FUNCTION_POINTERS
=
2
-s
MAIN_MODULE
=
1
-s
NO_EXIT_RUNTIME
=
1
\
-s
TOTAL_MEMORY
=
1073741824
\
-s
EXTRA_EXPORTED_RUNTIME_METHODS
=
"['
cwrap','getValue','setValue','addFunction
']"
\
-s
EXTRA_EXPORTED_RUNTIME_METHODS
=
"['
addFunction','cwrap','getValue','setValue
']"
\
-s
USE_GLFW
=
3
-s
USE_WEBGL2
=
1
-lglfw
\
$(INCLUDE_FLAGS)
...
...
python/tvm/exec/rpc_proxy.py
View file @
794bf7fe
...
...
@@ -17,8 +17,8 @@ def find_example_resource():
index_page
=
os
.
path
.
join
(
base_path
,
"web/example_rpc.html"
)
js_files
=
[
os
.
path
.
join
(
base_path
,
"web/tvm_runtime.js"
),
os
.
path
.
join
(
base_path
,
"
lib
/libtvm_web_runtime.js"
),
os
.
path
.
join
(
base_path
,
"
lib
/libtvm_web_runtime.js.mem"
)
os
.
path
.
join
(
base_path
,
"
build
/libtvm_web_runtime.js"
),
os
.
path
.
join
(
base_path
,
"
build
/libtvm_web_runtime.js.mem"
)
]
for
fname
in
[
index_page
]
+
js_files
:
if
not
os
.
path
.
exists
(
fname
):
...
...
tests/web/prepare_test_libs.py
View file @
794bf7fe
...
...
@@ -18,4 +18,4 @@ def prepare_test_libs(base_path):
if
__name__
==
"__main__"
:
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
prepare_test_libs
(
os
.
path
.
join
(
curr_path
,
"../../
lib
"
))
prepare_test_libs
(
os
.
path
.
join
(
curr_path
,
"../../
build
"
))
tests/web/test_basic.js
View file @
794bf7fe
// Load Emscripten Module, need to change path to root/
lib
// Load Emscripten Module, need to change path to root/
build
const
path
=
require
(
"path"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
lib
"
));
var
Module
=
require
(
"../../
lib
/libtvm_web_runtime.js"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
build
"
));
var
Module
=
require
(
"../../
build
/libtvm_web_runtime.js"
);
// Bootstrap TVMruntime with emscripten module.
const
tvm_runtime
=
require
(
"../../web/tvm_runtime.js"
);
const
tvm
=
tvm_runtime
.
create
(
Module
);
...
...
tests/web/test_module_load.js
View file @
794bf7fe
// Load Emscripten Module, need to change path to root/lib
const
path
=
require
(
"path"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
lib
"
));
var
Module
=
require
(
"../../
lib
/test_module.js"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
build
"
));
var
Module
=
require
(
"../../
build
/test_module.js"
);
// Bootstrap TVMruntime with emscripten module.
const
tvm_runtime
=
require
(
"../../web/tvm_runtime.js"
);
const
tvm
=
tvm_runtime
.
create
(
Module
);
...
...
tests/web/test_packed_func.js
View file @
794bf7fe
// Load Emscripten Module, need to change path to root/
lib
// Load Emscripten Module, need to change path to root/
build
const
path
=
require
(
"path"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
lib
"
));
var
Module
=
require
(
"../../
lib
/libtvm_web_runtime.js"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
build
"
));
var
Module
=
require
(
"../../
build
/libtvm_web_runtime.js"
);
// Bootstrap TVMruntime with emscripten module.
const
tvm_runtime
=
require
(
"../../web/tvm_runtime.js"
);
const
tvm
=
tvm_runtime
.
create
(
Module
);
...
...
web/README.md
View file @
794bf7fe
...
...
@@ -59,7 +59,7 @@ to do so, make sure we set the environment correctly as in previous section and
make web
```
This will create
```
lib/libtvm_web_runtime.bc```
and
```lib
/libtvm_web_runtime.js```
.
This will create
```
build/libtvm_web_runtime.bc```
and
```build
/libtvm_web_runtime.js```
.
## Use TVM to Generate Javascript Library
...
...
@@ -87,11 +87,11 @@ def prepare_test_libs(base_path):
if
__name__
==
"__main__"
:
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
prepare_test_libs
(
os
.
path
.
join
(
curr_path
,
"../../
lib
"
))
prepare_test_libs
(
os
.
path
.
join
(
curr_path
,
"../../
build
"
))
```
In this workflow, we use TVM to generate a
```.bc```
file and statically link
that with the
```
lib
/libtvm_web_runtime.bc```
(emscripten.create_js will help you do that).
that with the
```
build
/libtvm_web_runtime.bc```
(emscripten.create_js will help you do that).
The result js library is a library that contains both TVM runtime and the compiled function.
...
...
@@ -101,10 +101,10 @@ The following code snippet from [tests/web/test_module_load.js](https://github.c
how to run the compiled library.
```
js
// Load Emscripten Module, need to change path to root/
lib
// Load Emscripten Module, need to change path to root/
build
const
path
=
require
(
"path"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
lib
"
));
var
Module
=
require
(
"../../
lib
/test_module.js"
);
process
.
chdir
(
path
.
join
(
__dirname
,
"../../
buld
"
));
var
Module
=
require
(
"../../
build
/test_module.js"
);
// Bootstrap TVMruntime with emscripten module.
const
tvm_runtime
=
require
(
"../../web/tvm_runtime.js"
);
const
tvm
=
tvm_runtime
.
create
(
Module
);
...
...
web/web_runtime.cc
View file @
794bf7fe
...
...
@@ -11,6 +11,7 @@
#include "../src/runtime/module_util.cc"
#include "../src/runtime/system_lib_module.cc"
#include "../src/runtime/module.cc"
#include "../src/runtime/ndarray.cc"
#include "../src/runtime/registry.cc"
#include "../src/runtime/file_util.cc"
#include "../src/runtime/dso_module.cc"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment