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



##########
File path: tests/python/unittest/test_tir_ptx_mma.py
##########
@@ -0,0 +1,1356 @@
+# 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
+import tvm.testing
+
+
[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.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]_cuda
+def test_gemm_mma_m8n8k4_row_col_fp64pf64fp64():
+    sch = tvm.tir.Schedule(gemm_mma_m8n8k4_row_col_fp64pf64fp64)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major < 8:
+        # Require at least SM80
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    A_np = np.random.uniform(-1, 1, [8, 4]).astype("float64")
+    B_np = np.random.uniform(-1, 1, [8, 4]).astype("float64")
+    C_np = np.random.uniform(-1, 1, [8, 8]).astype("float64")
+
+    ctx = tvm.cuda()
+    A_tvm = tvm.nd.array(A_np, ctx)
+    B_tvm = tvm.nd.array(B_np, ctx)
+    C_tvm = tvm.nd.array(C_np, ctx)
+
+    cuda_mod(A_tvm, B_tvm, C_tvm)
+
+    golden = np.matmul(A_np.astype("float64"), B_np.astype("float64").T)
+
+    C_numpy = C_tvm.numpy()
+
+    tvm.testing.assert_allclose(golden, C_numpy, atol=1e-3, rtol=1e-3)
+
+
[email protected]_func
+def gemm_mma_m8n8k4_row_row_fp16fp16fp16(a: T.handle, b: T.handle, c: 
T.handle):
+    T.func_attr({"global_symbol": "default_function", "tir.noalias": True})
+    A = T.match_buffer(a, [16, 4], dtype="float16")
+    B = T.match_buffer(b, [4, 16], dtype="float16")
+    C = T.match_buffer(c, [16, 16], dtype="float16")
+    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([4], "float16", scope="local")
+    MultiB = T.allocate([4], "float16", scope="local")
+    Accum = T.allocate([8], "float16", scope="local")
+    for i in range(8):
+        Accum[i] = T.float32(0)
+
+    for mma_multi_a_col in T.vectorized(4):
+        MultiA[mma_multi_a_col] = A[
+            ((tx % 32) % 4) + (4 * ((((tx % 32) // 16 + (tx % 32) % 16 // 4 * 
2)) % 4)),
+            mma_multi_a_col,
+        ]
+    for mma_multi_b_col in T.vectorized(4):
+        MultiB[mma_multi_b_col] = B[
+            (tx % 32) % 4,
+            mma_multi_b_col + (4 * ((tx % 32) // 8)),
+        ]
+    T.evaluate(
+        T.ptx_mma(
+            "m8n8k4",
+            "row",
+            "row",
+            "fp16",
+            "fp16",
+            "fp16",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="float16",
+        )
+    )
+    for mma_accum_c_id in range(8):
+        C[
+            ((tx % 32) % 4) + (4 * ((((tx % 32) // 16 + (tx % 32) % 16 // 4 * 
2)) % 4)),
+            mma_accum_c_id % 4 + (4 * ((tx % 32) % 16 // 8)) + mma_accum_c_id 
// 4 * 8,
+        ] = T.load("float16", Accum, mma_accum_c_id)
+
+
[email protected]_cuda
+def test_gemm_mma_m8n8k4_row_row_fp16fp16fp16():
+    sch = tvm.tir.Schedule(gemm_mma_m8n8k4_row_row_fp16fp16fp16)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major < 7:
+        # Require at least SM70
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    A_np = np.random.uniform(-1, 1, [16, 4]).astype("float16")
+    B_np = np.random.uniform(-1, 1, [4, 16]).astype("float16")
+    C_np = np.random.uniform(-1, 1, [16, 16]).astype("float16")
+
+    ctx = tvm.cuda()
+    A_tvm = tvm.nd.array(A_np, ctx)
+    B_tvm = tvm.nd.array(B_np, ctx)
+    C_tvm = tvm.nd.array(C_np, ctx)
+
+    cuda_mod(A_tvm, B_tvm, C_tvm)
+
+    golden = np.matmul(A_np.astype("float16"), B_np.astype("float16"))
+
+    C_numpy = C_tvm.numpy()
+
+    tvm.testing.assert_allclose(golden, C_numpy, atol=1e-3, rtol=1e-3)
+
+
[email protected]_func
+def gemm_mma_m8n8k4_row_row_fp16fp16fp32(a: T.handle, b: T.handle, c: 
T.handle):
+    T.func_attr({"global_symbol": "default_function", "tir.noalias": True})
+    A = T.match_buffer(a, [16, 4], dtype="float16")
+    B = T.match_buffer(b, [4, 16], dtype="float16")
+    C = T.match_buffer(c, [16, 16], dtype="float32")
+    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([4], "float16", scope="local")
+    MultiB = T.allocate([4], "float16", scope="local")
+    Accum = T.allocate([8], "float32", scope="local")
+    for i in range(8):
+        Accum[i] = T.float32(0)
+
+    for mma_multi_a_col in T.vectorized(4):
+        MultiA[mma_multi_a_col] = A[
+            ((tx % 32) % 4) + (4 * ((((tx % 32) // 16 + (tx % 32) % 16 // 4 * 
2)) % 4)),
+            mma_multi_a_col,
+        ]
+    for mma_multi_b_col in T.vectorized(4):
+        MultiB[mma_multi_b_col] = B[
+            (tx % 32) % 4,
+            mma_multi_b_col + (4 * ((tx % 32) // 8)),
+        ]
+    T.evaluate(
+        T.ptx_mma(
+            "m8n8k4",
+            "row",
+            "row",
+            "fp16",
+            "fp16",
+            "fp32",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="float32",
+        )
+    )
+    for mma_accum_c_id in range(8):
+        C[
+            ((tx % 32) % 2)
+            + ((mma_accum_c_id // 2 % 2) * 2)
+            + 4 * ((tx % 32) // 16)
+            + ((tx % 32) % 16 // 4) % 2 * 8,
+            (tx % 32) % 4 // 2 * 2
+            + (tx % 32) % 16 // 8 * 4
+            + mma_accum_c_id % 2
+            + mma_accum_c_id // 4 * 8,
+        ] = T.load("float32", Accum, mma_accum_c_id)
+
+
[email protected]_cuda
+def test_gemm_mma_m8n8k4_row_row_fp16fp16fp32():
+    sch = tvm.tir.Schedule(gemm_mma_m8n8k4_row_row_fp16fp16fp32)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major < 7:
+        # Require at least SM70
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    A_np = np.random.uniform(-1, 1, [16, 4]).astype("float16")
+    B_np = np.random.uniform(-1, 1, [4, 16]).astype("float16")
+    C_np = np.random.uniform(-1, 1, [16, 16]).astype("float32")
+
+    ctx = tvm.cuda()
+    A_tvm = tvm.nd.array(A_np, ctx)
+    B_tvm = tvm.nd.array(B_np, ctx)
+    C_tvm = tvm.nd.array(C_np, ctx)
+
+    cuda_mod(A_tvm, B_tvm, C_tvm)
+
+    golden = np.matmul(A_np.astype("float32"), B_np.astype("float32"))
+
+    C_numpy = C_tvm.numpy()
+
+    tvm.testing.assert_allclose(golden, C_numpy, atol=1e-3, rtol=1e-3)
+
+
[email protected]_func
+def gemm_mma_m8n8k16_row_col_s8s8s32(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, 16], dtype="int8")
+    B = T.match_buffer(b, [8, 16], dtype="int8")
+    C = T.match_buffer(c, [8, 8], dtype="int32")
+    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([4], "int8", scope="local")
+    MultiB = T.allocate([4], "int8", scope="local")
+    Accum = T.allocate([2], "int32", scope="local")
+    for i in range(2):
+        Accum[i] = T.int32(0)
+
+    for mma_multi_a_col in T.vectorized(4):
+        MultiA[mma_multi_a_col] = A[(tx % 32) // 4, mma_multi_a_col + (tx % 
32) % 4 * 4]
+    for mma_multi_b_col in T.vectorized(4):
+        MultiB[mma_multi_b_col] = B[(tx % 32) // 4, mma_multi_b_col + (tx % 
32) % 4 * 4]
+    T.evaluate(
+        T.ptx_mma(
+            "m8n8k16",
+            "row",
+            "col",
+            "int8",
+            "int8",
+            "int32",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="int32",
+        )
+    )
+    for mma_accum_c_id in range(2):
+        C[(tx % 32) // 4, (tx % 32) % 4 * 2 + mma_accum_c_id] = T.load(
+            "int32", Accum, mma_accum_c_id
+        )
+
+
[email protected]_cuda
+def test_gemm_mma_m8n8k16_row_col_s8s8s32():
+    sch = tvm.tir.Schedule(gemm_mma_m8n8k16_row_col_s8s8s32)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major * 10 + minor < 75:
+        # Require at least SM75
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    A_np = np.random.uniform(-10, 10, [8, 16]).astype("int8")
+    B_np = np.random.uniform(-10, 10, [8, 16]).astype("int8")
+    C_np = np.random.uniform(-1, 1, [8, 8]).astype("int32")
+
+    ctx = tvm.cuda()
+    A_tvm = tvm.nd.array(A_np, ctx)
+    B_tvm = tvm.nd.array(B_np, ctx)
+    C_tvm = tvm.nd.array(C_np, ctx)
+
+    cuda_mod(A_tvm, B_tvm, C_tvm)
+
+    golden = np.matmul(A_np.astype("int32"), B_np.astype("int32").T)
+
+    C_numpy = C_tvm.numpy()
+
+    tvm.testing.assert_allclose(golden, C_numpy, atol=1e-3, rtol=1e-3)
+
+
[email protected]_func
+def gemm_mma_m8n8k16_row_col_s8u8s32(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, 16], dtype="int8")
+    B = T.match_buffer(b, [8, 16], dtype="uint8")
+    C = T.match_buffer(c, [8, 8], dtype="int32")
+    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([4], "int8", scope="local")
+    MultiB = T.allocate([4], "uint8", scope="local")
+    Accum = T.allocate([2], "int32", scope="local")
+    for i in range(2):
+        Accum[i] = T.int32(0)
+
+    for mma_multi_a_col in T.vectorized(4):
+        MultiA[mma_multi_a_col] = A[(tx % 32) // 4, mma_multi_a_col + (tx % 
32) % 4 * 4]
+    for mma_multi_b_col in T.vectorized(4):
+        MultiB[mma_multi_b_col] = B[(tx % 32) // 4, mma_multi_b_col + (tx % 
32) % 4 * 4]
+    T.evaluate(
+        T.ptx_mma(
+            "m8n8k16",
+            "row",
+            "col",
+            "int8",
+            "uint8",
+            "int32",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="int32",
+        )
+    )
+    for mma_accum_c_id in range(2):
+        C[(tx % 32) // 4, (tx % 32) % 4 * 2 + mma_accum_c_id] = T.load(
+            "int32", Accum, mma_accum_c_id
+        )
+
+
[email protected]_cuda
+def test_gemm_mma_m8n8k16_row_col_s8u8s32():
+    sch = tvm.tir.Schedule(gemm_mma_m8n8k16_row_col_s8u8s32)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major * 10 + minor < 75:
+        # Require at least SM75
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    A_np = np.random.uniform(-10, 10, [8, 16]).astype("int8")
+    B_np = np.random.uniform(-10, 10, [8, 16]).astype("uint8")
+    C_np = np.random.uniform(-1, 1, [8, 8]).astype("int32")
+
+    ctx = tvm.cuda()
+    A_tvm = tvm.nd.array(A_np, ctx)
+    B_tvm = tvm.nd.array(B_np, ctx)
+    C_tvm = tvm.nd.array(C_np, ctx)
+
+    cuda_mod(A_tvm, B_tvm, C_tvm)
+
+    golden = np.matmul(A_np.astype("int32"), B_np.astype("int32").T)
+
+    C_numpy = C_tvm.numpy()
+
+    tvm.testing.assert_allclose(golden, C_numpy, atol=1e-3, rtol=1e-3)
+
+
[email protected]_func
+def gemm_mma_m8n8k32_row_col_s4s4s32(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, 32], dtype="int4")
+    B = T.match_buffer(b, [8, 32], dtype="int4")
+    C = T.match_buffer(c, [8, 8], dtype="int32")
+    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([8], "int4", scope="local")
+    MultiB = T.allocate([8], "int4", scope="local")
+    Accum = T.allocate([2], "int32", scope="local")
+    for i in range(2):
+        Accum[i] = T.int32(0)
+
+    for mma_multi_a_col in T.vectorized(8):
+        MultiA[mma_multi_a_col] = A[(tx % 32) // 4, mma_multi_a_col + (tx % 
32) % 4 * 8]
+    for mma_multi_b_col in T.vectorized(8):
+        MultiB[mma_multi_b_col] = B[(tx % 32) // 4, mma_multi_b_col + (tx % 
32) % 4 * 8]
+    T.evaluate(
+        T.ptx_mma(
+            "m8n8k32",
+            "row",
+            "col",
+            "int4",
+            "int4",
+            "int32",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="int32",
+        )
+    )
+    for mma_accum_c_id in range(2):
+        C[(tx % 32) // 4, (tx % 32) % 4 * 2 + mma_accum_c_id] = T.load(
+            "int32", Accum, mma_accum_c_id
+        )
+
+
[email protected]_cuda
+def test_gemm_mma_m8n8k32_row_col_s4s4s32():
+    sch = tvm.tir.Schedule(gemm_mma_m8n8k32_row_col_s4s4s32)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major * 10 + minor < 75:
+        # Require at least SM75
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    ctx = tvm.cuda()
+    A_tvm = tvm.nd.empty([8, 32], "int4", ctx)
+    B_tvm = tvm.nd.empty([8, 32], "int4", ctx)
+    C_tvm = tvm.nd.empty([8, 8], "int32", ctx)
+
+    cuda_mod(A_tvm, B_tvm, C_tvm)
+    # Currently the correctness is not checked.
+    # TODO: add correctness checking here.
+
+
[email protected]_func
+def gemm_mma_m8n8k32_row_col_s4u4s32(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, 32], dtype="int4")
+    B = T.match_buffer(b, [8, 32], dtype="uint4")
+    C = T.match_buffer(c, [8, 8], dtype="int32")
+    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([8], "int4", scope="local")
+    MultiB = T.allocate([8], "uint4", scope="local")
+    Accum = T.allocate([2], "int32", scope="local")
+    for i in range(2):
+        Accum[i] = T.int32(0)
+
+    for mma_multi_a_col in T.vectorized(8):
+        MultiA[mma_multi_a_col] = A[(tx % 32) // 4, mma_multi_a_col + (tx % 
32) % 4 * 8]
+    for mma_multi_b_col in T.vectorized(8):
+        MultiB[mma_multi_b_col] = B[(tx % 32) // 4, mma_multi_b_col + (tx % 
32) % 4 * 8]
+    T.evaluate(
+        T.ptx_mma(
+            "m8n8k32",
+            "row",
+            "col",
+            "int4",
+            "uint4",
+            "int32",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="int32",
+        )
+    )
+    for mma_accum_c_id in range(2):
+        C[(tx % 32) // 4, (tx % 32) % 4 * 2 + mma_accum_c_id] = T.load(
+            "int32", Accum, mma_accum_c_id
+        )
+
+
[email protected]_cuda
+def test_gemm_mma_m8n8k32_row_col_s4u4s32():
+    sch = tvm.tir.Schedule(gemm_mma_m8n8k32_row_col_s4u4s32)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major * 10 + minor < 75:
+        # Require at least SM75
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    ctx = tvm.cuda()
+    A_tvm = tvm.nd.empty([8, 32], "int4", ctx)
+    B_tvm = tvm.nd.empty([8, 32], "uint4", ctx)
+    C_tvm = tvm.nd.empty([8, 8], "int32", ctx)
+
+    cuda_mod(A_tvm, B_tvm, C_tvm)
+    # Currently the correctness is not checked.
+    # TODO: add correctness checking here.
+
+
[email protected]_func
+def gemm_mma_m16n8k8_row_col_fp16fp16fp32(a: T.handle, b: T.handle, c: 
T.handle):
+    T.func_attr({"global_symbol": "default_function", "tir.noalias": True})
+    A = T.match_buffer(a, [16, 8], dtype="float16")
+    B = T.match_buffer(b, [8, 8], dtype="float16")
+    C = T.match_buffer(c, [16, 8], dtype="float32")
+    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([4], "float16", scope="local")
+    MultiB = T.allocate([2], "float16", scope="local")
+    Accum = T.allocate([4], "float32", scope="local")
+    for i in range(4):
+        Accum[i] = T.float32(0)
+
+    for mma_multi_a_col in T.vectorized(4):
+        MultiA[mma_multi_a_col] = A[
+            (tx % 32) // 4 + mma_multi_a_col // 2 * 8, (tx % 32) % 4 * 2 + 
mma_multi_a_col % 2
+        ]
+    for mma_multi_b_col in T.vectorized(4):
+        MultiB[mma_multi_b_col] = B[
+            (tx % 32) // 4 + mma_multi_b_col // 2 * 8, (tx % 32) % 4 * 2 + 
mma_multi_b_col % 2
+        ]
+    T.evaluate(
+        T.ptx_mma(
+            "m16n8k8",
+            "row",
+            "col",
+            "fp16",
+            "fp16",
+            "fp32",
+            MultiA,
+            0,
+            MultiB,
+            0,
+            Accum,
+            0,
+            False,
+            dtype="float32",
+        )
+    )
+    for mma_accum_c_id in range(4):
+        C[
+            (tx % 32) // 4 + mma_accum_c_id // 2 * 8, (tx % 32) % 4 * 2 + 
mma_accum_c_id % 2
+        ] = T.load("float32", Accum, mma_accum_c_id)
+
+
[email protected]_cuda
+def test_gemm_mma_m16n8k8_row_col_fp16fp16fp32():
+    sch = tvm.tir.Schedule(gemm_mma_m16n8k8_row_col_fp16fp16fp32)
+    arch = tvm.contrib.nvcc.get_target_compute_version()
+    major, minor = tvm.contrib.nvcc.parse_compute_version(arch)
+    if major < 8:
+        # Require at least SM80
+        return
+    cuda_mod = tvm.build(sch.mod, target="cuda")
+
+    A_np = np.random.uniform(-1, 1, [16, 8]).astype("float16")
+    B_np = np.random.uniform(-1, 1, [8, 8]).astype("float16")
+    C_np = np.random.uniform(-1, 1, [16, 8]).astype("float32")

Review comment:
       note that random initialization does follow the convention we have in 
the tvm repo, so i dont think it confuses anybody. changing to zeros should 
good too, so i dont have strong opinion




-- 
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