From dae65f2e2466966d7a60841b2524584eca538afe Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 31 Oct 2018 11:15:53 +0800 Subject: [PATCH 01/10] assign default port to 9091 as the documented --- vta/python/vta/exec/rpc_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vta/python/vta/exec/rpc_server.py b/vta/python/vta/exec/rpc_server.py index 768f6a00d451..5fd13e9db9c8 100644 --- a/vta/python/vta/exec/rpc_server.py +++ b/vta/python/vta/exec/rpc_server.py @@ -99,7 +99,7 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('--host', type=str, default="0.0.0.0", help='the hostname of the server') - parser.add_argument('--port', type=int, default=9090, + parser.add_argument('--port', type=int, default=9091, help='The port of the PRC') parser.add_argument('--port-end', type=int, default=9199, help='The end search port of the PRC') From b690b4c5aa3a07a5a9e51024fd73dd004a17fd86 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 31 Oct 2018 11:18:20 +0800 Subject: [PATCH 02/10] bug fix in printing RuntimeError and add an additional search path --- vta/python/vta/libinfo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vta/python/vta/libinfo.py b/vta/python/vta/libinfo.py index 6cda7dfdeb7d..e09d98ae9f4a 100644 --- a/vta/python/vta/libinfo.py +++ b/vta/python/vta/libinfo.py @@ -15,11 +15,13 @@ def find_libvta(optional=False): """Find VTA library""" curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) lib_search = [curr_path] + lib_search += [os.path.join(curr_path, "..", "..", "..", "lib",)] lib_search += [os.path.join(curr_path, "..", "..", "..", "build",)] lib_search += [os.path.join(curr_path, "..", "..", "..", "build", "Release")] lib_name = _get_lib_name() lib_path = [os.path.join(x, lib_name) for x in lib_search] lib_found = [x for x in lib_path if os.path.exists(x)] if not lib_found and not optional: - raise RuntimeError("Cannot find libvta: candidates are: " % str(lib_path)) + raise RuntimeError('Cannot find the files.\n' + + 'List of candidates:\n' + str('\n'.join(lib_path))) return lib_found From 10a95d48fec530f37c87be9e8e051ce1a1664e3d Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 31 Oct 2018 14:03:40 +0800 Subject: [PATCH 03/10] pretty print rebuild runtime args --- vta/python/vta/exec/rpc_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vta/python/vta/exec/rpc_server.py b/vta/python/vta/exec/rpc_server.py index 5fd13e9db9c8..f25f10145bc1 100644 --- a/vta/python/vta/exec/rpc_server.py +++ b/vta/python/vta/exec/rpc_server.py @@ -87,8 +87,8 @@ def reconfig_runtime(cfg_json): ldflags = pkg.ldflags lib_name = dll_path source = pkg.lib_source - logging.info("Rebuild runtime: output=%s, cflags=%s, source=%s, ldflags=%s", - dll_path, str(cflags), str(source), str(ldflags)) + logging.info("Rebuild runtime:\n output=%s,\n cflags=%s,\n source=%s,\n ldflags=%s", + dll_path, '\n\t'.join(cflags), '\n\t'.join(source), '\n\t'.join(ldflags)) cc.create_shared(lib_name, source, cflags + ldflags) with open(cfg_path, "w") as outputfile: outputfile.write(pkg.cfg_json) From 6a8c3f9695be18e5eef80c796b6de5c7c5176656 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 31 Oct 2018 14:18:46 +0800 Subject: [PATCH 04/10] PRC => RPC --- vta/python/vta/exec/rpc_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vta/python/vta/exec/rpc_server.py b/vta/python/vta/exec/rpc_server.py index f25f10145bc1..c318e2dd5178 100644 --- a/vta/python/vta/exec/rpc_server.py +++ b/vta/python/vta/exec/rpc_server.py @@ -100,9 +100,9 @@ def main(): parser.add_argument('--host', type=str, default="0.0.0.0", help='the hostname of the server') parser.add_argument('--port', type=int, default=9091, - help='The port of the PRC') + help='The port of the RPC') parser.add_argument('--port-end', type=int, default=9199, - help='The end search port of the PRC') + help='The end search port of the RPC') parser.add_argument('--key', type=str, default="", help="RPC key used to identify the connection type.") parser.add_argument('--tracker', type=str, default="", From 7dce69197d9b832e9cf063dad67a93232d1d1746 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 31 Oct 2018 16:32:11 +0800 Subject: [PATCH 05/10] replace vta_config.json file path `build/vta_config.json` => `vta/config/vta_config.json` --- vta/python/vta/exec/rpc_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vta/python/vta/exec/rpc_server.py b/vta/python/vta/exec/rpc_server.py index c318e2dd5178..2a862cfb9462 100644 --- a/vta/python/vta/exec/rpc_server.py +++ b/vta/python/vta/exec/rpc_server.py @@ -27,7 +27,7 @@ def server_start(): os.path.abspath(os.path.expanduser(__file__))) proj_root = os.path.abspath(os.path.join(curr_path, "../../../../")) dll_path = find_libvta()[0] - cfg_path = os.path.abspath(os.path.join(proj_root, "build/vta_config.json")) + cfg_path = os.path.abspath(os.path.join(curr_path, "../../../config/vta_config.json")) runtime_dll = [] _load_module = tvm.get_global_func("tvm.rpc.server.load_module") From c8c1734bc1d2d8f53971c6c248be630aed31ef21 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 7 Nov 2018 10:52:07 +0800 Subject: [PATCH 06/10] undo the change in adding lib_search path --- vta/python/vta/libinfo.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vta/python/vta/libinfo.py b/vta/python/vta/libinfo.py index e09d98ae9f4a..f7de9c55b1a0 100644 --- a/vta/python/vta/libinfo.py +++ b/vta/python/vta/libinfo.py @@ -15,7 +15,6 @@ def find_libvta(optional=False): """Find VTA library""" curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) lib_search = [curr_path] - lib_search += [os.path.join(curr_path, "..", "..", "..", "lib",)] lib_search += [os.path.join(curr_path, "..", "..", "..", "build",)] lib_search += [os.path.join(curr_path, "..", "..", "..", "build", "Release")] lib_name = _get_lib_name() From be10dd271197f928af91d56cd4460a69bac0ed32 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 7 Nov 2018 10:56:41 +0800 Subject: [PATCH 07/10] search vta_config.py file in vta/config --- vta/tests/hardware/pynq/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vta/tests/hardware/pynq/Makefile b/vta/tests/hardware/pynq/Makefile index 7a862e22eff9..4174b4e4726d 100644 --- a/vta/tests/hardware/pynq/Makefile +++ b/vta/tests/hardware/pynq/Makefile @@ -11,7 +11,7 @@ OBJECTS = pynq_driver.o test_lib.o metal_test.o EXECUTABLE = vta # Include VTA config -VTA_CONFIG = python ../../../make/vta_config.py +VTA_CONFIG = python ../../../config/vta_config.py CFLAGS += `${VTA_CONFIG} --cflags` LDFLAGS += `${VTA_CONFIG} --ldflags` VTA_TARGET := $(shell ${VTA_CONFIG} --target) From 87399ff562f032cf22f5a1e60dba6bf7e86a2663 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 7 Nov 2018 13:54:47 +0800 Subject: [PATCH 08/10] avoid exposing driver function calls, and use predefined `VTAMemGetPhyAddr` instead. --- vta/tests/hardware/common/test_lib.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vta/tests/hardware/common/test_lib.cc b/vta/tests/hardware/common/test_lib.cc index 95b793ea3ba1..98b5f9a030b9 100644 --- a/vta/tests/hardware/common/test_lib.cc +++ b/vta/tests/hardware/common/test_lib.cc @@ -46,12 +46,12 @@ uint64_t vta( void* vta_store_handle = VTAMapRegister(VTA_STORE_ADDR, VTA_RANGE); // Physical address pointers - uint32_t insn_phy = insns ? cma_get_phy_addr(insns) : 0; - uint32_t uop_phy = uops ? cma_get_phy_addr(uops) : 0; - uint32_t input_phy = inputs ? cma_get_phy_addr(inputs) : 0; - uint32_t weight_phy = weights ? cma_get_phy_addr(weights) : 0; - uint32_t bias_phy = biases ? cma_get_phy_addr(biases) : 0; - uint32_t output_phy = outputs ? cma_get_phy_addr(outputs) : 0; + uint32_t insn_phy = insns ? VTAMemGetPhyAddr(insns) : 0; + uint32_t uop_phy = uops ? VTAMemGetPhyAddr(uops) : 0; + uint32_t input_phy = inputs ? VTAMemGetPhyAddr(inputs) : 0; + uint32_t weight_phy = weights ? VTAMemGetPhyAddr(weights) : 0; + uint32_t bias_phy = biases ? VTAMemGetPhyAddr(biases) : 0; + uint32_t output_phy = outputs ? VTAMemGetPhyAddr(outputs) : 0; #if VTA_DEBUG == 1 printf("INFO - Starting FPGA!\n"); @@ -1453,4 +1453,4 @@ int gemm_test(int batch, int in_channels, int out_channels, bool uop_compression printf("INFO - Blocked GEMM test failed, got %d errors!\n", err); return -1; } -} \ No newline at end of file +} From 0d41faed7cc65722df6696d7ef6fed6ae6e09907 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Sun, 11 Nov 2018 11:06:09 +0800 Subject: [PATCH 09/10] rename `tests/hardware/pynq` => `metal_test` --- vta/tests/hardware/{pynq => metal_test}/Makefile | 0 vta/tests/hardware/{pynq => metal_test}/metal_test.cc | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) rename vta/tests/hardware/{pynq => metal_test}/Makefile (100%) rename vta/tests/hardware/{pynq => metal_test}/metal_test.cc (94%) diff --git a/vta/tests/hardware/pynq/Makefile b/vta/tests/hardware/metal_test/Makefile similarity index 100% rename from vta/tests/hardware/pynq/Makefile rename to vta/tests/hardware/metal_test/Makefile diff --git a/vta/tests/hardware/pynq/metal_test.cc b/vta/tests/hardware/metal_test/metal_test.cc similarity index 94% rename from vta/tests/hardware/pynq/metal_test.cc rename to vta/tests/hardware/metal_test/metal_test.cc index 56be244baa79..48d719ff4b32 100644 --- a/vta/tests/hardware/pynq/metal_test.cc +++ b/vta/tests/hardware/metal_test/metal_test.cc @@ -10,7 +10,9 @@ #include #include #include -#include "../../../src/pynq/pynq_driver.h" +#ifdef VTA_TARGET_PYNQ +# include "../../../src/pynq/pynq_driver.h" +#endif // VTA_TARGET_PYNQ #include "../common/test_lib.h" int main(void) { From 3e10f53204d1d9d4aae86b92529bcda5c01a5a66 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Mon, 12 Nov 2018 10:21:01 +0800 Subject: [PATCH 10/10] set config path back to `build` dir --- vta/python/vta/exec/rpc_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vta/python/vta/exec/rpc_server.py b/vta/python/vta/exec/rpc_server.py index 2a862cfb9462..c318e2dd5178 100644 --- a/vta/python/vta/exec/rpc_server.py +++ b/vta/python/vta/exec/rpc_server.py @@ -27,7 +27,7 @@ def server_start(): os.path.abspath(os.path.expanduser(__file__))) proj_root = os.path.abspath(os.path.join(curr_path, "../../../../")) dll_path = find_libvta()[0] - cfg_path = os.path.abspath(os.path.join(curr_path, "../../../config/vta_config.json")) + cfg_path = os.path.abspath(os.path.join(proj_root, "build/vta_config.json")) runtime_dll = [] _load_module = tvm.get_global_func("tvm.rpc.server.load_module")