code: def dot_16x1x16_uint8_int8_int16():
      """
      Int8 dot product by every 2 elements using AVX512 Skylake instructions.
      This function takes two arrays of uint8 and int8 datatype -- data[2] and
      kernel[4][32][2] -- and computes a dot product of data[2] with every
      2 elements of kernels, resulting in output[4][32] of int16 datatype.
      The pseudo code is as follows.
      .. code-block:: c
          void dot_16x1x16_uint8_int8_int16(uint8 data[2], int8 kernel[32*4][2],
                  int16 output[32*4]){
              for (int i = 0; i< 4; i++){
                  for (int j = 0; j < 32; j++){
                      output[i][i] = 0;
                      for (int k = 0; k < 2; k++){
                          output[i][j][k] += data[k] * kernel[i][j][k]
                      }
                  }
              }
          }
  
      Physically, the kernel array sits in four AVX512 vector registers and
      the data[2] is broadcasted to another AVX512 vector register. This
      function returns a TensorIntrin that can be used to tensorize
      a schedule.
  
      Returns
      -------
      intrin : TensorIntrin
          The Skylake int8 TensorIntrin that can be used in tensorizing schedule
      """
  
      int16_lanes = (
          4 * 32
      )  # 4*32 int32 lanes in 4 AVX512 vector registers
      num_int8_elements = 2  # 2 int8 elements in int16
      data = te.placeholder(
          (num_int8_elements,), dtype="uint8", name="data"
      )
      kernel = te.placeholder(
          (int16_lanes, num_int8_elements), dtype="int8", name="kernel"
      )
      k = te.reduce_axis((0, num_int8_elements), name="k")
      C = te.compute(
          (int16_lanes,),
          lambda i: te.sum(
              data[k].astype("int16") * kernel[i, k].astype("int16"),
              axis=k,
          ),
          name="C",
      )
  
      a_buffer = tvm.tir.decl_buffer(
          data.shape,
          dtype="uint8",
          name="a_buffer",
          offset_factor=1,
          strides=[1],
      )
      b_buffer = tvm.tir.decl_buffer(
          kernel.shape, dtype="int8", name="b_buffer", offset_factor=1
      )
      # strides=[te.var('ldw'), 1, 1])
  
      def _intrin_func(ins, outs):
          def _instr(index):
              ib = tvm.tir.ir_builder.create()
              if index == 1:
                  for i in range(4):
                      ib.emit(
                          outs[0].vstore(
                              [i * 32], tvm.tir.const(0, "int16x32")
                          )
                      )
                  return ib.get()
  
              a_int8 = ins[0].vload([0], "uint8x2")
              re_int16 = tvm.tir.call_intrin(
                  "int16", "tir.reinterpret", a_int8
              )
              vec_ai16 = re_int16.astype("int16x32")
              vec_a = tvm.tir.call_intrin(
                  "int8x64", "tir.reinterpret", vec_ai16
              )
  
              for i in range(4):
                  vec_b = ins[1].vload([i * 32, 0], "int8x64")
                  pair_reduction = tvm.tir.call_llvm_pure_intrin(
                      "int16x32",
                      "llvm.x86.avx512.pmaddubs.w.512",
                      tvm.tir.const(2, "uint32"),
                      vec_a,
                      vec_b,
                  )
                  if index == 0:
                      ib.emit(outs[0].vstore([i * 32], pair_reduction))
                  else:
                      ib.emit(
                          outs[0].vstore(
                              [i * 32],
                              pair_reduction
                              + outs[0].vload([i * 32], "int16x32"),
                          )
                      )
              return ib.get()
  
          # body, reset, update
          return _instr(0), _instr(1), _instr(2)
  
      buffer_params = {"offset_factor": 1}
      return te.decl_tensor_intrin(
          C.op,
          _intrin_func,
          binds={data: a_buffer, kernel: b_buffer},
          default_buffer_params=buffer_params,
      )
  
file_path: tvm/python/tvm/topi/x86/tensor_intrin.py
imports: import tvm
  from tvm import te
  import tvm.target.codegen
  from tvm.target.x86 import target_has_features, get_simd_32bit_lanes
label_desc: Use image node_id 3 for calling a global function with example usage: dot_16x1x16_uint8_int8_int16() and returns: te, _instr,  _instr,  _instr, ib, ib