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
6a0a8e98
Commit
6a0a8e98
authored
Dec 31, 2017
by
Tianqi Chen
Committed by
GitHub
Dec 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WEB] update web runtime to latest emcc (#742)
parent
5f1816db
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
Makefile
+4
-2
python/tvm/contrib/emscripten.py
+8
-6
web/tvm_runtime.js
+8
-2
No files found.
Makefile
View file @
6a0a8e98
...
...
@@ -29,8 +29,10 @@ INCLUDE_FLAGS = -Iinclude -I$(DLPACK_PATH)/include -I$(DMLC_CORE_PATH)/include -
CFLAGS
=
-std
=
c++11
-Wall
-O2
$(INCLUDE_FLAGS)
-fPIC
FRAMEWORKS
=
OBJCFLAGS
=
-fno-objc-arc
EMCC_FLAGS
=
-s
RESERVED_FUNCTION_POINTERS
=
2
-s
NO_EXIT_RUNTIME
=
1
-s
MAIN_MODULE
=
1
-DDMLC_LOG_STACK_TRACE
=
0
\
-std
=
c++11
-Oz
$(INCLUDE_FLAGS)
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
EXTRA_EXPORTED_RUNTIME_METHODS
=
"['cwrap','getValue','setValue','addFunction']"
\
$(INCLUDE_FLAGS)
# llvm configuration
ifdef
LLVM_CONFIG
...
...
python/tvm/contrib/emscripten.py
View file @
6a0a8e98
...
...
@@ -26,13 +26,16 @@ def create_js(output,
The compile string.
"""
cmd
=
[
cc
]
cmd
+=
[
"-Oz"
]
if
not
side_module
:
cmd
+=
[
"-s"
,
"RESERVED_FUNCTION_POINTERS=2"
]
cmd
+=
[
"-s"
,
"NO_EXIT_RUNTIME=1"
]
cmd
+=
[
"-Oz"
]
cmd
+=
[
"-o"
,
output
]
if
side_module
:
extra_methods
=
[
'cwrap'
,
'getValue'
,
'setValue'
,
'addFunction'
]
cfg
=
"["
+
(
','
.
join
(
"
\'
%
s
\'
"
%
x
for
x
in
extra_methods
))
+
"]"
cmd
+=
[
"-s"
,
"EXTRA_EXPORTED_RUNTIME_METHODS="
+
cfg
]
else
:
cmd
+=
[
"-s"
,
"SIDE_MODULE=1"
]
cmd
+=
[
"-o"
,
output
]
objects
=
[
objects
]
if
isinstance
(
objects
,
str
)
else
objects
with_runtime
=
False
for
obj
in
objects
:
...
...
@@ -47,9 +50,8 @@ def create_js(output,
if
options
:
cmd
+=
options
args
=
' '
.
join
(
cmd
)
proc
=
subprocess
.
Popen
(
args
,
shell
=
True
,
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
(
out
,
_
)
=
proc
.
communicate
()
...
...
web/tvm_runtime.js
View file @
6a0a8e98
...
...
@@ -493,7 +493,8 @@ var tvm_runtime = tvm_runtime || {};
}
var
fptrInvokeCallback
=
null
;
var
fptrFreeCallback
=
null
;
if
(
typeof
Runtime
!==
"undefined"
)
{
if
(
typeof
Runtime
!==
"undefined"
&&
typeof
Runtime
.
addFunction
!==
"undefined"
)
{
fptrInvokeCallback
=
Runtime
.
addFunction
(
invokeCallback
);
fptrFreeCallback
=
Runtime
.
addFunction
(
freeCallback
);
}
...
...
@@ -513,7 +514,8 @@ var tvm_runtime = tvm_runtime || {};
*/
this
.
convertFunc
=
function
(
f
)
{
if
(
isPackedFunc
(
f
))
return
f
;
CHECK
(
fptrInvokeCallback
!==
null
,
"Emscripten Runtime is not available"
);
CHECK
(
fptrInvokeCallback
!==
null
,
"Emscripten Runtime addFunction is not available"
);
var
fid
;
if
(
freeFuncId
.
length
!=
0
)
{
fid
=
freeFuncId
.
pop
();
...
...
@@ -1086,7 +1088,11 @@ var tvm_runtime = tvm_runtime || {};
this
.
create
=
function
(
Module
)
{
var
tvm
=
{};
tvm
.
Module
=
Module
;
if
(
typeof
Module
.
addFunction
!==
"undefined"
)
{
tvm
.
Runtime
=
Module
;
}
else
{
tvm
.
Runtime
=
Module
.
Runtime
;
}
TVMRuntime
.
apply
(
tvm
);
return
tvm
;
};
...
...
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