Unverified Commit 49d31443 by Tianqi Chen Committed by GitHub

[REFACTOR] Move support related code to include/tvm/support (#4716)

* [REFACTOR] Move support related code to include/tvm/support

- tvm/logging.h -> tvm/support/logging.h
- remove tvm/base.h, move with into tvm/support/with.h

* src/common -> src/support
parent b0b51f25
...@@ -164,7 +164,7 @@ void LinuxShared(const std::string output, ...@@ -164,7 +164,7 @@ void LinuxShared(const std::string output,
} }
cmd += " " + options; cmd += " " + options;
std::string err_msg; std::string err_msg;
auto executed_status = common::Execute(cmd, &err_msg); auto executed_status = support::Execute(cmd, &err_msg);
if (executed_status) { if (executed_status) {
LOG(FATAL) << err_msg; LOG(FATAL) << err_msg;
} }
...@@ -195,22 +195,22 @@ void CreateShared(const std::string output, const std::vector<std::string> &file ...@@ -195,22 +195,22 @@ void CreateShared(const std::string output, const std::vector<std::string> &file
*/ */
Module Load(std::string *fileIn, const std::string fmt) { Module Load(std::string *fileIn, const std::string fmt) {
std::string file = *fileIn; std::string file = *fileIn;
if (common::EndsWith(file, ".so")) { if (support::EndsWith(file, ".so")) {
return Module::LoadFromFile(file, fmt); return Module::LoadFromFile(file, fmt);
} }
#if defined(__linux__) || defined(__ANDROID__) #if defined(__linux__) || defined(__ANDROID__)
std::string file_name = file + ".so"; std::string file_name = file + ".so";
if (common::EndsWith(file, ".o")) { if (support::EndsWith(file, ".o")) {
std::vector<std::string> files; std::vector<std::string> files;
files.push_back(file); files.push_back(file);
CreateShared(file_name, files); CreateShared(file_name, files);
} else if (common::EndsWith(file, ".tar")) { } else if (support::EndsWith(file, ".tar")) {
std::string tmp_dir = "./rpc/tmp/"; std::string tmp_dir = "./rpc/tmp/";
mkdir(&tmp_dir[0], 0777); mkdir(&tmp_dir[0], 0777);
std::string cmd = "tar -C " + tmp_dir + " -zxf " + file; std::string cmd = "tar -C " + tmp_dir + " -zxf " + file;
std::string err_msg; std::string err_msg;
int executed_status = common::Execute(cmd, &err_msg); int executed_status = support::Execute(cmd, &err_msg);
if (executed_status) { if (executed_status) {
LOG(FATAL) << err_msg; LOG(FATAL) << err_msg;
} }
......
...@@ -122,8 +122,8 @@ class RPCServer { ...@@ -122,8 +122,8 @@ class RPCServer {
void ListenLoopProc() { void ListenLoopProc() {
TrackerClient tracker(tracker_addr_, key_, custom_addr_); TrackerClient tracker(tracker_addr_, key_, custom_addr_);
while (true) { while (true) {
common::TCPSocket conn; support::TCPSocket conn;
common::SockAddr addr("0.0.0.0", 0); support::SockAddr addr("0.0.0.0", 0);
std::string opts; std::string opts;
try { try {
// step 1: setup tracker and report to tracker // step 1: setup tracker and report to tracker
...@@ -221,8 +221,8 @@ class RPCServer { ...@@ -221,8 +221,8 @@ class RPCServer {
* \param ping_period Timeout for select call waiting * \param ping_period Timeout for select call waiting
*/ */
void AcceptConnection(TrackerClient* tracker, void AcceptConnection(TrackerClient* tracker,
common::TCPSocket* conn_sock, support::TCPSocket* conn_sock,
common::SockAddr* addr, support::SockAddr* addr,
std::string* opts, std::string* opts,
int ping_period = 2) { int ping_period = 2) {
std::set <std::string> old_keyset; std::set <std::string> old_keyset;
...@@ -233,7 +233,7 @@ class RPCServer { ...@@ -233,7 +233,7 @@ class RPCServer {
while (true) { while (true) {
tracker->WaitConnectionAndUpdateKey(listen_sock_, my_port_, ping_period, &matchkey); tracker->WaitConnectionAndUpdateKey(listen_sock_, my_port_, ping_period, &matchkey);
common::TCPSocket conn = listen_sock_.Accept(addr); support::TCPSocket conn = listen_sock_.Accept(addr);
int code = kRPCMagic; int code = kRPCMagic;
CHECK_EQ(conn.RecvAll(&code, sizeof(code)), sizeof(code)); CHECK_EQ(conn.RecvAll(&code, sizeof(code)), sizeof(code));
...@@ -289,7 +289,7 @@ class RPCServer { ...@@ -289,7 +289,7 @@ class RPCServer {
* \param sock The socket information * \param sock The socket information
* \param addr The socket address information * \param addr The socket address information
*/ */
void ServerLoopProc(common::TCPSocket sock, common::SockAddr addr) { void ServerLoopProc(support::TCPSocket sock, support::SockAddr addr) {
// Server loop // Server loop
auto env = RPCEnv(); auto env = RPCEnv();
RPCServerLoop(sock.sockfd); RPCServerLoop(sock.sockfd);
...@@ -308,7 +308,7 @@ class RPCServer { ...@@ -308,7 +308,7 @@ class RPCServer {
if (opts.find(option) == 0) { if (opts.find(option) == 0) {
cmd = opts.substr(opts.find_last_of(option) + 1); cmd = opts.substr(opts.find_last_of(option) + 1);
CHECK(common::IsNumber(cmd)) << "Timeout is not valid"; CHECK(support::IsNumber(cmd)) << "Timeout is not valid";
return std::stoi(cmd); return std::stoi(cmd);
} }
return 0; return 0;
...@@ -321,8 +321,8 @@ class RPCServer { ...@@ -321,8 +321,8 @@ class RPCServer {
std::string tracker_addr_; std::string tracker_addr_;
std::string key_; std::string key_;
std::string custom_addr_; std::string custom_addr_;
common::TCPSocket listen_sock_; support::TCPSocket listen_sock_;
common::TCPSocket tracker_sock_; support::TCPSocket tracker_sock_;
}; };
/*! /*!
......
...@@ -132,7 +132,7 @@ class TrackerClient { ...@@ -132,7 +132,7 @@ class TrackerClient {
* \param ping_period Select wait time. * \param ping_period Select wait time.
* \param matchkey Random match key output. * \param matchkey Random match key output.
*/ */
void WaitConnectionAndUpdateKey(common::TCPSocket listen_sock, void WaitConnectionAndUpdateKey(support::TCPSocket listen_sock,
int port, int port,
int ping_period, int ping_period,
std::string *matchkey) { std::string *matchkey) {
...@@ -140,7 +140,7 @@ class TrackerClient { ...@@ -140,7 +140,7 @@ class TrackerClient {
int unmatch_timeout = 4; int unmatch_timeout = 4;
while (true) { while (true) {
if (!tracker_sock_.IsClosed()) { if (!tracker_sock_.IsClosed()) {
common::PollHelper poller; support::PollHelper poller;
poller.WatchRead(listen_sock.sockfd); poller.WatchRead(listen_sock.sockfd);
poller.Poll(ping_period * 1000); poller.Poll(ping_period * 1000);
if (!poller.CheckRead(listen_sock.sockfd)) { if (!poller.CheckRead(listen_sock.sockfd)) {
...@@ -189,11 +189,11 @@ class TrackerClient { ...@@ -189,11 +189,11 @@ class TrackerClient {
* \param retry_period Number of seconds before we retry again. * \param retry_period Number of seconds before we retry again.
* \return TCPSocket The socket information if connect is success. * \return TCPSocket The socket information if connect is success.
*/ */
common::TCPSocket ConnectWithRetry(int timeout = 60, int retry_period = 5) { support::TCPSocket ConnectWithRetry(int timeout = 60, int retry_period = 5) {
auto tbegin = std::chrono::system_clock::now(); auto tbegin = std::chrono::system_clock::now();
while (true) { while (true) {
common::SockAddr addr(tracker_addr_); support::SockAddr addr(tracker_addr_);
common::TCPSocket sock; support::TCPSocket sock;
sock.Create(); sock.Create();
LOG(INFO) << "Tracker connecting to " << addr.AsString(); LOG(INFO) << "Tracker connecting to " << addr.AsString();
if (sock.Connect(addr)) { if (sock.Connect(addr)) {
...@@ -235,7 +235,7 @@ class TrackerClient { ...@@ -235,7 +235,7 @@ class TrackerClient {
std::string tracker_addr_; std::string tracker_addr_;
std::string key_; std::string key_;
std::string custom_addr_; std::string custom_addr_;
common::TCPSocket tracker_sock_; support::TCPSocket tracker_sock_;
std::set <std::string> old_keyset_; std::set <std::string> old_keyset_;
std::mt19937 gen_; std::mt19937 gen_;
std::uniform_real_distribution<float> dis_; std::uniform_real_distribution<float> dis_;
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#ifndef TVM_ARITHMETIC_H_ #ifndef TVM_ARITHMETIC_H_
#define TVM_ARITHMETIC_H_ #define TVM_ARITHMETIC_H_
#include <tvm/support/with.h>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include <memory> #include <memory>
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <string> #include <string>
#include "base.h"
#include "expr.h" #include "expr.h"
#include "expr_operator.h" #include "expr_operator.h"
#include "tvm/node/container.h" #include "tvm/node/container.h"
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#define TVM_CODEGEN_H_ #define TVM_CODEGEN_H_
#include <string> #include <string>
#include "base.h"
#include "expr.h" #include "expr.h"
#include "lowered_func.h" #include "lowered_func.h"
#include "runtime/packed_func.h" #include "runtime/packed_func.h"
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef TVM_DATA_LAYOUT_H_ #ifndef TVM_DATA_LAYOUT_H_
#define TVM_DATA_LAYOUT_H_ #define TVM_DATA_LAYOUT_H_
#include <tvm/base.h>
#include <tvm/expr.h> #include <tvm/expr.h>
#include <string> #include <string>
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <algorithm> #include <algorithm>
#include <unordered_map> #include <unordered_map>
#include <iostream> #include <iostream>
#include "base.h"
#include "node/node.h" #include "node/node.h"
#include "node/container.h" #include "node/container.h"
#include "node/functor.h" #include "node/functor.h"
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <utility> #include <utility>
#include "base.h"
#include "expr.h" #include "expr.h"
#include "runtime/util.h" #include "runtime/util.h"
......
...@@ -391,6 +391,14 @@ class OpMap { ...@@ -391,6 +391,14 @@ class OpMap {
const GenericOpMap& map_; const GenericOpMap& map_;
}; };
#define TVM_STRINGIZE_DETAIL(x) #x
#define TVM_STRINGIZE(x) TVM_STRINGIZE_DETAIL(x)
#define TVM_DESCRIBE(...) describe(__VA_ARGS__ "\n\nFrom:" __FILE__ ":" TVM_STRINGIZE(__LINE__))
/*!
* \brief Macro to include current line as string
*/
#define TVM_ADD_FILELINE "\n\nDefined in " __FILE__ ":L" TVM_STRINGIZE(__LINE__)
// internal macros to make // internal macros to make
#define TVM_OP_REGISTER_VAR_DEF \ #define TVM_OP_REGISTER_VAR_DEF \
static DMLC_ATTRIBUTE_UNUSED ::tvm::OpRegistry& __make_##Op static DMLC_ATTRIBUTE_UNUSED ::tvm::OpRegistry& __make_##Op
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#ifndef TVM_IR_TRANSFORM_H_ #ifndef TVM_IR_TRANSFORM_H_
#define TVM_IR_TRANSFORM_H_ #define TVM_IR_TRANSFORM_H_
#include <tvm/base.h> #include <tvm/support/with.h>
#include <tvm/node/container.h> #include <tvm/node/container.h>
#include <tvm/ir/error.h> #include <tvm/ir/error.h>
#include <tvm/ir/module.h> #include <tvm/ir/module.h>
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <string> #include <string>
#include "base.h"
#include "expr.h" #include "expr.h"
#include "tensor.h" #include "tensor.h"
#include "tvm/node/container.h" #include "tvm/node/container.h"
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <limits> #include <limits>
#include <type_traits> #include <type_traits>
#include "base.h"
#include "expr.h" #include "expr.h"
#include "tensor.h" #include "tensor.h"
#include "runtime/packed_func.h" #include "runtime/packed_func.h"
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include "base.h"
#include "expr.h" #include "expr.h"
#include "tensor.h" #include "tensor.h"
#include "tensor_intrin.h" #include "tensor_intrin.h"
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#ifndef TVM_SCHEDULE_PASS_H_ #ifndef TVM_SCHEDULE_PASS_H_
#define TVM_SCHEDULE_PASS_H_ #define TVM_SCHEDULE_PASS_H_
#include "base.h"
#include "schedule.h" #include "schedule.h"
namespace tvm { namespace tvm {
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
*/ */
/*! /*!
* \file tvm/logging.h * \file tvm/support/logging.h
* \brief logging utilities on top of dmlc-core * \brief logging utilities on top of dmlc-core
*/ */
#ifndef TVM_LOGGING_H_ #ifndef TVM_SUPPORT_LOGGING_H_
#define TVM_LOGGING_H_ #define TVM_SUPPORT_LOGGING_H_
// a technique that enables overriding macro names on the number of parameters. This is used // a technique that enables overriding macro names on the number of parameters. This is used
// to define other macros below // to define other macros below
...@@ -114,4 +114,4 @@ ...@@ -114,4 +114,4 @@
#define COND_CHECK_2(quit_on_assert, x) COND_CHECK_3(quit_on_assert, x, return false) #define COND_CHECK_2(quit_on_assert, x) COND_CHECK_3(quit_on_assert, x, return false)
#define COND_LOG_2(quit_on_assert, x) COND_LOG_3(quit_on_assert, x, return false) #define COND_LOG_2(quit_on_assert, x) COND_LOG_3(quit_on_assert, x, return false)
#endif // TVM_LOGGING_H_ #endif // TVM_SUPPORT_LOGGING_H_
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
*/ */
/*! /*!
* \file tvm/base.h * \file tvm/support/with.h
* \brief Base utilities * \brief RAII wrapper function to enter and exit a context object
* similar to python's with syntax.
*/ */
#ifndef TVM_BASE_H_ #ifndef TVM_SUPPORT_WITH_H_
#define TVM_BASE_H_ #define TVM_SUPPORT_WITH_H_
#include <dmlc/logging.h> #include <dmlc/logging.h>
#include <utility> #include <utility>
...@@ -73,14 +74,5 @@ class With { ...@@ -73,14 +74,5 @@ class With {
ContextType ctx_; ContextType ctx_;
}; };
#define TVM_STRINGIZE_DETAIL(x) #x
#define TVM_STRINGIZE(x) TVM_STRINGIZE_DETAIL(x)
#define TVM_DESCRIBE(...) describe(__VA_ARGS__ "\n\nFrom:" __FILE__ ":" TVM_STRINGIZE(__LINE__))
/*!
* \brief Macro to include current line as string
*/
#define TVM_ADD_FILELINE "\n\nDefined in " __FILE__ ":L" TVM_STRINGIZE(__LINE__)
} // namespace tvm } // namespace tvm
#endif // TVM_BASE_H_ #endif // TVM_SUPPORT_WITH_H_
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#define TVM_TARGET_INFO_H_ #define TVM_TARGET_INFO_H_
#include <string> #include <string>
#include "base.h"
#include "expr.h" #include "expr.h"
namespace tvm { namespace tvm {
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <utility> #include <utility>
#include <type_traits> #include <type_traits>
#include "base.h"
#include "expr.h" #include "expr.h"
#include "expr_operator.h" #include "expr_operator.h"
#include "arithmetic.h" #include "arithmetic.h"
......
...@@ -21,7 +21,7 @@ Header files in include are public APIs that share across modules. ...@@ -21,7 +21,7 @@ Header files in include are public APIs that share across modules.
There can be internal header files within each module that sit in src. There can be internal header files within each module that sit in src.
## Modules ## Modules
- common: Internal common utilities. - support: Internal support utilities.
- runtime: Minimum runtime related codes. - runtime: Minimum runtime related codes.
- node: base infra for IR/AST nodes that is dialect independent. - node: base infra for IR/AST nodes that is dialect independent.
- api: API function registration. - api: API function registration.
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/*! /*!
* \file codegen_cuda.cc * \file codegen_cuda.cc
*/ */
#include <tvm/base.h>
#include <tvm/runtime/registry.h> #include <tvm/runtime/registry.h>
#include <tvm/packed_func_ext.h> #include <tvm/packed_func_ext.h>
#include <cmath> #include <cmath>
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
#ifdef TVM_LLVM_VERSION #ifdef TVM_LLVM_VERSION
#include <tvm/base.h> #include <dmlc/logging.h>
#include <atomic> #include <atomic>
#include <mutex> #include <mutex>
#include <memory> #include <memory>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#include <cuda_runtime.h> #include <cuda_runtime.h>
#include <tvm/base.h>
#include <nvrtc.h> #include <nvrtc.h>
#include <cstdlib> #include <cstdlib>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/*! /*!
* \file expr.cc * \file expr.cc
*/ */
#include <tvm/base.h>
#include <tvm/expr.h> #include <tvm/expr.h>
#include <tvm/ir.h> #include <tvm/ir.h>
#include <tvm/expr_operator.h> #include <tvm/expr_operator.h>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/*! /*!
* \file expr_operator.cc * \file expr_operator.cc
*/ */
#include <tvm/base.h>
#include <tvm/ir.h> #include <tvm/ir.h>
#include <tvm/expr_operator.h> #include <tvm/expr_operator.h>
#include <cmath> #include <cmath>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/*! /*!
* \file ir.cc * \file ir.cc
*/ */
#include <tvm/base.h>
#include <tvm/expr.h> #include <tvm/expr.h>
#include <tvm/ir.h> #include <tvm/ir.h>
#include <tvm/ir_pass.h> #include <tvm/ir_pass.h>
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include "../common/base64.h" #include "../support/base64.h"
namespace tvm { namespace tvm {
...@@ -392,7 +392,7 @@ struct JSONGraph { ...@@ -392,7 +392,7 @@ struct JSONGraph {
for (DLTensor* tensor : indexer.tensor_list_) { for (DLTensor* tensor : indexer.tensor_list_) {
std::string blob; std::string blob;
dmlc::MemoryStringStream mstrm(&blob); dmlc::MemoryStringStream mstrm(&blob);
common::Base64OutStream b64strm(&mstrm); support::Base64OutStream b64strm(&mstrm);
runtime::SaveDLTensor(&b64strm, tensor); runtime::SaveDLTensor(&b64strm, tensor);
b64strm.Finish(); b64strm.Finish();
g.b64ndarrays.emplace_back(std::move(blob)); g.b64ndarrays.emplace_back(std::move(blob));
...@@ -420,7 +420,7 @@ ObjectRef LoadJSON(std::string json_str) { ...@@ -420,7 +420,7 @@ ObjectRef LoadJSON(std::string json_str) {
// load in tensors // load in tensors
for (const std::string& blob : jgraph.b64ndarrays) { for (const std::string& blob : jgraph.b64ndarrays) {
dmlc::MemoryStringStream mstrm(const_cast<std::string*>(&blob)); dmlc::MemoryStringStream mstrm(const_cast<std::string*>(&blob));
common::Base64InStream b64strm(&mstrm); support::Base64InStream b64strm(&mstrm);
b64strm.InitPosition(); b64strm.InitPosition();
runtime::NDArray temp; runtime::NDArray temp;
CHECK(temp.Load(&b64strm)); CHECK(temp.Load(&b64strm));
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <tvm/relay/expr.h> #include <tvm/relay/expr.h>
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/relay/analysis.h> #include <tvm/relay/analysis.h>
#include "../../common/arena.h" #include "../../support/arena.h"
namespace tvm { namespace tvm {
namespace relay { namespace relay {
...@@ -130,7 +130,7 @@ class StorageAllocaBaseVisitor : public ExprVisitor { ...@@ -130,7 +130,7 @@ class StorageAllocaBaseVisitor : public ExprVisitor {
class StorageAllocaInit : protected StorageAllocaBaseVisitor { class StorageAllocaInit : protected StorageAllocaBaseVisitor {
public: public:
explicit StorageAllocaInit(common::Arena* arena) explicit StorageAllocaInit(support::Arena* arena)
: arena_(arena) {} : arena_(arena) {}
/*! \return The internal token map */ /*! \return The internal token map */
...@@ -183,7 +183,7 @@ class StorageAllocaInit : protected StorageAllocaBaseVisitor { ...@@ -183,7 +183,7 @@ class StorageAllocaInit : protected StorageAllocaBaseVisitor {
private: private:
// allocator // allocator
common::Arena* arena_; support::Arena* arena_;
Map<Expr, Integer> node_device_map_; Map<Expr, Integer> node_device_map_;
}; };
...@@ -374,7 +374,7 @@ class StorageAllocator : public StorageAllocaBaseVisitor { ...@@ -374,7 +374,7 @@ class StorageAllocator : public StorageAllocaBaseVisitor {
private: private:
// allocator // allocator
common::Arena arena_; support::Arena arena_;
// scale used for rough match // scale used for rough match
size_t match_range_{16}; size_t match_range_{16};
// free list of storage entry // free list of storage entry
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/relay/interpreter.h> #include <tvm/relay/interpreter.h>
#include <tvm/relay/qnn/transform.h> #include <tvm/relay/qnn/transform.h>
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include <tvm/relay/transform.h> #include <tvm/relay/transform.h>
#include <tvm/runtime/vm.h> #include <tvm/runtime/vm.h>
#include <tvm/relay/attrs/memory.h> #include <tvm/relay/attrs/memory.h>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <tvm/ir/error.h> #include <tvm/ir/error.h>
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/relay/interpreter.h> #include <tvm/relay/interpreter.h>
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include <tvm/relay/transform.h> #include <tvm/relay/transform.h>
#include <tvm/runtime/vm.h> #include <tvm/runtime/vm.h>
#include <iostream> #include <iostream>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <tvm/relay/expr.h> #include <tvm/relay/expr.h>
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include <tvm/relay/transform.h> #include <tvm/relay/transform.h>
#include <tvm/runtime/vm.h> #include <tvm/runtime/vm.h>
#include <iostream> #include <iostream>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <tvm/relay/expr.h> #include <tvm/relay/expr.h>
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include <tvm/relay/analysis.h> #include <tvm/relay/analysis.h>
#include <tvm/relay/transform.h> #include <tvm/relay/transform.h>
#include <tvm/runtime/vm.h> #include <tvm/runtime/vm.h>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <tvm/relay/expr.h> #include <tvm/relay/expr.h>
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include <tvm/relay/analysis.h> #include <tvm/relay/analysis.h>
#include <tvm/relay/transform.h> #include <tvm/relay/transform.h>
#include <tvm/runtime/vm.h> #include <tvm/runtime/vm.h>
......
...@@ -887,7 +887,7 @@ class PrettyPrinter : ...@@ -887,7 +887,7 @@ class PrettyPrinter :
/*! \brief whether the printer is currently in an ADT definition */ /*! \brief whether the printer is currently in an ADT definition */
bool in_adt_def_; bool in_adt_def_;
/*! \brief arena for dependency graph */ /*! \brief arena for dependency graph */
common::Arena arena_; support::Arena arena_;
/*! \brief dependency graph of the expr */ /*! \brief dependency graph of the expr */
DependencyGraph dg_; DependencyGraph dg_;
class AttrPrinter; class AttrPrinter;
......
...@@ -32,7 +32,7 @@ namespace relay { ...@@ -32,7 +32,7 @@ namespace relay {
// Creator of DependencyGraph // Creator of DependencyGraph
class DependencyGraph::Creator : private ExprFunctor<void(const Expr& e)> { class DependencyGraph::Creator : private ExprFunctor<void(const Expr& e)> {
public: public:
explicit Creator(common::Arena* arena) explicit Creator(support::Arena* arena)
: arena_(arena) {} : arena_(arena) {}
DependencyGraph Create(const Expr& body) { DependencyGraph Create(const Expr& body) {
...@@ -42,7 +42,7 @@ class DependencyGraph::Creator : private ExprFunctor<void(const Expr& e)> { ...@@ -42,7 +42,7 @@ class DependencyGraph::Creator : private ExprFunctor<void(const Expr& e)> {
private: private:
/*! \brief allocator of all the internal node object */ /*! \brief allocator of all the internal node object */
common::Arena* arena_; support::Arena* arena_;
// The output. // The output.
DependencyGraph graph_; DependencyGraph graph_;
// Update the message stored at the node. // Update the message stored at the node.
...@@ -175,7 +175,7 @@ class DependencyGraph::Creator : private ExprFunctor<void(const Expr& e)> { ...@@ -175,7 +175,7 @@ class DependencyGraph::Creator : private ExprFunctor<void(const Expr& e)> {
void VisitExpr_(const ConstructorNode* c) final { } void VisitExpr_(const ConstructorNode* c) final { }
}; };
DependencyGraph DependencyGraph::Create(common::Arena* arena, const Expr& body) { DependencyGraph DependencyGraph::Create(support::Arena* arena, const Expr& body) {
return Creator(arena).Create(body); return Creator(arena).Create(body);
} }
......
...@@ -28,13 +28,13 @@ ...@@ -28,13 +28,13 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "let_list.h" #include "let_list.h"
#include "../../common/arena.h" #include "../../support/arena.h"
namespace tvm { namespace tvm {
namespace relay { namespace relay {
using common::LinkNode; using support::LinkNode;
using common::LinkedList; using support::LinkedList;
/* DependencyGraph track input and output of an Expr. /* DependencyGraph track input and output of an Expr.
* Additionally, dummy scope is created to model scope. * Additionally, dummy scope is created to model scope.
...@@ -64,7 +64,7 @@ class DependencyGraph { ...@@ -64,7 +64,7 @@ class DependencyGraph {
* \param arena The arena used for data allocation. * \param arena The arena used for data allocation.
* \param body The body of the expression to create a graph. * \param body The body of the expression to create a graph.
*/ */
static DependencyGraph Create(common::Arena* arena, const Expr& body); static DependencyGraph Create(support::Arena* arena, const Expr& body);
private: private:
class Creator; class Creator;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <tvm/relay/op_attr_types.h> #include <tvm/relay/op_attr_types.h>
#include <tvm/relay/transform.h> #include <tvm/relay/transform.h>
#include "./pattern_util.h" #include "./pattern_util.h"
#include "../../common/arena.h" #include "../../support/arena.h"
namespace tvm { namespace tvm {
...@@ -74,8 +74,8 @@ namespace relay { ...@@ -74,8 +74,8 @@ namespace relay {
- CommitFuse: mark all the nodes between source and post-dominator as the same group. - CommitFuse: mark all the nodes between source and post-dominator as the same group.
- We use an Union-Find data structure to manage the groups. - We use an Union-Find data structure to manage the groups.
*/ */
using common::LinkNode; using support::LinkNode;
using common::LinkedList; using support::LinkedList;
constexpr uint32_t kMaxFusedOps = 256; constexpr uint32_t kMaxFusedOps = 256;
...@@ -139,7 +139,7 @@ class IndexedForwardGraph { ...@@ -139,7 +139,7 @@ class IndexedForwardGraph {
* \param arena The arena used for data allocation. * \param arena The arena used for data allocation.
* \param body The body of the expression to create a graph. * \param body The body of the expression to create a graph.
*/ */
static IndexedForwardGraph Create(common::Arena* arena, const Expr& body); static IndexedForwardGraph Create(support::Arena* arena, const Expr& body);
private: private:
class Creator; class Creator;
...@@ -148,7 +148,7 @@ class IndexedForwardGraph { ...@@ -148,7 +148,7 @@ class IndexedForwardGraph {
// Creator of post dominator tree of the dataflow // Creator of post dominator tree of the dataflow
class IndexedForwardGraph::Creator : private ExprVisitor { class IndexedForwardGraph::Creator : private ExprVisitor {
public: public:
explicit Creator(common::Arena* arena) explicit Creator(support::Arena* arena)
: arena_(arena) {} : arena_(arena) {}
IndexedForwardGraph Prepare(const Expr& body) { IndexedForwardGraph Prepare(const Expr& body) {
...@@ -159,7 +159,7 @@ class IndexedForwardGraph::Creator : private ExprVisitor { ...@@ -159,7 +159,7 @@ class IndexedForwardGraph::Creator : private ExprVisitor {
private: private:
/*! \brief allocator of all the internal node object */ /*! \brief allocator of all the internal node object */
common::Arena* arena_; support::Arena* arena_;
// The output. // The output.
IndexedForwardGraph graph_; IndexedForwardGraph graph_;
// attribute equal comparator // attribute equal comparator
...@@ -363,7 +363,7 @@ class IndexedForwardGraph::Creator : private ExprVisitor { ...@@ -363,7 +363,7 @@ class IndexedForwardGraph::Creator : private ExprVisitor {
}; };
IndexedForwardGraph IndexedForwardGraph::Create( IndexedForwardGraph IndexedForwardGraph::Create(
common::Arena* arena, const Expr& body) { support::Arena* arena, const Expr& body) {
return Creator(arena).Prepare(body); return Creator(arena).Prepare(body);
} }
...@@ -396,7 +396,7 @@ class DominatorTree { ...@@ -396,7 +396,7 @@ class DominatorTree {
* \note This algorithm makes use of the fact that graph is DAG, * \note This algorithm makes use of the fact that graph is DAG,
* and runs a single pass algorithm via LCA (Least Common Ancestor) * and runs a single pass algorithm via LCA (Least Common Ancestor)
*/ */
static DominatorTree PostDom(common::Arena* arena, static DominatorTree PostDom(support::Arena* arena,
const IndexedForwardGraph& graph); const IndexedForwardGraph& graph);
private: private:
...@@ -475,7 +475,7 @@ class DominatorTree { ...@@ -475,7 +475,7 @@ class DominatorTree {
* \param gnode An IndexedForwardGraph Node. * \param gnode An IndexedForwardGraph Node.
* \return The DominatorTree Node. * \return The DominatorTree Node.
*/ */
Node* GetNode(common::Arena* arena, IndexedForwardGraph::Node* gnode) { Node* GetNode(support::Arena* arena, IndexedForwardGraph::Node* gnode) {
Node* tnode = arena->make<Node>(); Node* tnode = arena->make<Node>();
tnode->gnode = gnode; tnode->gnode = gnode;
if (gnode->extern_ref) { if (gnode->extern_ref) {
...@@ -495,7 +495,7 @@ class DominatorTree { ...@@ -495,7 +495,7 @@ class DominatorTree {
}; };
DominatorTree DominatorTree::PostDom(common::Arena* arena, DominatorTree DominatorTree::PostDom(support::Arena* arena,
const IndexedForwardGraph& graph) { const IndexedForwardGraph& graph) {
DominatorTree tree; DominatorTree tree;
tree.nodes.resize(graph.post_dfs_order.size(), nullptr); tree.nodes.resize(graph.post_dfs_order.size(), nullptr);
...@@ -512,7 +512,7 @@ DominatorTree DominatorTree::PostDom(common::Arena* arena, ...@@ -512,7 +512,7 @@ DominatorTree DominatorTree::PostDom(common::Arena* arena,
*/ */
class GraphPartitioner { class GraphPartitioner {
public: public:
explicit GraphPartitioner(common::Arena* arena, int opt_level) explicit GraphPartitioner(support::Arena* arena, int opt_level)
: arena_(arena), opt_level_(opt_level) {} : arena_(arena), opt_level_(opt_level) {}
/*! /*!
* \brief Group as a union find data structure. * \brief Group as a union find data structure.
...@@ -562,7 +562,7 @@ class GraphPartitioner { ...@@ -562,7 +562,7 @@ class GraphPartitioner {
private: private:
/*! \brief The internal arena for temporary space. */ /*! \brief The internal arena for temporary space. */
common::Arena* arena_; support::Arena* arena_;
/*! \brief optimization level for fuse operation. */ /*! \brief optimization level for fuse operation. */
int opt_level_; int opt_level_;
/*! \brief The internal groups. */ /*! \brief The internal groups. */
...@@ -845,7 +845,7 @@ class FuseMutator : private ExprMutator { ...@@ -845,7 +845,7 @@ class FuseMutator : private ExprMutator {
} }
}; };
/*! \brief Internal arena. */ /*! \brief Internal arena. */
common::Arena arena_; support::Arena arena_;
/*! \brief The group assignment map. */ /*! \brief The group assignment map. */
std::unordered_map<const Object*, GraphPartitioner::Group*> gmap_; std::unordered_map<const Object*, GraphPartitioner::Group*> gmap_;
/* \brief Internal group information map. */ /* \brief Internal group information map. */
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/relay/transform.h> #include <tvm/relay/transform.h>
#include <tvm/relay/expr_functor.h> #include <tvm/relay/expr_functor.h>
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include "let_list.h" #include "let_list.h"
#include "../../common/arena.h" #include "../../support/arena.h"
#include "pass_util.h" #include "pass_util.h"
#include "dependency_graph.h" #include "dependency_graph.h"
...@@ -275,7 +275,7 @@ Expr ToANormalFormAux(const Expr& e) { ...@@ -275,7 +275,7 @@ Expr ToANormalFormAux(const Expr& e) {
* *
* So we calculate all the dependency between nodes. * So we calculate all the dependency between nodes.
*/ */
common::Arena arena; support::Arena arena;
DependencyGraph dg = DependencyGraph::Create(&arena, e); DependencyGraph dg = DependencyGraph::Create(&arena, e);
/* In order to model new subscopes created by lambda, if else and pattern matching, /* In order to model new subscopes created by lambda, if else and pattern matching,
* we also assign scope to edge as well. * we also assign scope to edge as well.
......
...@@ -32,14 +32,14 @@ ...@@ -32,14 +32,14 @@
#include <queue> #include <queue>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include "../../common/arena.h" #include "../../support/arena.h"
namespace tvm { namespace tvm {
namespace relay { namespace relay {
using common::LinkNode; using support::LinkNode;
using common::LinkedList; using support::LinkedList;
/*! /*!
* \brief Interface of type solver used in type inference. * \brief Interface of type solver used in type inference.
...@@ -171,7 +171,7 @@ class TypeSolver { ...@@ -171,7 +171,7 @@ class TypeSolver {
/*! \brief Internal queue to update the relation */ /*! \brief Internal queue to update the relation */
std::queue<RelationNode*> update_queue_; std::queue<RelationNode*> update_queue_;
/*! \brief allocator of all the internal node obhect*/ /*! \brief allocator of all the internal node obhect*/
common::Arena arena_; support::Arena arena_;
/*! \brief Reporter that reports back to self */ /*! \brief Reporter that reports back to self */
TypeReporter reporter_; TypeReporter reporter_;
/*! \brief The global representing the current function. */ /*! \brief The global representing the current function. */
......
...@@ -45,7 +45,7 @@ class OpenOCDLowLevelDevice final : public LowLevelDevice { ...@@ -45,7 +45,7 @@ class OpenOCDLowLevelDevice final : public LowLevelDevice {
server_addr_ = server_addr; server_addr_ = server_addr;
port_ = port; port_ = port;
socket_.Connect(tvm::common::SockAddr(server_addr_.c_str(), port_)); socket_.Connect(tvm::support::SockAddr(server_addr_.c_str(), port_));
socket_.cmd_builder() << "halt 0"; socket_.cmd_builder() << "halt 0";
socket_.SendCommand(); socket_.SendCommand();
} }
......
...@@ -37,7 +37,7 @@ TclSocket::~TclSocket() { ...@@ -37,7 +37,7 @@ TclSocket::~TclSocket() {
tcp_socket_.Close(); tcp_socket_.Close();
} }
void TclSocket::Connect(tvm::common::SockAddr addr) { void TclSocket::Connect(tvm::support::SockAddr addr) {
CHECK(tcp_socket_.Connect(addr)) << "failed to connect"; CHECK(tcp_socket_.Connect(addr)) << "failed to connect";
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "../../common/socket.h" #include "../../support/socket.h"
namespace tvm { namespace tvm {
namespace runtime { namespace runtime {
...@@ -55,7 +55,7 @@ class TclSocket { ...@@ -55,7 +55,7 @@ class TclSocket {
* \brief open connection with server * \brief open connection with server
* \param addr server address * \param addr server address
*/ */
void Connect(tvm::common::SockAddr addr); void Connect(tvm::support::SockAddr addr);
/* /*
* \brief send the built command to the server and await a reply * \brief send the built command to the server and await a reply
...@@ -76,7 +76,7 @@ class TclSocket { ...@@ -76,7 +76,7 @@ class TclSocket {
private: private:
/*! \brief underlying TCP socket being wrapped */ /*! \brief underlying TCP socket being wrapped */
tvm::common::TCPSocket tcp_socket_; tvm::support::TCPSocket tcp_socket_;
/*! \brief buffer used to receive messages from the socket */ /*! \brief buffer used to receive messages from the socket */
std::vector<uint8_t> reply_buf_; std::vector<uint8_t> reply_buf_;
/*! \brief string stream used to build current command */ /*! \brief string stream used to build current command */
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
#include <algorithm> #include <algorithm>
#include "rpc_session.h" #include "rpc_session.h"
#include "../object_internal.h" #include "../object_internal.h"
#include "../../common/ring_buffer.h" #include "../../support/ring_buffer.h"
#include "../../common/socket.h" #include "../../support/socket.h"
namespace tvm { namespace tvm {
namespace runtime { namespace runtime {
...@@ -73,8 +73,8 @@ struct RPCArgBuffer { ...@@ -73,8 +73,8 @@ struct RPCArgBuffer {
// Event handler for RPC events. // Event handler for RPC events.
class RPCSession::EventHandler : public dmlc::Stream { class RPCSession::EventHandler : public dmlc::Stream {
public: public:
EventHandler(common::RingBuffer* reader, EventHandler(support::RingBuffer* reader,
common::RingBuffer* writer, support::RingBuffer* writer,
int rpc_sess_table_index, int rpc_sess_table_index,
std::string name, std::string name,
std::string* remote_key) std::string* remote_key)
...@@ -819,9 +819,9 @@ class RPCSession::EventHandler : public dmlc::Stream { ...@@ -819,9 +819,9 @@ class RPCSession::EventHandler : public dmlc::Stream {
// Number of pending bytes requests // Number of pending bytes requests
size_t pending_request_bytes_; size_t pending_request_bytes_;
// The ring buffer to read data from. // The ring buffer to read data from.
common::RingBuffer* reader_; support::RingBuffer* reader_;
// The ringr buffer to write reply to. // The ringr buffer to write reply to.
common::RingBuffer* writer_; support::RingBuffer* writer_;
// Session table index. // Session table index.
int rpc_sess_table_index_; int rpc_sess_table_index_;
// Name of session. // Name of session.
...@@ -1336,7 +1336,7 @@ size_t CallbackChannel::Send(const void* data, size_t size) { ...@@ -1336,7 +1336,7 @@ size_t CallbackChannel::Send(const void* data, size_t size) {
bytes.size = size; bytes.size = size;
int64_t n = fsend_(bytes); int64_t n = fsend_(bytes);
if (n == -1) { if (n == -1) {
common::Socket::Error("CallbackChannel::Send"); support::Socket::Error("CallbackChannel::Send");
} }
return static_cast<size_t>(n); return static_cast<size_t>(n);
} }
...@@ -1344,7 +1344,7 @@ size_t CallbackChannel::Send(const void* data, size_t size) { ...@@ -1344,7 +1344,7 @@ size_t CallbackChannel::Send(const void* data, size_t size) {
size_t CallbackChannel::Recv(void* data, size_t size) { size_t CallbackChannel::Recv(void* data, size_t size) {
TVMRetValue ret = frecv_(size); TVMRetValue ret = frecv_(size);
if (ret.type_code() != kBytes) { if (ret.type_code() != kBytes) {
common::Socket::Error("CallbackChannel::Recv"); support::Socket::Error("CallbackChannel::Recv");
} }
std::string* bytes = ret.ptr<std::string>(); std::string* bytes = ret.ptr<std::string>();
memcpy(static_cast<char*>(data), bytes->c_str(), bytes->length()); memcpy(static_cast<char*>(data), bytes->c_str(), bytes->length());
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "../../common/ring_buffer.h" #include "../../support/ring_buffer.h"
namespace tvm { namespace tvm {
namespace runtime { namespace runtime {
...@@ -270,7 +270,7 @@ class RPCSession { ...@@ -270,7 +270,7 @@ class RPCSession {
// Internal mutex // Internal mutex
std::recursive_mutex mutex_; std::recursive_mutex mutex_;
// Internal ring buffer. // Internal ring buffer.
common::RingBuffer reader_, writer_; support::RingBuffer reader_, writer_;
// Event handler. // Event handler.
std::shared_ptr<EventHandler> handler_; std::shared_ptr<EventHandler> handler_;
// call remote with specified function code. // call remote with specified function code.
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
...@@ -24,14 +24,14 @@ ...@@ -24,14 +24,14 @@
#include <tvm/runtime/registry.h> #include <tvm/runtime/registry.h>
#include <memory> #include <memory>
#include "rpc_session.h" #include "rpc_session.h"
#include "../../common/socket.h" #include "../../support/socket.h"
namespace tvm { namespace tvm {
namespace runtime { namespace runtime {
class SockChannel final : public RPCChannel { class SockChannel final : public RPCChannel {
public: public:
explicit SockChannel(common::TCPSocket sock) explicit SockChannel(support::TCPSocket sock)
: sock_(sock) {} : sock_(sock) {}
~SockChannel() { ~SockChannel() {
if (!sock_.BadSocket()) { if (!sock_.BadSocket()) {
...@@ -41,26 +41,26 @@ class SockChannel final : public RPCChannel { ...@@ -41,26 +41,26 @@ class SockChannel final : public RPCChannel {
size_t Send(const void* data, size_t size) final { size_t Send(const void* data, size_t size) final {
ssize_t n = sock_.Send(data, size); ssize_t n = sock_.Send(data, size);
if (n == -1) { if (n == -1) {
common::Socket::Error("SockChannel::Send"); support::Socket::Error("SockChannel::Send");
} }
return static_cast<size_t>(n); return static_cast<size_t>(n);
} }
size_t Recv(void* data, size_t size) final { size_t Recv(void* data, size_t size) final {
ssize_t n = sock_.Recv(data, size); ssize_t n = sock_.Recv(data, size);
if (n == -1) { if (n == -1) {
common::Socket::Error("SockChannel::Recv"); support::Socket::Error("SockChannel::Recv");
} }
return static_cast<size_t>(n); return static_cast<size_t>(n);
} }
private: private:
common::TCPSocket sock_; support::TCPSocket sock_;
}; };
std::shared_ptr<RPCSession> std::shared_ptr<RPCSession>
RPCConnect(std::string url, int port, std::string key) { RPCConnect(std::string url, int port, std::string key) {
common::TCPSocket sock; support::TCPSocket sock;
common::SockAddr addr(url.c_str(), port); support::SockAddr addr(url.c_str(), port);
sock.Create(addr.ss_family()); sock.Create(addr.ss_family());
CHECK(sock.Connect(addr)) CHECK(sock.Connect(addr))
<< "Connect to " << addr.AsString() << " failed"; << "Connect to " << addr.AsString() << " failed";
...@@ -101,8 +101,8 @@ Module RPCClientConnect(std::string url, int port, std::string key) { ...@@ -101,8 +101,8 @@ Module RPCClientConnect(std::string url, int port, std::string key) {
} }
void RPCServerLoop(int sockfd) { void RPCServerLoop(int sockfd) {
common::TCPSocket sock( support::TCPSocket sock(
static_cast<common::TCPSocket::SockType>(sockfd)); static_cast<support::TCPSocket::SockType>(sockfd));
RPCSession::Create( RPCSession::Create(
std::unique_ptr<SockChannel>(new SockChannel(sock)), std::unique_ptr<SockChannel>(new SockChannel(sock)),
"SockServerLoop", "")->ServerLoop(); "SockServerLoop", "")->ServerLoop();
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* \file src/runtime/vm/object.cc * \file src/runtime/vm/object.cc
* \brief VM related objects. * \brief VM related objects.
*/ */
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include <tvm/runtime/container.h> #include <tvm/runtime/container.h>
#include <tvm/runtime/object.h> #include <tvm/runtime/object.h>
#include <tvm/runtime/vm.h> #include <tvm/runtime/vm.h>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
#include <dmlc/memory_io.h> #include <dmlc/memory_io.h>
#include <tvm/logging.h> #include <tvm/support/logging.h>
#include <tvm/runtime/container.h> #include <tvm/runtime/container.h>
#include <tvm/runtime/vm.h> #include <tvm/runtime/vm.h>
#include <tvm/runtime/memory.h> #include <tvm/runtime/memory.h>
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
* \brief Arena allocator that allocates * \brief Arena allocator that allocates
* memory chunks and frees them all during destruction time. * memory chunks and frees them all during destruction time.
*/ */
#ifndef TVM_COMMON_ARENA_H_ #ifndef TVM_SUPPORT_ARENA_H_
#define TVM_COMMON_ARENA_H_ #define TVM_SUPPORT_ARENA_H_
#include <utility> #include <utility>
#include <type_traits> #include <type_traits>
namespace tvm { namespace tvm {
namespace common { namespace support {
const constexpr int kArenaPageSize = 16 << 10; const constexpr int kArenaPageSize = 16 << 10;
...@@ -162,6 +162,6 @@ struct LinkedList { ...@@ -162,6 +162,6 @@ struct LinkedList {
} }
}; };
} // namespace common } // namespace support
} // namespace tvm } // namespace tvm
#endif // TVM_COMMON_ARENA_H_ #endif // TVM_SUPPORT_ARENA_H_
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
* \brief data stream support to input and output from/to base64 stream * \brief data stream support to input and output from/to base64 stream
* base64 is easier to store and pass as text format in mapreduce * base64 is easier to store and pass as text format in mapreduce
*/ */
#ifndef TVM_COMMON_BASE64_H_ #ifndef TVM_SUPPORT_BASE64_H_
#define TVM_COMMON_BASE64_H_ #define TVM_SUPPORT_BASE64_H_
#include <dmlc/logging.h> #include <dmlc/logging.h>
#include <dmlc/logging.h> #include <dmlc/logging.h>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <string> #include <string>
namespace tvm { namespace tvm {
namespace common { namespace support {
/*! \brief namespace of base64 decoding and encoding table */ /*! \brief namespace of base64 decoding and encoding table */
namespace base64 { namespace base64 {
// decoding table // decoding table
...@@ -297,6 +297,6 @@ class Base64OutStream: public dmlc::Stream { ...@@ -297,6 +297,6 @@ class Base64OutStream: public dmlc::Stream {
} }
} }
}; };
} // namespace common } // namespace support
} // namespace tvm } // namespace tvm
#endif // TVM_COMMON_BASE64_H_ #endif // TVM_SUPPORT_BASE64_H_
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
* \file pipe.h * \file pipe.h
* \brief Platform independent pipe, used for IPC. * \brief Platform independent pipe, used for IPC.
*/ */
#ifndef TVM_COMMON_PIPE_H_ #ifndef TVM_SUPPORT_PIPE_H_
#define TVM_COMMON_PIPE_H_ #define TVM_SUPPORT_PIPE_H_
#include <dmlc/logging.h> #include <dmlc/logging.h>
#include <dmlc/io.h> #include <dmlc/io.h>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#endif #endif
namespace tvm { namespace tvm {
namespace common { namespace support {
/*! \brief Platform independent pipe */ /*! \brief Platform independent pipe */
class Pipe : public dmlc::Stream { class Pipe : public dmlc::Stream {
...@@ -118,7 +118,7 @@ class Pipe : public dmlc::Stream { ...@@ -118,7 +118,7 @@ class Pipe : public dmlc::Stream {
private: private:
PipeHandle handle_; PipeHandle handle_;
}; };
} // namespace common } // namespace support
} // namespace tvm } // namespace tvm
#endif // TVM_COMMON_PIPE_H_ #endif // TVM_SUPPORT_PIPE_H_
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
...@@ -21,15 +21,15 @@ ...@@ -21,15 +21,15 @@
* \file ring_buffer.h * \file ring_buffer.h
* \brief this file aims to provide a wrapper of sockets * \brief this file aims to provide a wrapper of sockets
*/ */
#ifndef TVM_COMMON_RING_BUFFER_H_ #ifndef TVM_SUPPORT_RING_BUFFER_H_
#define TVM_COMMON_RING_BUFFER_H_ #define TVM_SUPPORT_RING_BUFFER_H_
#include <vector> #include <vector>
#include <cstring> #include <cstring>
#include <algorithm> #include <algorithm>
namespace tvm { namespace tvm {
namespace common { namespace support {
/*! /*!
* \brief Ring buffer class for data buffering in IO. * \brief Ring buffer class for data buffering in IO.
* Enables easy usage for sync and async mode. * Enables easy usage for sync and async mode.
...@@ -173,6 +173,6 @@ class RingBuffer { ...@@ -173,6 +173,6 @@ class RingBuffer {
// The internald ata ring. // The internald ata ring.
std::vector<char> ring_; std::vector<char> ring_;
}; };
} // namespace common } // namespace support
} // namespace tvm } // namespace tvm
#endif // TVM_COMMON_RING_BUFFER_H_ #endif // TVM_SUPPORT_RING_BUFFER_H_
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
* \brief this file aims to provide a wrapper of sockets * \brief this file aims to provide a wrapper of sockets
* \author Tianqi Chen * \author Tianqi Chen
*/ */
#ifndef TVM_COMMON_SOCKET_H_ #ifndef TVM_SUPPORT_SOCKET_H_
#define TVM_COMMON_SOCKET_H_ #define TVM_SUPPORT_SOCKET_H_
#if defined(_WIN32) #if defined(_WIN32)
#define NOMINMAX #define NOMINMAX
...@@ -50,7 +50,7 @@ using ssize_t = int; ...@@ -50,7 +50,7 @@ using ssize_t = int;
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include "../common/util.h" #include "../support/util.h"
#if defined(_WIN32) #if defined(_WIN32)
static inline int poll(struct pollfd *pfd, int nfds, static inline int poll(struct pollfd *pfd, int nfds,
...@@ -62,7 +62,7 @@ static inline int poll(struct pollfd *pfd, int nfds, ...@@ -62,7 +62,7 @@ static inline int poll(struct pollfd *pfd, int nfds,
#endif // defined(_WIN32) #endif // defined(_WIN32)
namespace tvm { namespace tvm {
namespace common { namespace support {
/*! /*!
* \brief Get current host name. * \brief Get current host name.
* \return The hostname. * \return The hostname.
...@@ -648,6 +648,6 @@ struct PollHelper { ...@@ -648,6 +648,6 @@ struct PollHelper {
std::unordered_map<TCPSocket::SockType, pollfd> fds; std::unordered_map<TCPSocket::SockType, pollfd> fds;
}; };
} // namespace common } // namespace support
} // namespace tvm } // namespace tvm
#endif // TVM_COMMON_SOCKET_H_ #endif // TVM_SUPPORT_SOCKET_H_
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
* \file util.h * \file util.h
* \brief Defines some common utility function.. * \brief Defines some common utility function..
*/ */
#ifndef TVM_COMMON_UTIL_H_ #ifndef TVM_SUPPORT_UTIL_H_
#define TVM_COMMON_UTIL_H_ #define TVM_SUPPORT_UTIL_H_
#include <stdio.h> #include <stdio.h>
#ifndef _WIN32 #ifndef _WIN32
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <memory> #include <memory>
namespace tvm { namespace tvm {
namespace common { namespace support {
/*! /*!
* \brief TVMPOpen wrapper of popen between windows / unix. * \brief TVMPOpen wrapper of popen between windows / unix.
* \param command executed command * \param command executed command
...@@ -153,6 +153,6 @@ inline int Execute(std::string cmd, std::string* err_msg) { ...@@ -153,6 +153,6 @@ inline int Execute(std::string cmd, std::string* err_msg) {
return 255; return 255;
} }
} // namespace common } // namespace support
} // namespace tvm } // namespace tvm
#endif // TVM_COMMON_UTIL_H_ #endif // TVM_SUPPORT_UTIL_H_
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