Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0813fe0
Update task_python_vta.sh
liangfu Nov 23, 2019
c59ead4
install sbt=1.1.1 with apt-get
liangfu Jan 7, 2020
b7652ac
Merge remote-tracking branch 'upstream/master' into patch-16
liangfu Jan 7, 2020
33fa60c
update verilator_opt
liangfu Jan 7, 2020
d8b9dfd
install verilator with major version 4.0
liangfu Jan 7, 2020
8f63c39
disable multi-threading for now
liangfu Jan 8, 2020
a1d558c
bug fix for correcting uop fetch address in LoadUop module
liangfu Jan 10, 2020
b284805
bug fix for correcting uop fetch address in LoadUop module
liangfu Jan 10, 2020
85292ce
adjustment to read from dram_offset
liangfu Jan 10, 2020
0ea9c22
Merge branch 'master' into patch-16
liangfu Jan 13, 2020
fe24e25
enable USE_THREADS with verilator 4.x
liangfu Jan 13, 2020
6f5c6dd
DEBUG: try avoid core dump with verilator 4.x
liangfu Jan 13, 2020
e9e22e4
bug fix in LoadUop module
liangfu Jan 15, 2020
0000e27
log mega cycles in tsim
liangfu Jan 15, 2020
fe9761c
Merge remote-tracking branch 'upstream/master' into patch-16
liangfu Jan 15, 2020
713e9c9
download cat.png to avoid fetching in each run
liangfu Jan 16, 2020
0fda8c2
bug fix in LoadUop module
liangfu Jan 16, 2020
aea6046
solve dram_even/sram_even issue
liangfu Jan 16, 2020
0317a6d
bug fix
liangfu Jan 16, 2020
de109fe
introduce scalalint in ci
liangfu Jan 16, 2020
05f798c
speedup tsim in ci
liangfu Jan 16, 2020
ca0aa2c
bug fix
liangfu Jan 16, 2020
8b1b12f
lint scala code before building
liangfu Jan 16, 2020
444fd2f
disable multi-threading
liangfu Jan 16, 2020
0ec9d81
split fsim/tsim script
liangfu Jan 17, 2020
28be228
update Jenkins settings
liangfu Jan 17, 2020
1d85883
duplicate task_python_vta_fsim.sh as task_python_vta.sh for now
liangfu Jan 17, 2020
84f9410
Merge branch 'master' into patch-16
Jan 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

ROOTDIR = $(CURDIR)

.PHONY: clean all test doc pylint cpplint lint\
.PHONY: clean all test doc pylint cpplint scalalint lint\
cython cython2 cython3 web runtime vta

ifndef DMLC_CORE_PATH
Expand Down Expand Up @@ -80,7 +80,10 @@ pylint:
jnilint:
python3 3rdparty/dmlc-core/scripts/lint.py tvm4j-jni cpp jvm/native/src

lint: cpplint pylint jnilint
scalalint:
make -C vta/hardware/chisel lint

lint: cpplint pylint jnilint scalalint

doc:
doxygen docs/Doxyfile
Expand Down
20 changes: 3 additions & 17 deletions tests/scripts/task_python_vta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,13 @@ rm -rf ~/.tvm
# Rebuild cython
make cython3

# Reset default fsim simulation
cp vta/config/fsim_sample.json vta/config/vta_config.json

# Run unit tests in functional/fast simulator
echo "Running unittest in fsim..."
python3 -m pytest -v vta/tests/python/unittest

# Run unit tests in functional/fast simulator
echo "Running integration test in fsim..."
python3 -m pytest -v vta/tests/python/integration

# # Build VTA chisel design and verilator simulator
# (make -C vta/hardware/chisel/)

# # Set default VTA config to use TSIM cycle accurate sim
# cp vta/config/tsim_sample.json vta/config/vta_config.json

# # Run unit tests in cycle accurate simulator
# echo "Running unittest in tsim..."
# python3 -m pytest -v vta/tests/python/unittest

# # Run unit tests in cycle accurate simulator
# echo "Running integration test in tsim..."
# python3 -m pytest -v vta/tests/python/integration

# # Reset default fsim simulation
# cp vta/config/fsim_sample.json vta/config/vta_config.json
20 changes: 3 additions & 17 deletions tests/scripts/task_python_vta_fsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,13 @@ rm -rf ~/.tvm
# Rebuild cython
make cython3

# Reset default fsim simulation
cp vta/config/fsim_sample.json vta/config/vta_config.json

# Run unit tests in functional/fast simulator
echo "Running unittest in fsim..."
python3 -m pytest -v vta/tests/python/unittest

# Run unit tests in functional/fast simulator
echo "Running integration test in fsim..."
python3 -m pytest -v vta/tests/python/integration

# # Build VTA chisel design and verilator simulator
# (make -C vta/hardware/chisel/)

# # Set default VTA config to use TSIM cycle accurate sim
# cp vta/config/tsim_sample.json vta/config/vta_config.json

# # Run unit tests in cycle accurate simulator
# echo "Running unittest in tsim..."
# python3 -m pytest -v vta/tests/python/unittest

# # Run unit tests in cycle accurate simulator
# echo "Running integration test in tsim..."
# python3 -m pytest -v vta/tests/python/integration

# # Reset default fsim simulation
# cp vta/config/fsim_sample.json vta/config/vta_config.json
36 changes: 17 additions & 19 deletions tests/scripts/task_python_vta_tsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,25 @@ rm -rf ~/.tvm
# Rebuild cython
make cython3

# Run unit tests in functional/fast simulator
echo "Running unittest in fsim..."
python3 -m pytest -v vta/tests/python/unittest

