提交 f60af9df 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!70 add macro in CMakeLists.txt to differ backend d and gpu, add modification statement

Merge pull request !70 from looop5/akg_master
......@@ -98,6 +98,9 @@ add_definitions(-DDMLC_LOG_CUSTOMIZE=1)
if(USE_AKG_LOG)
add_definitions(-DUSE_AKG_LOG=1)
endif()
if(NOT USE_CUDA)
add_definitions("-DBACKEND_D")
endif()
# Generic compilation options
include(CheckCXXCompilerFlag)
......
......@@ -234,33 +234,32 @@ class HostDeviceSplitter : public IRMutator {
}
}
const char* mode = getenv("RUNTIME_MODE");
if (mode) {
std::shared_ptr<LoweredFuncNode> na = std::make_shared<LoweredFuncNode>();
for (unsigned i = 0; i < (unsigned)args_real.size(); i++) {
bool match = false;
for (unsigned j = 0; j < (unsigned)n->args.size(); j++) {
if (strcmp(args_real[i].get()->name_hint.c_str(), n->args[j].get()->name_hint.c_str()) == 0) {
na->args.push_back(n->args[j]);
match = true;
break;
} else {
continue;
}
#ifdef BACKEND_D
std::shared_ptr<LoweredFuncNode> na = std::make_shared<LoweredFuncNode>();
for (unsigned i = 0; i < (unsigned)args_real.size(); i++) {
bool match = false;
for (unsigned j = 0; j < (unsigned)n->args.size(); j++) {
if (strcmp(args_real[i].get()->name_hint.c_str(), n->args[j].get()->name_hint.c_str()) == 0) {
na->args.push_back(n->args[j]);
match = true;
break;
} else {
continue;
}
}
if (!match) {
na->args.push_back(args_real[i]);
// mark handle data type.
for (auto kv : handle_data_type_) {
if (strcmp(args_real[i].get()->name_hint.c_str(), kv.first->name_hint.c_str()) == 0) {
n->handle_data_type.Set(args_real[i], kv.second);
}
if (!match) {
na->args.push_back(args_real[i]);
// mark handle data type.
for (auto kv : handle_data_type_) {
if (strcmp(args_real[i].get()->name_hint.c_str(), kv.first->name_hint.c_str()) == 0) {
n->handle_data_type.Set(args_real[i], kv.second);
}
}
}
n->args = na->args;
}
n->args = na->args;
#endif
LoweredFunc f_device(n);
Array<Expr> call_args;
......
diff -uprN tvm_orig/python/tvm/_ffi/base.py tvm/python/tvm/_ffi/base.py
--- tvm_orig/python/tvm/_ffi/base.py 2020-04-13 20:18:09.519984547 +0800
+++ tvm/python/tvm/_ffi/base.py 2020-04-13 20:14:21.510253128 +0800
@@ -48,7 +48,18 @@ else:
diff -Npur tvm_orig/python/tvm/_ffi/base.py tvm/python/tvm/_ffi/base.py
--- tvm_orig/python/tvm/_ffi/base.py 2020-07-16 14:39:28.859033775 +0800
+++ tvm/python/tvm/_ffi/base.py 2020-07-16 14:42:26.594223690 +0800
@@ -16,6 +16,11 @@
# under the License.
# coding: utf-8
# pylint: disable=invalid-name
+
+#
+# 2020.7.16 - Modify _load_lib function to find the correct library.
+#
+
"""Base library for TVM FFI."""
from __future__ import absolute_import
@@ -48,7 +53,18 @@ else:
def _load_lib():
"""Load libary by searching possible path."""
......@@ -21,10 +33,22 @@ diff -uprN tvm_orig/python/tvm/_ffi/base.py tvm/python/tvm/_ffi/base.py
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
# DMatrix functions
lib.TVMGetLastError.restype = ctypes.c_char_p
diff -uprN tvm_orig/topi/python/topi/cpp/impl.py tvm/topi/python/topi/cpp/impl.py
--- tvm_orig/topi/python/topi/cpp/impl.py 2020-04-13 20:18:09.535984509 +0800
+++ tvm/topi/python/topi/cpp/impl.py 2020-04-13 20:16:41.784427200 +0800
@@ -31,11 +31,18 @@ def _get_lib_names():
diff -Npur tvm_orig/topi/python/topi/cpp/impl.py tvm/topi/python/topi/cpp/impl.py
--- tvm_orig/topi/python/topi/cpp/impl.py 2020-07-16 14:40:07.754722324 +0800
+++ tvm/topi/python/topi/cpp/impl.py 2020-07-16 14:42:56.638225874 +0800
@@ -14,6 +14,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+
+#
+# 2020.7.16 - Modify _load_lib function to find the correct library.
+#
+
"""Load Lib for C++ TOPI ops and schedules"""
import sys
import os
@@ -31,11 +36,18 @@ def _get_lib_names():
def _load_lib():
"""Load libary by searching possible path."""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册