code: def add(x: torch.Tensor, y: torch.Tensor):
      # We need to preallocate the output.
      output = torch.empty_like(x)
      assert x.is_cuda and y.is_cuda and output.is_cuda
      n_elements = output.numel()
      # The SPMD launch grid denotes the number of kernel instances that run in parallel.
      # It is analogous to CUDA launch grids. It can be either Tuple[int], or Callable(metaparameters) -> Tuple[int].
      # In this case, we use a 1D grid where the size is the number of blocks:
      grid = lambda meta: (triton.cdiv(n_elements, meta["BLOCK_SIZE"]),)
      # NOTE:
      #  - Each torch.tensor object is implicitly converted into a pointer to its first element.
      #  - `triton.jit`'ed functions can be indexed with a launch grid to obtain a callable GPU kernel.
      #  - Don't forget to pass meta-parameters as keywords arguments.
      add_kernel[grid](x, y, output, n_elements, BLOCK_SIZE=1024)
      # We return a handle to z but, since `torch.cuda.synchronize()` hasn't been called, the kernel is still
      # running asynchronously at this point.
      return output
  
imports: import torch
  import triton
  import triton.language
label_desc: Use image node_id 2 for calling a global function with example usage: add(x, y) and returns: output