You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by me...@apache.org on 2022/11/18 19:51:41 UTC

[tvm] branch main updated: [TIR][Hexagon] Async DMA fixups (#13436)

This is an automated email from the ASF dual-hosted git repository.

mehrdadh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 4f35b4ded1 [TIR][Hexagon] Async DMA fixups (#13436)
4f35b4ded1 is described below

commit 4f35b4ded106ea850f136c7d990e9a9008b5888b
Author: Chris Sullivan <cs...@octoml.ai>
AuthorDate: Fri Nov 18 11:51:35 2022 -0800

    [TIR][Hexagon] Async DMA fixups (#13436)
    
    * [TIR] Ensure the body of the async_wait attribute is visited.
    
    * [TIR][Runtime] Pass 'bypass_cache' flag during lowering and correctly extract it from packed API.
---
 src/runtime/hexagon/hexagon_device_api.cc | 2 +-
 src/tir/transforms/lower_async_dma.cc     | 2 +-
 src/tir/transforms/lower_tvm_builtin.cc   | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/runtime/hexagon/hexagon_device_api.cc b/src/runtime/hexagon/hexagon_device_api.cc
index 1c3b139d39..51cc976e46 100644
--- a/src/runtime/hexagon/hexagon_device_api.cc
+++ b/src/runtime/hexagon/hexagon_device_api.cc
@@ -229,7 +229,7 @@ TVM_REGISTER_GLOBAL("device_api.hexagon.dma_copy").set_body([](TVMArgs args, TVM
   void* src = args[2];
   int size = args[3];
   ICHECK(size > 0);
-  bool bypass_cache = args[3];
+  bool bypass_cache = args[4];
 
   int ret = DMA_RETRY;
   do {
diff --git a/src/tir/transforms/lower_async_dma.cc b/src/tir/transforms/lower_async_dma.cc
index b9ba4d41b7..9a950c10c7 100644
--- a/src/tir/transforms/lower_async_dma.cc
+++ b/src/tir/transforms/lower_async_dma.cc
@@ -71,7 +71,7 @@ class AsyncDMALowerer : public StmtExprMutator {
           Evaluate(Call(DataType::Int(32), builtin::dma_wait(), {queue_id, async_wait->value}));
 
       // concatenate the call with the body and return
-      return SeqStmt({call_dma_wait, async_wait->body});
+      return SeqStmt({call_dma_wait, StmtExprMutator::VisitStmt(async_wait->body)});
 
       // Convert this, for example:
       // attr [0] "async_commit_queue_scope" = 0;
diff --git a/src/tir/transforms/lower_tvm_builtin.cc b/src/tir/transforms/lower_tvm_builtin.cc
index 25d6253972..082a54f9c7 100644
--- a/src/tir/transforms/lower_tvm_builtin.cc
+++ b/src/tir/transforms/lower_tvm_builtin.cc
@@ -329,12 +329,14 @@ class BuiltinLower : public StmtExprMutator {
     PrimExpr dst = op->args[1];
     PrimExpr src = op->args[2];
     PrimExpr size = op->args[3];
+    PrimExpr bypass_cache = op->args[4];
 
     std::string fdevapi_prefix =
         "device_api." + std::string(runtime::DeviceName(device_type_.as<IntImmNode>()->value));
 
-    Call call_packed = Call(DataType::Int(32), builtin::tvm_call_packed(),
-                            {StringImm(fdevapi_prefix + ".dma_copy"), queue_id, dst, src, size});
+    Call call_packed =
+        Call(DataType::Int(32), builtin::tvm_call_packed(),
+             {StringImm(fdevapi_prefix + ".dma_copy"), queue_id, dst, src, size, bypass_cache});
     return VisitExpr(call_packed);
   }