Skip to content

Commit cd06dfa

Browse files
committed
[RUNTIME] Remove runtime, rely on tvm only (apache#38)
1 parent 7b33b48 commit cd06dfa

File tree

19 files changed

+66
-1248
lines changed

19 files changed

+66
-1248
lines changed

nnvm/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ else
5353
NO_WHOLE_ARCH= --no-whole-archive
5454
endif
5555

56-
all: lib/libnnvm.a lib/libnnvm_top.$(SHARED_LIBRARY_SUFFIX) lib/libnnvm_top_runtime.$(SHARED_LIBRARY_SUFFIX)
56+
all: lib/libnnvm.a lib/libnnvm_top.$(SHARED_LIBRARY_SUFFIX)
5757

5858
SRC = $(wildcard src/*.cc src/c_api/*.cc src/core/*.cc src/pass/*.cc)
59-
SRC_TOP = $(wildcard src/top/*/*.cc src/runtime/*.cc src/compiler/*.cc src/compiler/*/*.cc)
59+
SRC_TOP = $(wildcard src/top/*/*.cc src/compiler/*.cc src/compiler/*/*.cc)
6060
ALL_OBJ = $(patsubst %.cc, build/%.o, $(SRC))
6161
TOP_OBJ = $(patsubst %.cc, build/%.o, $(SRC_TOP))
6262
ALL_DEP = $(ALL_OBJ)
@@ -78,10 +78,6 @@ lib/libnnvm_top.$(SHARED_LIBRARY_SUFFIX): lib/libnnvm.a ${TOP_OBJ}
7878
@mkdir -p $(@D)
7979
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o, $^) $(LDFLAGS) -Wl,${WHOLE_ARCH} lib/libnnvm.a -Wl,${NO_WHOLE_ARCH}
8080

81-
lib/libnnvm_top_runtime.$(SHARED_LIBRARY_SUFFIX): deploy/nnvm_runtime.cc
82-
@mkdir -p $(@D)
83-
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.cc, $^) $(LDFLAGS)
84-
8581
cython:
8682
cd python; python setup.py build_ext --inplace
8783

nnvm/deploy/REAMD.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

nnvm/deploy/nnvm_runtime.cc

Lines changed: 0 additions & 13 deletions
This file was deleted.

nnvm/python/nnvm/graph.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ def symbol(self):
174174
check_call(_LIB.NNGraphGetSymbol(self.handle, ctypes.byref(shandle)))
175175
return Symbol(shandle)
176176

177+
def _tvm_graph_json(self):
178+
"""Get TVM graph json"""
179+
return self.apply("SaveJSON").json_attr("json")
180+
177181
@property
178182
def index(self):
179183
if not self._index:

nnvm/python/nnvm/runtime.py

Lines changed: 0 additions & 111 deletions
This file was deleted.

nnvm/src/compiler/graph_fuse.cc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,31 @@
1414
#include <tvm/runtime/packed_func.h>
1515
#include <tvm/lowered_func.h>
1616
#include "./compile_engine.h"
17-
#include "../runtime/graph_executor.h"
17+
#include "../../tvm/src/runtime/graph/graph_runtime.h"
1818

1919
namespace nnvm {
2020
namespace compiler {
2121

22+
using tvm::runtime::TVMOpParam;
23+
24+
// parser
25+
inline void TVMOpParamParser(nnvm::NodeAttrs* attrs) {
26+
TVMOpParam param;
27+
param.Init(attrs->dict);
28+
attrs->parsed = std::move(param);
29+
}
30+
31+
NNVM_REGISTER_OP(tvm_op)
32+
.set_attr_parser(TVMOpParamParser)
33+
.set_num_inputs([](const NodeAttrs& attrs) {
34+
const TVMOpParam& param = nnvm::get<TVMOpParam>(attrs.parsed);
35+
return param.num_inputs;
36+
})
37+
.set_num_outputs([](const NodeAttrs& attrs) {
38+
const TVMOpParam& param = nnvm::get<TVMOpParam>(attrs.parsed);
39+
return param.num_outputs;
40+
});
41+
2242
using namespace tvm;
2343

2444
// The single fuse rule.

0 commit comments

Comments
 (0)