code: def _add_target_specific_marks(metafunc):
      """Add any target-specific marks to parametrizations over target"""
  
      def update_parametrize_target_arg(
          mark,
          argnames,
          argvalues,
          *args,
          **kwargs,
      ):
          args = [
              arg.strip() for arg in argnames.split(",") if arg.strip()
          ]
          if "target" in args:
              target_i = args.index("target")
  
              new_argvalues = []
              for argvalue in argvalues:
                  if isinstance(
                      argvalue, _pytest.mark.structures.ParameterSet
                  ):
                      # The parametrized value is already a
                      # pytest.param, so track any marks already
                      # defined.
                      param_set = argvalue.values
                      target = param_set[target_i]
                      additional_marks = argvalue.marks
                  elif len(args) == 1:
                      # Single value parametrization, argvalue is a list of values.
                      target = argvalue
                      param_set = (target,)
                      additional_marks = []
                  else:
                      # Multiple correlated parameters, argvalue is a list of tuple of values.
                      param_set = argvalue
                      target = param_set[target_i]
                      additional_marks = []
  
                  if mark in metafunc.definition.own_markers:
                      xfail_targets = getattr(
                          metafunc.function,
                          "tvm_known_failing_targets",
                          [],
                      )
                      target_kind = (
                          target.split()[0]
                          if isinstance(target, str)
                          else target.kind.name
                      )
                      if target_kind in xfail_targets:
                          additional_marks.append(
                              pytest.mark.xfail(
                                  reason=f'Known failing test for target "{target_kind}"'
                              )
                          )
  
                  new_argvalues.append(
                      pytest.param(
                          *param_set,
                          marks=_target_to_requirement(target)
                          + additional_marks,
                      )
                  )
  
              try:
                  argvalues[:] = new_argvalues
              except TypeError as err:
                  pyfunc = metafunc.definition.function
                  filename = pyfunc.__code__.co_filename
                  line_number = pyfunc.__code__.co_firstlineno
                  msg = (
                      f"Unit test {metafunc.function.__name__} ({filename}:{line_number}) "
                      "is parametrized using a tuple of parameters instead of a list "
                      "of parameters."
                  )
                  raise TypeError(msg) from err
  
      if "target" in metafunc.fixturenames:
          # Update any explicit use of @pytest.mark.parmaetrize to
          # parametrize over targets.  This adds the appropriate
          # @tvm.testing.requires_* markers for each target.
          for mark in metafunc.definition.iter_markers("parametrize"):
              update_parametrize_target_arg(
                  mark, *mark.args, **mark.kwargs
              )
  
file_path: tvm/python/tvm/testing/plugin.py
imports: import pytest
  import _pytest
  import tvm
  from tvm.testing import utils
label_desc: Use image node_id 8 for calling a global function with example usage: _add_target_specific_marks(metafunc) without return types