class_docstr: Abstraction for launching a helper process to benchmark kernels. Spawns
  the parent process and uses multiprocessing queues to send benchmark
  requests and return results.
class_docstr_tok: ["Abstraction","for","launching","a","helper","process","to","benchmark","kernels",".","Spawns","the","parent","process","and","uses","multiprocessing","queues","to","send","benchmark","requests","and","return","results","."]
docstr: Work loop for the benchmarking subprocess.
docstr_tok: ["Work","loop","for","the","benchmarking","subprocess","."]
code: def workloop(
      request_queue: Queue[Any], response_queue: Queue[Any]
  ) -> None:
      """
      Work loop for the benchmarking subprocess.
      """
      while True:
          obj = request_queue.get()
  
          if obj is None:
              break  # None is a sentinel for the child to terminate
          elif isinstance(obj, Ping):
              response_queue.put(Pong())
          elif isinstance(obj, BenchmarkRequest):
              response_queue.put(obj.benchmark())
          else:
              raise RuntimeError(f"Invalid request type {type(obj)}")
  
imports: from __future__ import annotations
  import contextlib
  import dataclasses
  import functools
  import logging
  import os
  import queue
  import time
  import warnings
  from concurrent.futures import ThreadPoolExecutor
  from ctypes import byref, c_size_t, c_void_p
  from multiprocessing.process import BaseProcess
  from multiprocessing.queues import Queue
  from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, TYPE_CHECKING, Union
  import torch
  from torch import multiprocessing
  from torch._dynamo.testing import rand_strided
  from torch._inductor import ir
  from torch._inductor.codecache import CUDACodeCache, DLLWrapper, PyCodeCache
  from .None import config
  from .utils import do_bench
  from .virtualized import V
label_desc: Use image node_id 2 for calling the TuningProcess obj's underlying member method code with example usage: obj.workloop(request_queue, response_queue) without return types