code: def test_meta_programming_matmul():
      def matmul_generator(M: int, N: int, K: int, dtype: str):
          @T.prim_func
          def matmul(a: T.handle, b: T.handle, c: T.handle) -> None:
              A = T.match_buffer(a, [M, K], dtype=dtype)
              B = T.match_buffer(b, [N, K], dtype=dtype)
              C = T.match_buffer(c, [M, N], dtype=dtype)
  
              for i, j, k in T.grid(M, N, K):
                  with T.block():
                      vi, vj, vk = T.axis.remap("SSR", [i, j, k])
                      with T.init():
                          C[vi, vj] = T.float32(0)
                      C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
  
          return matmul
  
      @T.prim_func
      def matmul_128_128_128_fp16(
          a: T.handle, b: T.handle, c: T.handle
      ) -> None:
          A = T.match_buffer(a, [128, 128], dtype="float16")
          B = T.match_buffer(b, [128, 128], dtype="float16")
          C = T.match_buffer(c, [128, 128], dtype="float16")
  
          for i, j, k in T.grid(128, 128, 128):
              with T.block():
                  vi, vj, vk = T.axis.remap("SSR", [i, j, k])
                  with T.init():
                      C[vi, vj] = T.float32(0)
                  C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
  
      f = matmul_generator(128, 128, 128, "float16").with_attr(
          "global_symbol", "main"
      )
      tvm.ir.assert_structural_equal(
          f, matmul_128_128_128_fp16.with_attr("global_symbol", "main")
      )
  
imports: import tvm
  from tvm.script import tir
label_desc: Use image node_id 1 for calling a global function with example usage: test_meta_programming_matmul() and returns: matmul