tvm_runtime.h 2.63 KB
Newer Older
1 2 3 4 5 6 7 8
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *   http://www.apache.org/licenses/LICENSE-2.0
11
 *
12 13 14 15 16 17 18 19
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

Yizhi Liu committed
20 21 22 23 24 25 26
/*!
 * \file tvm_runtime.h
 * \brief Pack all tvm runtime source files
 */
#include <sys/stat.h>
#include <fstream>

27 28 29 30 31 32 33 34 35 36 37 38
/* Enable custom logging - this will cause TVM to pass every log message
 * through CustomLogMessage instead of LogMessage. By enabling this, we must
 * implement dmlc::CustomLogMessage::Log. We use this to pass TVM log
 * messages to Android logcat.
 */
#define DMLC_LOG_CUSTOMIZE 1

/* Ensure that fatal errors are passed to the logger before throwing
 * in LogMessageFatal
 */
#define DMLC_LOG_BEFORE_THROW 1

Yizhi Liu committed
39 40 41 42 43 44 45 46 47 48 49
#include "../src/runtime/c_runtime_api.cc"
#include "../src/runtime/cpu_device_api.cc"
#include "../src/runtime/workspace_pool.cc"
#include "../src/runtime/module_util.cc"
#include "../src/runtime/system_lib_module.cc"
#include "../src/runtime/module.cc"
#include "../src/runtime/registry.cc"
#include "../src/runtime/file_util.cc"
#include "../src/runtime/dso_module.cc"
#include "../src/runtime/rpc/rpc_session.cc"
#include "../src/runtime/rpc/rpc_event_impl.cc"
50
#include "../src/runtime/rpc/rpc_server_env.cc"
Yizhi Liu committed
51 52 53
#include "../src/runtime/rpc/rpc_module.cc"
#include "../src/runtime/rpc/rpc_socket_impl.cc"
#include "../src/runtime/thread_pool.cc"
54
#include "../src/runtime/threading_backend.cc"
55
#include "../src/runtime/graph/graph_runtime.cc"
56
#include "../src/runtime/ndarray.cc"
57
#include "../src/runtime/object.cc"
58

Yizhi Liu committed
59 60 61 62
#ifdef TVM_OPENCL_RUNTIME
#include "../src/runtime/opencl/opencl_device_api.cc"
#include "../src/runtime/opencl/opencl_module.cc"
#endif
63 64

#ifdef TVM_VULKAN_RUNTIME
65
#include "../src/runtime/vulkan/vulkan.cc"
66
#endif
67

68
#ifdef USE_SORT
peike committed
69
#include "../src/runtime/contrib/sort/sort.cc"
70 71
#endif

72 73 74 75 76 77 78 79

#include <android/log.h>

void dmlc::CustomLogMessage::Log(const std::string& msg) {
  // This is called for every message logged by TVM.
  // We pass the message to logcat.
  __android_log_write(ANDROID_LOG_DEBUG, "TVM_RUNTIME", msg.c_str());
}