You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/01/13 07:24:15 UTC

[GitHub] [incubator-tvm] liangfu opened a new pull request #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module

liangfu opened a new pull request #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module
URL: https://github.com/apache/incubator-tvm/pull/4694
 
 
   This PR fixed an issue in updating `uop_idx` counter in the `TensorGemm` module.
   
   ### Problem
   When evaluating `deploy_vision_on_vta.py`, it is required to run the module with
   ```python
   m.run
   ```
   However, it throws an instance of `dmlc::Error`, saying
   ```
   virtual_memory.cc:48: Check failed: phy_addr != 0 (0 vs. 0) : trying to get address that is nullptr
   ```
   The root cause is that `uop_idx` increases unexpectedly.
   
   This PR fixes the above issue and enables successful evaluation of `deploy_vision_on_vta.py` with TSIM backend.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] kevinyuan commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module

Posted by GitBox <gi...@apache.org>.
kevinyuan commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module
URL: https://github.com/apache/incubator-tvm/pull/4694#issuecomment-573733217
 
 
   Hi @liangfu,
   
   With your recommended changes, **tsim** produced the same prediction results as **fsim**.
   
   Can you explain why m.run() must be used instead of time_evaluator to generate the correct prediction result ?
   
   Furthermore, the cycle_count in "Execution statistics" is equal to 0. Is this expected or it can be improved ?
   
   
   Thanks.
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] liangfu commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module

Posted by GitBox <gi...@apache.org>.
liangfu commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module
URL: https://github.com/apache/incubator-tvm/pull/4694#issuecomment-573539977
 
 
   @kevinyuan Can you help reproduce the results?
   
   A hard requirement is that we should run the module only once with
   ```python
   m.run()
   ```
   , instead of running it in `time_evaluator`.
   
   In addition, I have a patch
   ```c++
   --- a/vta/hardware/dpi/tsim_device.cc
   +++ b/vta/hardware/dpi/tsim_device.cc
   @@ -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));
   ```
   to trace the number of cycles in TSIM. 
   It requires 31M cycles to run resnet18_v1 prediction.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] kevinyuan commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module

Posted by GitBox <gi...@apache.org>.
kevinyuan commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module
URL: https://github.com/apache/incubator-tvm/pull/4694#issuecomment-577218980
 
 
   Hi @liangfu,
   
   Have you got a chance to figure out the root cause of "The problem is how to get correct prediction results with time_evaluator, instead of running the module directly" ?
   
   Also, I found using the following wrong code  #1 will also generate wrong prediction, which looks like the inference was run with 11 passed, since I saw **[traced 329M cycles]** at the end, while the correct run show **[traced 29M cycles]** at the end.
   
   ----------- wrong code #1 ------------
   ```
   from tvm.contrib.debugger import debug_runtime as graph_runtime
   m = graph_runtime.create(graph, lib, ctx)
   m.run()
   ```
   Output
   ```
   ...
   [traced 329M cycles]
   ```
   
   ----------- wrong code #2 ------------
   ```
   from tvm.contrib import graph_runtime, util, download
   m = graph_runtime.create(graph, lib, ctx)
   timer = m.module.time_evaluator("run", ctx, number=1, repeat=1)
   ```
   Output
   ```
   ...
   [traced 59M cycles]
   ```
   ----------- correct ---------
   ```
   from tvm.contrib import graph_runtime, util, download
   m = graph_runtime.create(graph, lib, ctx)
   m.run()
   ```
   Output
   ```
   ...
   [traced 29M cycles]
   ```
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] liangfu commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module

Posted by GitBox <gi...@apache.org>.
liangfu commented on issue #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module
URL: https://github.com/apache/incubator-tvm/pull/4694#issuecomment-573967105
 
 
   > Can you explain why m.run() must be used instead of time_evaluator to generate the correct prediction result?
   
   time_evaluator takes the first run as a warm-up, and the timing results would be ignored. The prediction results are generated from the second run, which might use the buffer contaminated by the first run.
   
   > Furthermore, the cycle_count in "Execution statistics" is equal to 0. Is this expected or it can be improved?
   
   It prints out correct "Execution statistics" when we use time_evaluator. The problem is how to get correct prediction results with time_evaluator, instead of running the module directly.
   
   cc @tmoreau89 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tmoreau89 merged pull request #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module

Posted by GitBox <gi...@apache.org>.
tmoreau89 merged pull request #4694: [VTA] Fix an issue in updating uop_idx in the TensorGemm module
URL: https://github.com/apache/incubator-tvm/pull/4694
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services