Skip to content

Commit

Permalink
[VTA] Improved RPC for VTA (apache#2043)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
liangfu authored and tmoreau89 committed Nov 12, 2018
1 parent 0fc5812 commit 9bef80c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
10 changes: 5 additions & 5 deletions python/vta/exec/rpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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="",
Expand Down
3 changes: 2 additions & 1 deletion python/vta/libinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions tests/hardware/common/test_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9bef80c

Please sign in to comment.