Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master to spop branch #2

Merged
merged 28 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6bbab4c
Fix Canonical Simplifier (#5505)
kevinthesun May 4, 2020
7e88030
[RUST][RUNTIME] Fix workspace (#5503)
kazum May 4, 2020
95e06b3
[REFACTOR][RPC][PROCOTOL-CHANGE] Modularize the RPC infra (#5484)
tqchen May 5, 2020
70a5902
[RPC] Call sync in remote cpu to gpu copies (#5512)
tqchen May 5, 2020
32a094c
[QNN] Support CallNode inputs in qnn.concatenate (#5360)
mbaret May 5, 2020
4c9724d
[RPC][BUGFIX][BACKPORT-0.6] Fix bug in rpc ring buffer shrink (#5516)
tqchen May 5, 2020
7cbc0ca
[PATCH] [ring_buffer.h] Improve commentary for RingBuffer (#5518)
May 5, 2020
16cb571
[TFLITE]Nit: Function names made consitent (#5515)
siju-samuel May 5, 2020
7eb2451
fix prelu importer and add tests: (#5521)
May 6, 2020
e2bd43b
[RPC] Fix the multihop cpu case (#5522)
tqchen May 6, 2020
4a262ec
[RUNTIME] Improve PackedFunc robustness (#5517)
tqchen May 6, 2020
79e29ab
LRN only supports 4D tensors, remove it from alter_op_layout (#5520)
May 6, 2020
900254d
Fix an issue with Upsampling and update one test to hit the broken us…
May 6, 2020
149965a
[TFLITE]Select op support for tflite frontend (#5486)
siju-samuel May 7, 2020
b3730e5
[FRONTEND][TFLite] Fully connected op conversion made in sync with T…
May 7, 2020
e40b8bc
[TOPI][Winograd] Optimization of Conv2d Winograd algorithm on Tensor …
wsl-inspur May 7, 2020
f05b911
Cache PrimExpr instead of raw pointers in bound analyzer (#5533)
May 7, 2020
c238a86
fix a few bugs with shape inference and types in the onnx importer (#…
May 7, 2020
54d47cc
[Frontend][TFLite] ADD_N operator (#5474)
maheshambule May 7, 2020
702fd0f
[WEB][RUNTIME] TVM WebAssembly JS Runtime (#5506)
tqchen May 7, 2020
e29e222
[RELAY][ONNX]ReduceLogSumExp Operator support (#5453)
siju-samuel May 7, 2020
b4ee81d
[RPC][BUGFIX] Fix remote device sync (#5538)
tqchen May 7, 2020
19f322d
[Refactor][std::string --> String] IRModule is updated with String (#…
May 7, 2020
2b02d56
[RUNTIME] Store nullptr PackedFunc as nullptr for better error propag…
tqchen May 8, 2020
786dfb6
[Relay-TFLite] FP32 and Quantized Object Detection Model (#5479)
anijain2305 May 8, 2020
1b17b73
Changes to cpp_rpc to make it work on Android (+ Hexagon offloading) …
May 8, 2020
36d7fd9
Add Onnx Pad v11 (#5539)
May 8, 2020
2b7c2c6
Merge pull request #1 from apache/master
deepakbabel23 May 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
__pycache__/
*.py[cod]
*$py.class

*.S
# C extensions
*.so
*.ll

# Distribution / packaging
.Python
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/dmlc-core
Submodule dmlc-core updated 54 files
+38 −0 .github/workflows/githubci.yml
+0 −1 .gitignore
+0 −82 .travis.yml
+122 −111 CMakeLists.txt
+201 −13 LICENSE
+1 −1 README.md
+19 −6 appveyor.yml
+13 −0 cmake/Modules/FindASan.cmake
+13 −0 cmake/Modules/FindLSan.cmake
+13 −0 cmake/Modules/FindTSan.cmake
+13 −0 cmake/Modules/FindUBSan.cmake
+63 −0 cmake/Sanitizer.cmake
+4 −1 cmake/build_config.h.in
+1 −1 cmake/gtest_cmake.in
+1 −16 doc/Doxyfile
+23 −1 include/dmlc/base.h
+4 −1 include/dmlc/build_config_default.h
+4 −0 include/dmlc/concurrency.h
+18 −18 include/dmlc/concurrentqueue.h
+3 −2 include/dmlc/json.h
+24 −5 include/dmlc/logging.h
+1 −1 include/dmlc/omp.h
+10 −0 include/dmlc/optional.h
+106 −23 include/dmlc/parameter.h
+1 −3 include/dmlc/thread_group.h
+4 −2 include/dmlc/thread_local.h
+74 −46 include/dmlc/threadediter.h
+0 −2 make/dmlc.mk
+2 −2 scripts/lint.py
+12 −19 scripts/packages.mk
+0 −0 scripts/s390x/Dockerfile
+0 −0 scripts/s390x/build_via_cmake.sh
+1 −1 scripts/s390x/ci_build.sh
+0 −0 scripts/s390x/entrypoint.sh
+0 −32 scripts/setup_nvcc.sh
+65 −0 scripts/test_script.sh
+0 −3 scripts/travis/travis_before_cache.sh
+0 −9 scripts/travis/travis_osx_install.sh
+0 −57 scripts/travis/travis_script.sh
+0 −40 scripts/travis/travis_setup_env.sh
+0 −16 src/build_config.cc
+7 −3 src/data/csv_parser.h
+1 −1 test/logging_test.cc
+4 −0 test/unittest/CMakeLists.txt
+2 −1 test/unittest/unittest_env.cc
+30 −0 test/unittest/unittest_param.cc
+80 −56 test/unittest/unittest_parser.cc
+0 −1 test/unittest/unittest_thread_group.cc
+2 −2 test/unittest/unittest_threaditer.cc
+19 −15 test/unittest/unittest_threaditer_exc_handling.cc
+4 −0 tracker/dmlc_tracker/launcher.py
+7 −0 tracker/dmlc_tracker/ssh.py
+13 −0 tracker/dmlc_tracker/util.py
+4 −2 tracker/dmlc_tracker/yarn.py
10 changes: 10 additions & 0 deletions apps/cpp_rpc/rpc_env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ namespace {
namespace tvm {
namespace runtime {
RPCEnv::RPCEnv() {
#ifndef _WIN32
char cwd[PATH_MAX];
if (char *rc = getcwd(cwd, sizeof(cwd))) {
base_ = std::string(cwd) + "/rpc";
} else {
base_ = "./rpc";
}
#else
base_ = "./rpc";
#endif

mkdir(base_.c_str(), 0777);
TVM_REGISTER_GLOBAL("tvm.rpc.server.workpath").set_body([](TVMArgs args, TVMRetValue* rv) {
static RPCEnv env;
Expand Down
54 changes: 40 additions & 14 deletions apps/cpp_rpc/rpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <string>

#include "../../src/support/socket.h"
#include "../../src/runtime/rpc/rpc_session.h"
#include "../../src/runtime/rpc/rpc_endpoint.h"
#include "../../src/runtime/rpc/rpc_socket_impl.h"
#include "rpc_env.h"
#include "rpc_server.h"
Expand Down Expand Up @@ -66,6 +66,22 @@ static pid_t waitPidEintr(int* status) {
}
#endif

#ifdef __ANDROID__
static std::string getNextString(std::stringstream* iss) {
std::string str = iss->str();
size_t start = iss->tellg();
size_t len = str.size();
// Skip leading spaces.
while (start < len && isspace(str[start])) start++;

size_t end = start;
while (end < len && !isspace(str[end])) end++;

iss->seekg(end);
return str.substr(start, end-start);
}
#endif

/*!
* \brief RPCServer RPC Server class.
* \param host The hostname of the server, Default=0.0.0.0
Expand All @@ -86,7 +102,7 @@ class RPCServer {
tracker_addr_(std::move(tracker_addr)), key_(std::move(key)),
custom_addr_(std::move(custom_addr))
{

}

/*!
Expand All @@ -98,7 +114,7 @@ class RPCServer {
tracker_sock_.Close();
listen_sock_.Close();
} catch(...) {

}
}

Expand Down Expand Up @@ -144,7 +160,7 @@ class RPCServer {
}

int timeout = GetTimeOutFromOpts(opts);
#if defined(__linux__) || defined(__ANDROID__)
#if defined(__linux__) || defined(__ANDROID__)
// step 3: serving
if (timeout != 0) {
const pid_t timer_pid = fork();
Expand All @@ -164,9 +180,9 @@ class RPCServer {
int status = 0;
const pid_t finished_first = waitPidEintr(&status);
if (finished_first == timer_pid) {
kill(worker_pid, SIGKILL);
kill(worker_pid, SIGTERM);
} else if (finished_first == worker_pid) {
kill(timer_pid, SIGKILL);
kill(timer_pid, SIGTERM);
} else {
LOG(INFO) << "Child pid=" << finished_first << " unexpected, but still continue.";
}
Expand Down Expand Up @@ -197,7 +213,7 @@ class RPCServer {
try {
SpawnRPCChild(conn.sockfd, seconds(timeout));
} catch (const std::exception&) {

}
auto dur = high_resolution_clock::now() - start_time;

Expand All @@ -217,10 +233,10 @@ class RPCServer {
* \param opts Parsed options for socket
* \param ping_period Timeout for select call waiting
*/
void AcceptConnection(TrackerClient* tracker,
void AcceptConnection(TrackerClient* tracker,
support::TCPSocket* conn_sock,
support::SockAddr* addr,
std::string* opts,
support::SockAddr* addr,
std::string* opts,
int ping_period = 2) {
std::set<std::string> old_keyset;
std::string matchkey;
Expand Down Expand Up @@ -260,7 +276,12 @@ class RPCServer {

std::stringstream ssin(remote_key);
std::string arg0;
#ifndef __ANDROID__
ssin >> arg0;
#else
arg0 = getNextString(&ssin);
#endif

if (arg0 != expect_header) {
code = kRPCMismatch;
CHECK_EQ(conn.SendAll(&code, sizeof(code)), sizeof(code));
Expand All @@ -274,7 +295,11 @@ class RPCServer {
CHECK_EQ(conn.SendAll(&keylen, sizeof(keylen)), sizeof(keylen));
CHECK_EQ(conn.SendAll(server_key.c_str(), keylen), keylen);
LOG(INFO) << "Connection success " << addr->AsString();
#ifndef __ANDROID__
ssin >> *opts;
#else
*opts = getNextString(&ssin);
#endif
*conn_sock = conn;
return;
}
Expand All @@ -301,8 +326,9 @@ class RPCServer {
int GetTimeOutFromOpts(const std::string& opts) const {
const std::string option = "-timeout=";

if (opts.find(option) == 0) {
const std::string cmd = opts.substr(opts.find_last_of(option) + 1);
size_t pos = opts.rfind(option);
if (pos != std::string::npos) {
const std::string cmd = opts.substr(pos + option.size());
CHECK(support::IsNumber(cmd)) << "Timeout is not valid";
return std::stoi(cmd);
}
Expand Down Expand Up @@ -330,7 +356,7 @@ void ServerLoopFromChild(SOCKET socket) {
tvm::support::TCPSocket sock(socket);
const auto env = RPCEnv();
RPCServerLoop(int(sock.sockfd));

sock.Close();
env.CleanUp();
}
Expand All @@ -357,7 +383,7 @@ void RPCServerCreate(std::string host, int port, int port_end, std::string track
rpc.Start();
}

TVM_REGISTER_GLOBAL("rpc._ServerCreate")
TVM_REGISTER_GLOBAL("rpc.ServerCreate")
.set_body([](TVMArgs args, TVMRetValue* rv) {
RPCServerCreate(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
});
Expand Down
2 changes: 1 addition & 1 deletion apps/cpp_rpc/rpc_tracker_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <vector>
#include <string>

#include "../../src/runtime/rpc/rpc_session.h"
#include "../../src/runtime/rpc/rpc_endpoint.h"
#include "../../src/support/socket.h"

namespace tvm {
Expand Down
6 changes: 3 additions & 3 deletions docs/api/python/contrib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ tvm.contrib.dlpack
.. automodule:: tvm.contrib.dlpack
:members:

tvm.contrib.emscripten
~~~~~~~~~~~~~~~~~~~~~~
.. automodule:: tvm.contrib.emscripten
tvm.contrib.emcc
~~~~~~~~~~~~~~~~
.. automodule:: tvm.contrib.emcc
:members:

tvm.contrib.miopen
Expand Down
4 changes: 2 additions & 2 deletions include/tvm/arith/analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class ConstIntBound : public ObjectRef {
*/
class ConstIntBoundAnalyzer {
public:
using BoundMapType = std::unordered_map<PrimExpr, ConstIntBound, ObjectHash, ObjectEqual>;
/*!
* \brief analyze the expr
* \param expr The expression of interest.
Expand All @@ -120,8 +121,7 @@ class ConstIntBoundAnalyzer {
* \param bound The lookup table to store the intermediate results
* \return the result of the analysis.
*/
TVM_DLL ConstIntBound operator()(const PrimExpr& expr,
std::unordered_map<const PrimExprNode*, ConstIntBound>* bound);
TVM_DLL ConstIntBound operator()(const PrimExpr& expr, BoundMapType* bound);

/*!
* \brief Update constant int bound information of var.
Expand Down
34 changes: 17 additions & 17 deletions include/tvm/ir/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <tvm/ir/expr.h>
#include <tvm/ir/function.h>
#include <tvm/ir/adt.h>

#include <tvm/node/container.h>
#include <string>
#include <vector>
#include <unordered_map>
Expand Down Expand Up @@ -131,21 +131,21 @@ class IRModuleNode : public Object {
* \param name The variable name.
* \returns true if contains, otherise false.
*/
TVM_DLL bool ContainGlobalVar(const std::string& name) const;
TVM_DLL bool ContainGlobalVar(const String& name) const;

/*!
* \brief Check if the global_type_var_map_ contains a global type variable.
* \param name The variable name.
* \returns true if contains, otherise false.
*/
TVM_DLL bool ContainGlobalTypeVar(const std::string& name) const;
TVM_DLL bool ContainGlobalTypeVar(const String& name) const;

/*!
* \brief Lookup a global function by its variable.
* \param str The unique string specifying the global variable.
* \returns The global variable.
*/
TVM_DLL GlobalVar GetGlobalVar(const std::string& str) const;
TVM_DLL GlobalVar GetGlobalVar(const String& str) const;

/*!
* \brief Collect all global vars defined in this module.
Expand All @@ -158,7 +158,7 @@ class IRModuleNode : public Object {
* \param str The unique string specifying the global variable.
* \returns The global variable.
*/
TVM_DLL GlobalTypeVar GetGlobalTypeVar(const std::string& str) const;
TVM_DLL GlobalTypeVar GetGlobalTypeVar(const String& str) const;

/*!
* \brief Collect all global type vars defined in this module.
Expand All @@ -172,7 +172,7 @@ class IRModuleNode : public Object {
* \param cons name of the constructor
* \returns Constructor of ADT, error if not found
*/
TVM_DLL Constructor GetConstructor(const std::string& adt, const std::string& cons) const;
TVM_DLL Constructor GetConstructor(const String& adt, const String& cons) const;

/*!
* \brief Look up a global function by its variable.
Expand All @@ -186,7 +186,7 @@ class IRModuleNode : public Object {
* \param name The name of the function.
* \returns The function named by the argument.
*/
TVM_DLL BaseFunc Lookup(const std::string& name) const;
TVM_DLL BaseFunc Lookup(const String& name) const;

/*!
* \brief Look up a global type definition by its variable.
Expand All @@ -200,7 +200,7 @@ class IRModuleNode : public Object {
* \param var The name of the global type definition.
* \return The type definition.
*/
TVM_DLL TypeData LookupTypeDef(const std::string& var) const;
TVM_DLL TypeData LookupTypeDef(const String& var) const;

/*!
* \brief Look up a constructor by its tag.
Expand All @@ -225,18 +225,18 @@ class IRModuleNode : public Object {
* relative it will be resovled against the current
* working directory.
*/
TVM_DLL void Import(const std::string& path);
TVM_DLL void Import(const String& path);

/*!
* \brief Import Relay code from the file at path, relative to the standard library.
* \param path The path of the Relay code to import.
*/
TVM_DLL void ImportFromStd(const std::string& path);
TVM_DLL void ImportFromStd(const String& path);

/*!
* \brief The set of imported files.
*/
TVM_DLL std::unordered_set<std::string> Imports() const;
TVM_DLL std::unordered_set<String> Imports() const;

static constexpr const char* _type_key = "IRModule";
static constexpr const bool _type_has_method_sequal_reduce = true;
Expand Down Expand Up @@ -265,7 +265,7 @@ class IRModuleNode : public Object {
/*! \brief The files previously imported, required to ensure
importing is idempotent for each module.
*/
std::unordered_set<std::string> import_set_;
std::unordered_set<String> import_set_;
friend class IRModule;
};

Expand All @@ -283,7 +283,7 @@ class IRModule : public ObjectRef {
*/
TVM_DLL explicit IRModule(Map<GlobalVar, BaseFunc> functions,
Map<GlobalTypeVar, TypeData> type_definitions = {},
std::unordered_set<std::string> import_set = {});
std::unordered_set<String> import_set = {});
/*! \brief default constructor */
IRModule() {}
/*!
Expand Down Expand Up @@ -329,7 +329,7 @@ class IRModule : public ObjectRef {
* \param source_path The path to the source file.
* \return A Relay module.
*/
TVM_DLL static IRModule FromText(const std::string& text, const std::string& source_path);
TVM_DLL static IRModule FromText(const String& text, const String& source_path);

/*! \brief Declare the container type. */
using ContainerType = IRModuleNode;
Expand All @@ -346,7 +346,7 @@ class IRModule : public ObjectRef {
* Use AsText if you want to store the text.
* \sa AsText.
*/
TVM_DLL std::string PrettyPrint(const ObjectRef& node);
TVM_DLL String PrettyPrint(const ObjectRef& node);

/*!
* \brief Render the node as a string in the text format.
Expand All @@ -362,8 +362,8 @@ TVM_DLL std::string PrettyPrint(const ObjectRef& node);
* \sa PrettyPrint.
* \return The text representation.
*/
TVM_DLL std::string AsText(const ObjectRef& node,
TVM_DLL String AsText(const ObjectRef& node,
bool show_meta_data = true,
runtime::TypedPackedFunc<std::string(ObjectRef)> annotate = nullptr);
runtime::TypedPackedFunc<String(ObjectRef)> annotate = nullptr);
} // namespace tvm
#endif // TVM_IR_MODULE_H_
Loading