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 2022/08/31 22:25:43 UTC

[GitHub] [tvm] nverke opened a new pull request, #12667: [Hexagon] Create tests to showcase vtcm loading capabilities on Hexagon.

nverke opened a new pull request, #12667:
URL: https://github.com/apache/tvm/pull/12667

   
   Results from running a vrmpy operator that loads data onto vtcm before running. 
   
   Vec - Unroll(n // 8) and Vectorize(n // 64)
   Para - Parallel(n // 4)
   Pre - Preallocated VTCM buffers
   
   Total Vrmpy Operations | Total Transfer (MB) | Without VTCM (Gops) | Basic VTCM Loads (Gops) | Vec Loads (Gops) | Vec + Para Loads (Gops) | Pre + Vec Loads (Gops) | Pre + Vec + Par Loads (Gops) | Single DMA Load (Gops) | Preloaded (Gops)
   -- | -- | -- | -- | -- | -- | -- | -- | -- | --
   1024 | 0.39 | 95.0256 | 0.345 | 0.5408 | 0.5905 | 44.4814 | 32.8886 | 15.0813 | 124.7117
   2048 | 0.79 | 124.2389 | 0.4002 | 0.7063 | 0.8826 | 43.5238 | 47.2871 | 16.1339 | 209.2688
   4096 | 1.57 | 41.5497 | 0.4215 | 0.8664 | 1.1977 | 10.9374 | 26.5749 | 18.1754 | 241.1628
   10240 | 3.93 | 33.2139 | 0.4419 | 1.0506 | 1.7311 | 11.7886 | 34.0405 | 25.4214 | 370.2948
   16384 | 6.29 | 20.7683 | 0.4195 | 1.0568 | 1.898 | 7.7292 | 22.5898 | 29.7011 | 397.4137
   20480 | 7.86 | 20.2128 | 0.4406 | 1.069 | 1.9779 | 6.6829 | 17.7941 | 25.4929 | 338.294
   
   
   Results from copying data to vtcm with various strategies
   
   
   (Factors were Unroll(n // 2), Vectorize(n // 128), Parallel(n // 4))
   
   Total Transfer (MB) | Base (GBps) | Unroll + Vectorize (GBps) | Unroll + Vectorize + Parallel (GBps) | Single DMA (GBps)
   -- | -- | -- | -- | --
   0.01 | 2.2122 | 15.9211 | 4.8287 | 2.2524
   0.02 | 2.3207 | 26.1998 | 9.5082 | 4.6669
   0.04 | 2.4425 | 38.1089 | 17.5147 | 6.4492
   0.08 | 2.5067 | 48.5949 | 32.507 | 9.1469
   0.16 | 2.5507 | 57.6021 | 55.1855 | 11.1598
   0.31 | 2.7053 | 62.8063 | 83.4726 | 15.2878
   0.62 | 2.9199 | 74.3696 | 114.7925 | 17.6438
   1 | 2.2645 | 49.8653 | 63.8026 | 18.8814
   2 | 1.1232 | 10.3933 | 29.1977 | 20.6719
   4 | 1.0683 | 9.6105 | 26.5143 | 25.201
   8 | 0.6814 | 6.1916 | 24.049 | 26.1883
   
   
   


-- 
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-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] csullivan commented on a diff in pull request #12667: [Hexagon] Create tests to showcase vtcm loading capabilities on Hexagon.

Posted by GitBox <gi...@apache.org>.
csullivan commented on code in PR #12667:
URL: https://github.com/apache/tvm/pull/12667#discussion_r961843767


##########
python/tvm/contrib/hexagon/session.py:
##########
@@ -58,7 +58,7 @@ def __init__(
         remote_kw: dict,
         session_name: str = "hexagon-rpc",
         remote_stack_size_bytes: int = 256 * 1024,  # Min size for main thread in QuRT/sim
-        rpc_receive_buffer_size_bytes: int = 5 * 1024 * 1024,  # Size for passing hexagon tests
+        rpc_receive_buffer_size_bytes: int = 1024 * 1024 * 1024,  # Size for passing hexagon tests

Review Comment:
   Left over from testing? A gigabyte for the rpc buffer can impact available memory for model execution



##########
tests/python/contrib/test_hexagon/test_vtcm_bandwidth.py:
##########
@@ -0,0 +1,169 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Test theoretical bandwith for data transfers to VTCM for different strategies."""
+
+import numpy as np
+from tests.python.contrib.test_hexagon.infrastructure import allocate_hexagon_array
+import tvm
+
+from tvm.script import tir as T
+from numpy.random import default_rng
+
+MB = 1024**2
+KB = 1024
+TEST_OUTPUT_TEMPLATE = "Test bandwidth with buffer size {}MB... \n    -Base: {} GBps \n    -Vectorized: {} GBps\n    -Vectorized and Parallelized: {} GBps\n    -Single DMA Copy: {} GBps\n"
+
+
+def memcopy_operator(size):
+    @T.prim_func
+    def operator(a: T.handle, a_v: T.handle) -> None:
+        A = T.match_buffer(a, size, dtype="int8", align=128, scope="global")
+        A_global_vtcm = T.match_buffer(a_v, size, dtype="int8", align=128, scope="global.vtcm")
+        for ax0 in T.serial(size):
+            with T.block("A_global.vtcm"):
+                v0 = T.axis.spatial(size, ax0)
+                T.reads(A[v0])
+                T.writes(A_global_vtcm[v0])
+                A_global_vtcm[v0] = A[v0]
+
+    return operator
+
+
+def single_dma_operator(size):
+    @T.prim_func
+    def operator(a: T.handle, a_v: T.handle) -> None:
+        A = T.match_buffer(a, size, dtype="int8", align=128, scope="global")
+        A_global_vtcm = T.match_buffer(a_v, size, dtype="int8", align=128, scope="global.vtcm")

Review Comment:
   A nice follow up would to support measuring the bandwidth in both directions (ddr->vtcm and vtcm->ddr) given that in tests we saw a significant perf asymmetry and making that easily reproducible can help the QC experts debug or provide us insights. 



-- 
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-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] tmoreau89 merged pull request #12667: [Hexagon] Create tests to showcase vtcm loading capabilities on Hexagon.

Posted by GitBox <gi...@apache.org>.
tmoreau89 merged PR #12667:
URL: https://github.com/apache/tvm/pull/12667


-- 
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-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] tmoreau89 commented on pull request #12667: [Hexagon] Create tests to showcase vtcm loading capabilities on Hexagon.

Posted by GitBox <gi...@apache.org>.
tmoreau89 commented on PR #12667:
URL: https://github.com/apache/tvm/pull/12667#issuecomment-1233484224

   Very neat work @nverke ! CC @masahi @kparzysz-quic 


-- 
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-unsubscribe@tvm.apache.org

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


[GitHub] [tvm] tmoreau89 commented on pull request #12667: [Hexagon] Create tests to showcase vtcm loading capabilities on Hexagon.

Posted by GitBox <gi...@apache.org>.
tmoreau89 commented on PR #12667:
URL: https://github.com/apache/tvm/pull/12667#issuecomment-1245968374

   Thank you @csullivan and @nverke for the PR; it's been merged!
   


-- 
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-unsubscribe@tvm.apache.org

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