code: def matmul_kernel(
      a_ptr,
      b_ptr,
      c_ptr,  #
      M,
      N,
      K,  #
      stride_am,
      stride_ak,  #
      stride_bk,
      stride_bn,  #
      stride_cm,
      stride_cn,  #
      BLOCK_SIZE_M: tl.constexpr,
      BLOCK_SIZE_N: tl.constexpr,
      BLOCK_SIZE_K: tl.constexpr,  #
      GROUP_SIZE_M: tl.constexpr,  #
  ):
      pid = tl.program_id(axis=0)
      num_pid_n = tl.cdiv(N, BLOCK_SIZE_N)
      num_pid_m = tl.cdiv(M, BLOCK_SIZE_M)
      num_pid_in_group = GROUP_SIZE_M * num_pid_n
      group_id = pid // num_pid_in_group
      first_pid_m = group_id * GROUP_SIZE_M
      group_size_m = min(num_pid_m - first_pid_m, GROUP_SIZE_M)
      pid_m = first_pid_m + (pid % group_size_m)
      pid_n = (pid % num_pid_in_group) // group_size_m
      block_offset_m = pid_m * BLOCK_SIZE_M
      block_offset_n = pid_n * BLOCK_SIZE_N
  
      a_tile_ptr = tl.make_block_ptr(
          base=a_ptr,
          shape=(M, K),
          strides=(stride_am, stride_ak),
          offsets=(block_offset_m, 0),
          block_shape=(BLOCK_SIZE_M, BLOCK_SIZE_K),
          order=(1, 0),
      )
      b_tile_ptr = tl.make_block_ptr(
          base=b_ptr,
          shape=(K, N),
          strides=(stride_bk, stride_bn),
          offsets=(0, block_offset_n),
          block_shape=(BLOCK_SIZE_K, BLOCK_SIZE_N),
          order=(0, 1),
      )
      accumulator = tl.zeros(
          (BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=tl.float32
      )
  
      for k in range(0, K, BLOCK_SIZE_K):
          a = tl.load(a_tile_ptr)
          b = tl.load(b_tile_ptr)
          accumulator += tl.dot(a, b)
          a_tile_ptr = tl.advance(a_tile_ptr, [0, BLOCK_SIZE_K])
          b_tile_ptr = tl.advance(b_tile_ptr, [BLOCK_SIZE_K, 0])
  
      c_block_ptr = tl.make_block_ptr(
          base=c_ptr,
          shape=(M, N),
          strides=(stride_cm, stride_cn),
          offsets=(block_offset_m, block_offset_n),
          block_shape=(BLOCK_SIZE_M, BLOCK_SIZE_N),
          order=(1, 0),
      )
  
      tl.store(c_block_ptr, accumulator)
  
imports: import torch
  from torch.testing import assert_close
  import triton
  import triton.language
label_desc: Use image node_id 1 for calling a global function with example usage: matmul_kernel(a_ptr, b_ptr, c_ptr, M, N, K, stride_am, stride_ak, stride_bk, stride_bn, stride_cm, stride_cn, BLOCK_SIZE_M, BLOCK_SIZE_N, BLOCK_SIZE_K, GROUP_SIZE_M) without return types