Commit 4392a6cf by nhynes Committed by Tianqi Chen

SGXify graph runtime (#937)

parent 68ea2c3e
Subproject commit 7e84e8b036a3ff5c0104a3da1f4c7eebf94396ec
Subproject commit d3f7fbb53e5b037c0f5bf6bd21871ccc720690cc
......@@ -64,7 +64,11 @@ class GraphRuntime : public ModuleNode {
void Init(const std::string& graph_json,
tvm::runtime::Module module,
TVMContext ctx) {
#ifndef _LIBCPP_SGX_NO_IOSTREAMS
std::istringstream is(graph_json);
#else
std::string is = graph_json;
#endif
dmlc::JSONReader reader(&is);
this->Load(&reader);
module_ = module;
......@@ -198,27 +202,19 @@ class GraphRuntime : public ModuleNode {
std::string key, value;
reader->BeginObject();
while (reader->NextObjectItem(&key)) {
reader->Read(&value);
if (key == "func_name") {
reader->Read(&value);
param->func_name = value;
bitmask |= 1;
} else if (key == "num_inputs") {
reader->Read(&value);
std::istringstream is(value);
is >> param->num_inputs;
param->num_inputs = strtoul(value.c_str(), nullptr, 10);
bitmask |= 2;
} else if (key == "num_outputs") {
reader->Read(&value);
std::istringstream is(value);
is >> param->num_outputs;
param->num_outputs = strtoul(value.c_str(), nullptr, 10);
bitmask |= 4;
} else if (key == "flatten_data") {
reader->Read(&value);
std::istringstream is(value);
is >> param->flatten_data;
param->flatten_data = strtoul(value.c_str(), nullptr, 10);
bitmask |= 8;
} else {
reader->Read(&value);
}
}
CHECK_EQ(bitmask, 1|2|4|8) << "invalid format";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment