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
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
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.