incubator-tvm.patch 1.9 KB
Newer Older
1 2 3
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
C
ckey_Dou 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
@@ -48,7 +48,18 @@ else:
 
 def _load_lib():
     """Load libary by searching possible path."""
-    lib_path = libinfo.find_lib_path()
+    tar_so = "libakg.so"
+    pwd = os.path.dirname(os.path.realpath(__file__))
+    path = os.path.realpath(pwd + "/../../../mindspore/lib")
+    lib_path = []
+    files = os.listdir(path)
+    for f in files:
+        if f == tar_so:
+            lib_path.append(path + "/" + f)
+            break
+    if not lib_path:
+        raise RuntimeError("Cannot find library {}.".format(tar_so))
+
     lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
     # DMatrix functions
     lib.TVMGetLastError.restype = ctypes.c_char_p
24 25 26
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
C
ckey_Dou 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
@@ -31,11 +31,18 @@ def _get_lib_names():
 
 def _load_lib():
     """Load libary by searching possible path."""
-    curr_path = os.path.dirname(os.path.realpath(os.path.expanduser(__file__)))
-    lib_search = curr_path
-    lib_path = libinfo.find_lib_path(_get_lib_names(), lib_search, optional=True)
-    if lib_path is None:
-        return None, None
+    tar_so = "libakg.so"
+    pwd = os.path.dirname(os.path.realpath(__file__))
+    path = os.path.realpath(pwd + "/../../../mindspore/lib")
+    lib_path = []
+    files = os.listdir(path)
+    for f in files:
+        if f == tar_so:
+            lib_path.append(path + "/" + f)
+            break
+    if not lib_path:
+        raise RuntimeError("Cannot find library {}.".format(tar_so))
+
     lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
     return lib, os.path.basename(lib_path[0])