Commit b88065a8 by Liangfu Chen Committed by Thierry Moreau

[VTA] Improved RPC for VTA (#2043)

* assign default port to 9091 as the documented

* bug fix in printing RuntimeError and add an additional search path

* pretty print rebuild runtime args

* PRC => RPC

* replace vta_config.json file path

`build/vta_config.json` => `vta/config/vta_config.json`

* undo the change in adding lib_search path

* search vta_config.py file in vta/config

* avoid exposing driver function calls, and use predefined `VTAMemGetPhyAddr` instead.

* rename `tests/hardware/pynq` => `metal_test`

* set config path back to `build` dir
parent 5c410c4c
......@@ -87,8 +87,8 @@ def server_start():
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)
......@@ -99,10 +99,10 @@ 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,
help='The port of the PRC')
parser.add_argument('--port', type=int, default=9091,
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="",
......
......@@ -21,5 +21,6 @@ def find_libvta(optional=False):
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
......@@ -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");
......
......@@ -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)
......
......@@ -10,7 +10,9 @@
#include <string.h>
#include <time.h>
#include <vta/driver.h>
#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) {
......
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