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.
[BITSTREAM SERVER] Bitstream server integration (apache#38)
- Loading branch information
Showing
16 changed files
with
178 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
TVM Change Log | ||
VTA Change Log | ||
============== | ||
|
||
This file records the changes in VTA stack in reverse chronological order. | ||
|
||
|
||
## Initial version | ||
|
||
- Vivado based hardware | ||
- Driver for PYNQ | ||
- Vivado based hardware. | ||
- Driver for PYNQ board. | ||
- Runtime library. | ||
- TVM compiler stack. | ||
- Resnet-18 example. |
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 |
---|---|---|
|
@@ -31,21 +31,10 @@ From there, clone the VTA repository: | |
git clone [email protected]:uwsaml/vta.git --recursive | ||
``` | ||
|
||
Next, clone the TVM repository: | ||
```bash | ||
git clone [email protected]:dmlc/tvm.git --recursive | ||
``` | ||
|
||
TVM is rapidly changing, and to ensure stability, we keep track of working TVM checkpoints. | ||
As of now, the TVM checkpoint `e4c2af9abdcb3c7aabafba8084414d7739c17c4c` is known to work with VTA. | ||
```bash | ||
git checkout e4c2af9abdcb3c7aabafba8084414d7739c17c4c | ||
``` | ||
|
||
Now, ssh into your **Pynq board** to build the TVM runtime with the following commands: | ||
```bash | ||
ssh [email protected] # ssh if you haven't done so | ||
cd ~/tvm | ||
cd ~/vta/nnvm/tvm | ||
cp make/config.mk . | ||
echo USE_RPC=1 >> config.mk | ||
make runtime -j2 | ||
|
@@ -57,7 +46,6 @@ We're now ready to build the Pynq RPC server on the Pynq board. | |
```bash | ||
ssh [email protected] # ssh if you haven't done so | ||
cd ~/vta | ||
export TVM_PATH = /home/xilinx/tvm | ||
make | ||
``` | ||
|
||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ In order to run this example you'll need to have: | |
* VTA installed | ||
* TVM installed | ||
* NNVM installed | ||
* MxNet installed | ||
* A Pynq-based RPC server running | ||
|
||
## VTA installation | ||
|
@@ -26,9 +27,9 @@ git clone [email protected]:dmlc/tvm.git --recursive | |
``` | ||
|
||
TVM is rapidly changing, and to ensure stability, we keep track of working TVM checkpoints. | ||
As of now, the TVM checkpoint `e4c2af9abdcb3c7aabafba8084414d7739c17c4c` is known to work with VTA. | ||
As of now, the TVM checkpoint `168f099155106d1188dbc54ac00acc02900a3c6f` is known to work with VTA. | ||
```bash | ||
git checkout e4c2af9abdcb3c7aabafba8084414d7739c17c4c | ||
git checkout 168f099155106d1188dbc54ac00acc02900a3c6f | ||
``` | ||
|
||
Before building TVM, copy the `make/config.mk` file into the root TVM directory: | ||
|
@@ -59,7 +60,7 @@ Clone the NNVM repository from `tqchen` in the directory of your choosing: | |
git clone [email protected]:tqchen/nnvm.git --recursive | ||
``` | ||
|
||
To run this example, we rely on a special branch of NNVM: `qt`: | ||
To run this example, we rely on a special branch of NNVM until these changes get merged back into the main repo: `qt`: | ||
```bash | ||
cd <nnvm root> | ||
git checkout qt | ||
|
@@ -76,6 +77,10 @@ Finally update your `~/.bashrc` file to include the NNVM python libraries in you | |
export PYTHONPATH=<nnvm root>/python:${PYTHONPATH} | ||
``` | ||
|
||
## MxNet Installation | ||
|
||
Follow the [MxNet Installation Instructions](https://mxnet.incubator.apache.org) | ||
|
||
## Pynq RPC Server Setup | ||
Follow the [Pynq RPC Server Guide](https://github.com/uwsaml/vta/tree/master/apps/pynq_rpc/README.md) | ||
|
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
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
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
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,55 @@ | ||
"""VTA specific bitstream management library.""" | ||
from __future__ import absolute_import as _abs | ||
|
||
import os | ||
import urllib | ||
from .environment import get_env | ||
|
||
# bitstream repo | ||
BITSTREAM_URL = "https://github.com/uwsaml/vta-distro/raw/master/bitstreams/" | ||
|
||
def get_bitstream_path(): | ||
"""Returns the path to the cached bitstream corresponding to the current config | ||
Returns | ||
------- | ||
bit_path: str | ||
Corresponding to the filepath of the bitstream | ||
""" | ||
|
||
env = get_env() | ||
|
||
# Derive destination path | ||
cache_dir = os.getenv("VTA_CACHE_PATH", os.path.join(os.getenv("HOME"), ".vta_cache/")) | ||
cache_dir = os.path.join(cache_dir, env.TARGET) | ||
# Create the directory if it didn't exist | ||
if not os.path.exists(cache_dir): | ||
os.makedirs(cache_dir) | ||
bit_path = os.path.join(cache_dir, env.BITSTREAM) | ||
|
||
return bit_path | ||
|
||
|
||
def download_bitstream(): | ||
"""Downloads a cached bitstream corresponding to the current config | ||
""" | ||
|
||
env = get_env() | ||
|
||
success = False | ||
bit = get_bitstream_path() | ||
url = os.path.join(BITSTREAM_URL, env.TARGET) | ||
url = os.path.join(url, env.HW_VER) | ||
url = os.path.join(url, env.BITSTREAM) | ||
# Check that the bitstream is accessible from the server | ||
if urllib.urlopen(url).getcode() == 404: | ||
# Raise error - the solution when this happens it to build your own bitstream and add it | ||
# to your VTA_CACHE_PATH | ||
raise RuntimeError( | ||
"Error: {} is not available. It appears that this configuration has not been built." | ||
.format(url)) | ||
else: | ||
urllib.urlretrieve(url, bit) | ||
success = True | ||
|
||
return success |
Oops, something went wrong.