adstraw commented on code in PR #13381:
URL: https://github.com/apache/tvm/pull/13381#discussion_r1023113678


##########
src/runtime/hexagon/hexagon_buffer.cc:
##########
@@ -237,8 +236,15 @@ void hexagon_buffer_copy_across_regions(const BufferSet& 
dest, const BufferSet&
 
   // Finally, do the memory copies.
   for (const auto& copy : macro_copies) {
-    int error_code = hexagon_user_dma_1d_sync(copy.dest, copy.src, 
copy.num_bytes);
-    CHECK_EQ(error_code, 0);
+    qurt_mem_cache_clean(reinterpret_cast<qurt_addr_t>(copy.dest), 
copy.num_bytes,
+                         QURT_MEM_CACHE_INVALIDATE, QURT_MEM_DCACHE);
+    qurt_mem_cache_clean(reinterpret_cast<qurt_addr_t>(copy.src), 
copy.num_bytes,
+                         QURT_MEM_CACHE_INVALIDATE, QURT_MEM_DCACHE);
+    memcpy(copy.dest, copy.src, copy.num_bytes);
+    qurt_mem_cache_clean(reinterpret_cast<qurt_addr_t>(copy.dest), 
copy.num_bytes,

Review Comment:
   The invalidations are needed on either side of the memcpy based on the 
directionality --- into our out of Hexagon --- of the memcpy.  I tried various 
different combinations of invalidation including invalidation based on the 
directionality of the memcpy and did not find a combination other than what's 
in this PR that worked.  I will try to encapsulate all this is in the TODO that 
@csullivan requested as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to