vinx13 commented on a change in pull request #9909:
URL: https://github.com/apache/tvm/pull/9909#discussion_r783337310



##########
File path: tests/python/unittest/test_tir_ptx_mma.py
##########
@@ -0,0 +1,1323 @@
+# 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.
+
+import sys
+import pytest
+
+import tvm
+from tvm.script import tir as T
+import numpy as np
+
+
[email protected]_func
+def gemm_mma_m8n8k4_row_col_fp64pf64fp64(a: T.handle, b: T.handle, c: 
T.handle):
+    T.func_attr({"global_symbol": "default_function", "tir.noalias": True})
+    A = T.match_buffer(a, [8, 4], dtype="float64")
+    B = T.match_buffer(b, [8, 4], dtype="float64")
+    C = T.match_buffer(c, [8, 8], dtype="float64")
+    brow = T.env_thread("blockIdx.y")
+    bcol = T.env_thread("blockIdx.x")
+    tx = T.env_thread("threadIdx.x")
+    T.launch_thread(brow, 1)
+    T.launch_thread(bcol, 1)
+    T.launch_thread(tx, 32)
+    MultiA = T.allocate([1], "float64", scope="local")
+    MultiB = T.allocate([1], "float64", scope="local")
+    Accum = T.allocate([2], "float64", scope="local")
+    for i in range(2):
+        Accum[i] = T.float64(0)
+
+    MultiA[0] = A[(tx % 32) // 4, (tx % 32) % 4]
+    MultiB[0] = B[(tx % 32) // 4, (tx % 32) % 4]
+    T.evaluate(
+        T.call_extern(
+            "ptx_mma",
+            "m8n8k4",
+            "row",
+            "col",
+            "fp64",
+            "fp64",
+            "fp64",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="float64",
+        )
+    )
+    for mma_accum_c_id in range(2):
+        C[(tx % 32) // 4, (tx % 32) % 4 * 2 + mma_accum_c_id] = T.load(
+            "float64", Accum, mma_accum_c_id
+        )
+
+
[email protected]

Review comment:
       add `@tvm.testing.requires_cuda` mark and possibly also check Cuda arch 
and skip tests if not supported




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to