forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INFRASTRUCTURE] Migrate to json based config. Move gemm test to inte…
…gration. (apache#28) * Migrate to json based config. Move gemm test to integration. * temp checkin * checkin example json
- Loading branch information
Showing
13 changed files
with
503 additions
and
526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# VTA Configuration | ||
|
||
Each VTA runtime/hardware configuration is specified by config.json file. | ||
You can copy the config.json to project root and modify the configuration | ||
before you type make. | ||
|
||
The config is going to affect the behavior of python package as well as | ||
the hardware runtime build. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"TARGET" : "pynq", | ||
"LOG_INP_WIDTH" : 3, | ||
"LOG_WGT_WIDTH" : 3, | ||
"LOG_ACC_WIDTH" : 5, | ||
"LOG_OUT_WIDTH" : 3, | ||
"LOG_BATCH" : 0, | ||
"LOG_BLOCK_IN" : 4, | ||
"LOG_BLOCK_OUT" : 4, | ||
"LOG_UOP_BUFF_SIZE" : 15, | ||
"LOG_INP_BUFF_SIZE" : 15, | ||
"LOG_WGT_BUFF_SIZE" : 15, | ||
"LOG_ACC_BUFF_SIZE" : 17 | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
"""VTA config tool""" | ||
import os | ||
import sys | ||
import json | ||
import argparse | ||
|
||
def get_pkg_config(cfg): | ||
"""Get the pkg config object.""" | ||
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) | ||
proj_root = os.path.abspath(os.path.join(curr_path, "../")) | ||
pkg_config_py = os.path.join(proj_root, "python/vta/pkg_config.py") | ||
libpkg = {"__file__": pkg_config_py} | ||
exec(compile(open(pkg_config_py, "rb").read(), pkg_config_py, "exec"), libpkg, libpkg) | ||
PkgConfig = libpkg["PkgConfig"] | ||
return PkgConfig(cfg, proj_root) | ||
|
||
|
||
def main(): | ||
"""Main funciton""" | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--cflags", action="store_true", | ||
help="print the cflags") | ||
parser.add_argument("--update", action="store_true", | ||
help="Print out the json option.") | ||
parser.add_argument("--ldflags", action="store_true", | ||
help="print the cflags") | ||
parser.add_argument("--cfg-json", action="store_true", | ||
help="print all the config json") | ||
parser.add_argument("--target", action="store_true", | ||
help="print the target") | ||
args = parser.parse_args() | ||
|
||
if len(sys.argv) == 1: | ||
parser.print_help() | ||
return | ||
|
||
curr_path = os.path.dirname( | ||
os.path.abspath(os.path.expanduser(__file__))) | ||
proj_root = os.path.abspath(os.path.join(curr_path, "../")) | ||
path_list = [ | ||
os.path.join(proj_root, "config.json"), | ||
os.path.join(proj_root, "make/config.json") | ||
] | ||
ok_path_list = [p for p in path_list if os.path.exists(p)] | ||
if not ok_path_list: | ||
raise RuntimeError("Cannot find config in %s" % str(path_list)) | ||
cfg = json.load(open(ok_path_list[0])) | ||
cfg["LOG_OUT_WIDTH"] = cfg["LOG_INP_WIDTH"] | ||
pkg = get_pkg_config(cfg) | ||
|
||
if args.target: | ||
print(pkg.target) | ||
|
||
if args.cflags: | ||
print(" ".join(pkg.cflags)) | ||
|
||
if args.ldflags: | ||
print(" ".join(pkg.ldflags)) | ||
|
||
if args.cfg_json: | ||
print(pkg.cfg_json) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
"""TVM-based VTA Compiler Toolchain""" | ||
from __future__ import absolute_import as _abs | ||
import sys | ||
|
||
|
||
from .environment import get_env, Environment | ||
from . import arm_conv2d, vta_conv2d | ||
from .build_module import build_config, lower, build | ||
from .rpc_client import reconfig_runtime, program_fpga | ||
|
||
try: | ||
# allow optional import in config mode. | ||
from . import arm_conv2d, vta_conv2d | ||
from .build_module import build_config, lower, build | ||
from .rpc_client import reconfig_runtime, program_fpga | ||
|
||
from . import graph | ||
except (ImportError, RuntimeError): | ||
pass |
Oops, something went wrong.