[VTA][Runtime] clear sram index in reset (#5470)
authorZHANG Hao <zhanghaohit@gmail.com>
Thu, 30 Apr 2020 00:54:57 +0000 (08:54 +0800)
committerGitHub <noreply@github.com>
Thu, 30 Apr 2020 00:54:57 +0000 (17:54 -0700)
Co-authored-by: Zhang Hao <zhanghao@4paradigm.com>
vta/runtime/runtime.cc

index 038d5cf..0e48e16 100644 (file)
@@ -351,6 +351,9 @@ class BaseQueue {
    */
   virtual void Reset() {
     dram_buffer_.clear();
+    // reset to 0 as we always copy data to area starting from fpga_buff base
+    // we do mem copy for every DeviceRun
+    sram_end_ = 0;
     sram_begin_ = sram_end_;
   }
 
@@ -446,6 +449,13 @@ class UopQueue : public BaseQueue<VTAUop> {
   }
   /*! \brief clear cache and reset base queue buffer.*/
   void Reset() {
+    // unmark "cached" status
+    // as we cannot assume it is still in SRAM across DeviceRun
+    for (UopKernel* kernel : cache_) {
+      kernel->sram_begin_ = 0;
+      kernel->sram_end_ = 0;
+    }
+
     cache_.clear();
     cache_idx_ = 0;
     BaseQueue<VTAUop>::Reset();