code: def test_mixed_mm_gating(self):
      def fn(a, b):
          return torch.mm(a, b.to(a.dtype))
  
      args = (
          torch.randn(8, 8, device="cuda"),
          torch.randint(
              -128, 127, (8, 8), dtype=torch.int8, device="cuda"
          ),
      )
      # will ignore the mixed_mm code (including fallback)
      with inductor_config.patch(
          {"force_mixed_mm": False, "use_mixed_mm": False}
      ):
          self._test_mixed_impl(fn, args, False, False)
  
      # will use fallback_mixed_mm kernel due to no gemm_autotune
      with inductor_config.patch(
          {"force_mixed_mm": False, "use_mixed_mm": True}
      ):
          self._test_mixed_impl(fn, args, True, True)
  
      # will use mixed_mm kernel
      with inductor_config.patch(
          {"force_mixed_mm": True, "use_mixed_mm": False}
      ):
          self._test_mixed_impl(fn, args, True, False)
  
      # shows that use_mixed_mm doesn't do anything if foce_mixed_mm is set
      with inductor_config.patch(
          {"force_mixed_mm": True, "use_mixed_mm": True}
      ):
          self._test_mixed_impl(fn, args, True, False)
  
imports: import copy
  import unittest
  import torch
  import torch._dynamo.config
  import torch._inductor.config
  from torch._dynamo.test_case import run_tests, TestCase
  from torch._dynamo.utils import count_calls, counters
  from torch._higher_order_ops.out_dtype import out_dtype
  from torch._inductor.fx_passes import joint_graph
  from torch._inductor.fx_passes.serialized_patterns.central_index import get_serialized_pattern
  from torch._inductor.pattern_matcher import _TargetExpr, Arg, CallFunction, gen_pattern, KeywordArg, Match, PatternExpr, PatternMatcherPass, PatternPrettyPrinter, register_graph_pattern, stable_topological_sort
  from torch._inductor.utils import run_and_get_code
  from torch._inductor.virtualized import V
  from torch.testing import FileCheck
  from torch.testing._internal.common_cuda import SM80OrLater
  from torch.testing._internal.common_utils import IS_LINUX, skipIfRocm
  from torch.testing._internal.inductor_utils import HAS_CUDA
label_desc: Use image node_id 10 for calling the TestPatternMatcher obj's underlying member method code with example usage: obj.test_mixed_mm_gating() and returns: torch