From 1eca1ad191eee94219f5b0e33c4c557216f316e7 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Thu, 7 Nov 2019 01:19:22 +0800 Subject: [PATCH] [VTA] Hotfix for padded load test in Chisel VTA (#4264) * Update TensorUtil.scala * Update test_vta_insn.py --- vta/hardware/chisel/src/main/scala/core/TensorUtil.scala | 4 ++-- vta/tests/python/unittest/test_vta_insn.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vta/hardware/chisel/src/main/scala/core/TensorUtil.scala b/vta/hardware/chisel/src/main/scala/core/TensorUtil.scala index 1f00554..99e9012 100644 --- a/vta/hardware/chisel/src/main/scala/core/TensorUtil.scala +++ b/vta/hardware/chisel/src/main/scala/core/TensorUtil.scala @@ -319,8 +319,8 @@ class TensorDataCtrl(tensorType: String = "none", when(split) { caddr := caddr + xmax_bytes }.elsewhen(stride) { - caddr := baddr + (dec.xstride << log2Ceil(strideFactor)) - baddr := baddr + (dec.xstride << log2Ceil(strideFactor)) + caddr := baddr + (dec.xstride << log2Ceil(elemBytes)) + baddr := baddr + (dec.xstride << log2Ceil(elemBytes)) } } diff --git a/vta/tests/python/unittest/test_vta_insn.py b/vta/tests/python/unittest/test_vta_insn.py index 25d7d8c..574273f 100644 --- a/vta/tests/python/unittest/test_vta_insn.py +++ b/vta/tests/python/unittest/test_vta_insn.py @@ -89,10 +89,10 @@ def test_padded_load(): """Test padded load.""" def _run(env, remote): # declare - n = 21 - m = 20 - pad_before = [0, 1, 0, 0] - pad_after = [1, 3, 0, 0] + n = 3 + m = 5 + pad_before = [2, 1, 0, 0] + pad_after = [1, 2, 0, 0] x = tvm.placeholder( (n, m, env.BATCH, env.BLOCK_OUT), name="x", @@ -126,7 +126,7 @@ def test_padded_load(): f = remote.load_module("padded_load.o") # verify ctx = remote.ext_dev(0) - x_np = np.random.randint(1, 2, size=( + x_np = np.random.randint(-10, 10, size=( n, m, env.BATCH, env.BLOCK_OUT)).astype(x.dtype) y_np = np.zeros((n + pad_before[0] + pad_after[0], m + pad_before[1] + pad_after[1], -- 2.7.4