# Run unit tests in functional/fast simulator
echo "Running integration test in fsim..."
python3 -m pytest -v vta/tests/python/integration
# Set default VTA config to use TSIM cycle accurate sim
cp vta/config/tsim_sample.json vta/config/vta_config.json

# # Build VTA chisel design and verilator simulator
# (make -C vta/hardware/chisel/)
# Check style of scala code
echo "Check style of scala code..."
make -C vta/hardware/chisel lint

# # Set default VTA config to use TSIM cycle accurate sim
# cp vta/config/tsim_sample.json vta/config/vta_config.json
# Build VTA chisel design and verilator simulator
echo "Building VTA chisel design..."
make -C vta/hardware/chisel cleanall
make -C vta/hardware/chisel USE_THREADS=0 lib

# # Run unit tests in cycle accurate simulator
# echo "Running unittest in tsim..."
# python3 -m pytest -v vta/tests/python/unittest
# Run unit tests in cycle accurate simulator
echo "Running unittest in tsim..."
python3 -m pytest -v vta/tests/python/unittest

# # Run unit tests in cycle accurate simulator
# echo "Running integration test in tsim..."
# python3 -m pytest -v vta/tests/python/integration
# Run unit tests in cycle accurate simulator
echo "Running integration test in tsim..."
python3 -m pytest -v vta/tests/python/integration

# # Reset default fsim simulation
# cp vta/config/fsim_sample.json vta/config/vta_config.json
# Reset default fsim simulation
cp vta/config/fsim_sample.json vta/config/vta_config.json
2 changes: 1 addition & 1 deletion vta/hardware/chisel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ else
endif

ifneq ($(USE_THREADS), 0)
verilator_opt += -threads $(USE_THREADS)
verilator_opt += --threads $(USE_THREADS)
cxx_flags += -DVL_THREADED
cxx_objs += $(verilator_build_dir)/verilated_threads.o
endif
Expand Down
16 changes: 11 additions & 5 deletions vta/hardware/chisel/src/main/scala/core/LoadUop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class LoadUop(debug: Boolean = false)(implicit p: Parameters) extends Module {
val xmax = (1 << mp.lenBits).U
val xmax_bytes = ((1 << mp.lenBits) * mp.dataBits / 8).U

val offsetIsEven = (dec.sram_offset % 2.U) === 0.U
val dram_even = (dec.dram_offset % 2.U) === 0.U
val sram_even = (dec.sram_offset % 2.U) === 0.U
val sizeIsEven = (dec.xsize % 2.U) === 0.U

val sIdle :: sReadCmd :: sReadData :: Nil = Enum(3)
Expand Down Expand Up @@ -129,11 +130,10 @@ class LoadUop(debug: Boolean = false)(implicit p: Parameters) extends Module {
// read-from-dram
val maskOffset = VecInit(Seq.fill(M_DRAM_OFFSET_BITS)(true.B)).asUInt
when(state === sIdle) {
when(offsetIsEven) {
when(dram_even) {
raddr := io.baddr | (maskOffset & (dec.dram_offset << log2Ceil(uopBytes)))
}.otherwise {
raddr := (io.baddr | (maskOffset & (dec.dram_offset << log2Ceil(
uopBytes)))) - uopBytes.U
raddr := (io.baddr | (maskOffset & (dec.dram_offset << log2Ceil(uopBytes)))) - uopBytes.U
}
}.elsewhen(state === sReadData && xcnt === xlen && xrem =/= 0.U) {
raddr := raddr + xmax_bytes
Expand Down Expand Up @@ -162,7 +162,7 @@ class LoadUop(debug: Boolean = false)(implicit p: Parameters) extends Module {
val mem = SyncReadMem(uopDepth, chiselTypeOf(wdata))
val wmask = Reg(Vec(numUop, Bool()))

when(offsetIsEven) {
when(sram_even) {
when(sizeIsEven) {
wmask := "b_11".U.asTypeOf(wmask)
}.elsewhen(io.vme_rd.cmd.fire()) {
Expand Down Expand Up @@ -192,6 +192,12 @@ class LoadUop(debug: Boolean = false)(implicit p: Parameters) extends Module {
}

wdata := io.vme_rd.data.bits.asTypeOf(wdata)
when(dram_even === false.B && sram_even) {
wdata(0) := io.vme_rd.data.bits.asTypeOf(wdata)(1)
}.elsewhen(sram_even === false.B && dram_even) {
wdata(1) := io.vme_rd.data.bits.asTypeOf(wdata)(0)
}

when(io.vme_rd.data.fire()) {
mem.write(waddr, wdata, wmask)
}
Expand Down
2 changes: 2 additions & 0 deletions vta/hardware/dpi/tsim_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ int VTADPISim() {
tfp->dump(static_cast<vluint64_t>(trace_count * 2 + 1));
#endif
trace_count++;
if ((trace_count % 1000000) == 1)
fprintf(stderr, "[traced %dM cycles]\n", trace_count / 1000000);
while (top->sim_wait) {
top->clock = 0;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
Expand Down
5 changes: 3 additions & 2 deletions vta/tutorials/frontend/deploy_vision_on_vta.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,11 @@

# Download test image
image_url = 'https://homes.cs.washington.edu/~moreau/media/vta/cat.jpg'
response = requests.get(image_url)
image_fn = 'cat.png'
download.download(image_url, image_fn)

# Prepare test image for inference
image = Image.open(BytesIO(response.content)).resize((224, 224))
image = Image.open(image_fn).resize((224, 224))
plt.imshow(image)
plt.show()
image = np.array(image) - np.array([123., 117., 104.])
Expand Down