code: def autotune(
      configs,
      key,
      prune_configs_by=None,
      reset_to_zero=None,
      restore_value=None,
      warmup=25,
      rep=100,
  ):
      """
      Decorator for auto-tuning a :code:`triton.jit`'d function.
  
      .. highlight:: python
      .. code-block:: python
  
          @triton.autotune(configs=[
              triton.Config(meta={'BLOCK_SIZE': 128}, num_warps=4),
              triton.Config(meta={'BLOCK_SIZE': 1024}, num_warps=8),
            ],
            key=['x_size'] # the two above configs will be evaluated anytime
                           # the value of x_size changes
          )
          @triton.jit
          def kernel(x_ptr, x_size, **META):
              BLOCK_SIZE = META['BLOCK_SIZE']
      :note: When all the configurations are evaluated, the kernel will run multiple times.
             This means that whatever value the kernel updates will be updated multiple times.
             To avoid this undesired behavior, you can use the `reset_to_zero` argument, which
             resets the value of the provided tensor to `zero` before running any configuration.
      :param configs: a list of :code:`triton.Config` objects
      :type configs: list[triton.Config]
      :param key: a list of argument names whose change in value will trigger the evaluation of all provided configs.
      :type key: list[str]
      :param prune_configs_by: a dict of functions that are used to prune configs, fields:
          'perf_model': performance model used to predicate running time with different configs, returns running time
          'top_k': number of configs to bench
          'early_config_prune'(optional): a function used to do early prune (eg, num_stages). It takes configs:List[Config] as its input, and returns pruned configs.
      :param reset_to_zero: a list of argument names whose value will be reset to zero before evaluating any configs.
      :type reset_to_zero: list[str]
      :param restore_value: a list of argument names whose value will be restored after evaluating any configs.
      :type restore_value: list[str]
      :param warmup: Warmup time (in ms) to pass to benchmarking, defaults to 25.
      :type warmup: int
      :param rep: Repetition time (in ms) to pass to benchmarking, defaults to 100.
      :type rep: int
      """
  
      def decorator(fn):
          return Autotuner(
              fn,
              fn.arg_names,
              configs,
              key,
              reset_to_zero,
              restore_value,
              prune_configs_by,
              warmup,
              rep,
          )
  
      return decorator
  
imports: from __future__ import annotations
  import builtins
  import time
  from typing import Dict
  from ..testing import do_bench
  from .jit import KernelInterface
label_desc: Use image node_id 1 for calling a global function with example usage: autotune(configs, key, prune_configs_by, reset_to_zero, restore_value, warmup, rep) and returns: decorator, Autotuner