code: def intrin_gemm_MxKxN(M, K, N, in_dtype, out_dtype, stride_w=1):
      """Defines a v7e-m DSP-accelerated transposed matmul."""
      # we generate a unique ID for every intrinsic definition, to prevent name
      # collisions in the generated source (e.g., if there are multiple operators
      # in the same module that use the same intrinsic)
      #
      # TODO(weberlo, areusch): to cut down on memory usage, we should cache each intrinsic
      # instantiation and include it only once, eliminating the need for unique
      # IDs
      UNIQ_ID_LEN = 8
      uniq_id = "".join(
          random.choices(string.ascii_uppercase, k=UNIQ_ID_LEN)
      )
  
      if isinstance(M, tvm.tir.IntImm):
          M = M.value
      if isinstance(K, tvm.tir.IntImm):
          K = K.value
      if isinstance(N, tvm.tir.IntImm):
          N = N.value
      # TODO(weberlo, areusch): support more dtypes?
      assert in_dtype in ("int8", "int16")
      assert out_dtype == "int32"
      A = te.placeholder(
          (M * stride_w - (stride_w - 1), K), name="a", dtype=in_dtype
      )
      B = te.placeholder((N, K), name="b", dtype=in_dtype)
      k = te.reduce_axis((0, K), name="k")
      C = te.compute(
          (M, N),
          lambda i, j: te.sum(
              A[i * stride_w, k].astype(out_dtype)
              * B[j, k].astype(out_dtype),
              axis=k,
          ),
          name="c",
      )
      A_buf = tvm.tir.decl_buffer(
          A.shape,
          A.dtype,
          name="A",
          offset_factor=1,
          strides=[te.var("A_s"), 1],
      )
      B_buf = tvm.tir.decl_buffer(
          B.shape,
          B.dtype,
          name="B",
          offset_factor=1,
          strides=[te.var("B_s"), 1],
      )
      C_buf = tvm.tir.decl_buffer(
          C.shape,
          C.dtype,
          name="C",
          offset_factor=1,
          strides=[te.var("C_s"), 1],
      )
  
      def intrin_func(ins, outs):
          aa, bb = ins
          cc = outs[0]
          gemm_func_prefix = "gemm" if in_dtype == "int8" else "gemm16"
  
          def _reduce_update():
              ib = tvm.tir.ir_builder.create()
              ib.emit(
                  tvm.tir.call_extern(
                      "int32",
                      f"{gemm_func_prefix}_{M}x{K}x{N}_update_{uniq_id}",
                      aa.access_ptr("r"),
                      bb.access_ptr("r"),
                      cc.access_ptr("w"),
                      aa.strides[0] * stride_w,
                      bb.strides[0],
                      cc.strides[0],
                  )
              )
              return ib.get()
  
          def _reduce_reset():
              ib = tvm.tir.ir_builder.create()
              ib.emit(
                  tvm.tir.call_extern(
                      "int32",
                      f"gemm_{M}x{K}x{N}_reset_{uniq_id}",
                      cc.access_ptr("w"),
                      cc.strides[0],
                  )
              )
              return ib.get()
  
          def _body():
              ib = tvm.tir.ir_builder.create()
              ib.emit(
                  tvm.tir.call_extern(
                      "int32",
                      f"{gemm_func_prefix}_{M}x{K}x{N}_body_{uniq_id}",
                      aa.access_ptr("r"),
                      bb.access_ptr("r"),
                      cc.access_ptr("w"),
                      aa.strides[0] * stride_w,
                      bb.strides[0],
                      cc.strides[0],
                  )
              )
              return ib.get()
  
          return _body(), _reduce_reset(), _reduce_update()
  
      intrin_decl = te.decl_tensor_intrin(
          C.op, intrin_func, binds={A: A_buf, B: B_buf, C: C_buf}
      )
      return intrin_decl, uniq_id
  
imports: import random
  import string
  import tvm
  from tvm import te
  from .None import common
label_desc: Use image node_id 1 for calling a global function with example usage: intrin_gemm_MxKxN(M, K, N, in_dtype, out_dtype, stride_w) and returns: intrin_decl,  uniq_id, _body,  _reduce_reset,  _reduce_update, ib, ib, ib